/* ---------- bravemaps · cores da Brave Defender (base igual à bravechat) ----------
   Laranja #F06D11 · Azul #022369 · Âmbar #FFA600 · Preto #171616 · Creme #FFFDFA
   Azul médio #234EAA · Teal #38BFC2 · Pêssego #FFF6EE · Borda #D9DEEA · Texto 2 #5A5650 */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/BricolageGrotesque.ttf?v=1") format("truetype");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --bg: #fffdfa;
  --panel: #ffffff;
  --head: #022369;          /* topo azul, como no exemplo de conversa do kit */
  --head-text: #fffdfa;
  --head-muted: rgba(255, 253, 250, .7);
  --in: #ffffff;
  --in-border: #d9deea;
  --out: #f06d11;
  --out-border: #f06d11;
  --out-text: #fffdfa;
  --out-muted: rgba(255, 253, 250, .8);
  --text: #171616;
  --muted: #5a5650;
  --accent: #f06d11;
  --accent-2: #f06d11;
  --amber: #ffa600;
  --accent-ink: #ffffff;
  --soft: #fff6ee;
  --soft-text: #c2560a;
  --lilac-soft: #eef2fb;
  --lilac-text: #234eaa;
  --line: #d9deea;
  --danger: #c93a2b;
  --danger-soft: #fdecea;
  --shadow: 0 8px 28px rgba(2, 35, 105, .12);
  --av-l: 91%;           /* luminosidade do fundo dos avatares */
  --name-l: 38%;         /* luminosidade da cor dos @números */
  --quote-mine: rgba(255, 255, 255, .18);
  --toast-bg: #022369;
  --toast-fg: #fffdfa;
  color-scheme: light;
}

/* ---------- modo escuro (azul Brave) ---------- */
:root[data-theme="dark"] {
  --bg: #061331;
  --panel: #0c1d47;
  --head: #022369;
  --head-text: #fffdfa;
  --head-muted: rgba(255, 253, 250, .68);
  --in: #12275a;
  --in-border: #1f3a7a;
  --out: #f06d11;
  --out-border: #f06d11;
  --out-text: #fffdfa;
  --out-muted: rgba(255, 253, 250, .78);
  --text: #f4f2ee;
  --muted: #a7b1c9;
  --accent: #ff8a3d;
  --accent-2: #ff8a3d;
  --amber: #ffa600;
  --soft: #2a1d17;
  --soft-text: #ffb27a;
  --lilac-soft: #12275a;
  --lilac-text: #cfdaf5;
  --line: #1f3a7a;
  --danger: #ff7a7a;
  --danger-soft: #3a1820;
  --shadow: 0 8px 28px rgba(0, 0, 0, .45);
  --av-l: 30%;
  --name-l: 74%;
  --quote-mine: rgba(0, 0, 0, .18);
  --toast-bg: #fffdfa;
  --toast-fg: #171616;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #061331;
    --panel: #0c1d47;
    --head: #022369;
    --head-text: #fffdfa;
    --head-muted: rgba(255, 253, 250, .68);
    --in: #12275a;
    --in-border: #1f3a7a;
    --out: #f06d11;
    --out-border: #f06d11;
    --out-text: #fffdfa;
    --out-muted: rgba(255, 253, 250, .78);
    --text: #f4f2ee;
    --muted: #a7b1c9;
    --accent: #ff8a3d;
    --accent-2: #ff8a3d;
    --amber: #ffa600;
    --soft: #2a1d17;
    --soft-text: #ffb27a;
    --lilac-soft: #12275a;
    --lilac-text: #cfdaf5;
    --line: #1f3a7a;
    --danger: #ff7a7a;
    --danger-soft: #3a1820;
    --shadow: 0 8px 28px rgba(0, 0, 0, .45);
    --av-l: 30%;
    --name-l: 74%;
    --quote-mine: rgba(0, 0, 0, .18);
    --toast-bg: #fffdfa;
    --toast-fg: #171616;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background-color: var(--bg);
  color: var(--text);
  font: 15px/1.4 "Bricolage Grotesque", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior: none;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}
/* a página em si nunca faz scroll: só as áreas de dentro (lista, formulários) */
body { position: fixed; inset: 0; width: 100%; }

.app {
  display: flex;
  flex-direction: column;
  /* altura = parte visível do ecrã (encolhe quando o teclado abre; ver app.js) */
  position: fixed;
  top: var(--app-top, 0px);
  left: 0;
  right: 0;
  height: 100vh;
  height: var(--app-h, 100dvh);
  max-width: 900px;
  margin: 0 auto;
  overflow: hidden;
  background-color: var(--bg);   /* liso: nada de imagens/gradientes no contentor do topo */
}

.page { background-color: var(--bg); }

/* ---------- barras de aviso (instalar / notificações) ---------- */
.install-bar, .notif-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  background: var(--lilac-soft);
  color: var(--lilac-text);
  font-size: 13px;
  flex-shrink: 0;
}
.install-bar span, .notif-bar span { flex: 1; }
.install-bar button, .notif-bar button {
  background: var(--accent-2); color: #fff; border: 0; border-radius: 16px;
  padding: 6px 12px; font-weight: 700; font-size: 13px; cursor: pointer;
}
.install-bar .x, .notif-bar .x { background: none; color: var(--lilac-text); padding: 4px 6px; }

/* ---------- folhas (diálogos) ---------- */
.sheet {
  border: 0; border-radius: 22px; padding: 0;
  background: var(--panel); color: var(--text);
  width: min(92vw, 360px);
  box-shadow: var(--shadow);
}
.sheet::backdrop { background: rgba(45, 36, 51, .35); }
.sheet-body { padding: 24px 20px 18px; text-align: center; }
.me-name { font-size: 26px; font-weight: 800; margin: 14px 0 4px; }
.muted { color: var(--muted); font-size: 13.5px; }
.btn {
  display: block; width: 100%; margin-top: 10px;
  padding: 13px; border-radius: 26px; border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
  font: inherit; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 16px rgba(240, 109, 17, .25);
}
.btn:disabled { opacity: .6; }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; }

/* =========================================================
   Ecrãs: início, admin, convite
   ========================================================= */
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.page {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 calc(env(safe-area-inset-bottom) + 24px);
}
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.small { font-size: 12.5px; }

.hero { text-align: center; padding: calc(env(safe-area-inset-top) + 40px) 20px 18px; }
.hero img { width: 116px; height: 116px; border-radius: 30px; box-shadow: var(--shadow); }
.hero h1 {
  margin: 18px 0 2px; font-size: 30px; font-weight: 800; letter-spacing: -.3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { margin: 0; color: var(--muted); }

.page .install-bar { margin: 6px 16px 0; border-radius: 14px; }

.choices { display: flex; flex-direction: column; gap: 10px; padding: 22px 16px 0; max-width: 460px; width: 100%; margin: 0 auto; }
a.btn { text-decoration: none; text-align: center; }
.btn.alt { background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.sm { padding: 9px 12px; margin-top: 0; font-size: 14px; }
.btn.danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }

.label { margin: 22px 16px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; }
.sheet .label { margin: 16px 0 6px; }

.cards { display: flex; flex-direction: column; gap: 8px; padding: 0 16px; max-width: 560px; width: 100%; margin: 0 auto; }
.card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  color: var(--text); text-decoration: none; cursor: pointer;
  box-shadow: 0 1px 3px rgba(122, 52, 96, .06);
}
.card:active { background: var(--soft); }
.card .ci { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; }
.card .ct { flex: 1; min-width: 0; }
.card .ct b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .ct span { font-size: 12.5px; color: var(--muted); }
.card .go { color: var(--muted); font-size: 22px; }

/* barra de topo das páginas */
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2;
}
.bar h1 { margin: 0; font-size: 17px; font-weight: 700; }
.bar .sub { margin: 0; font-size: 12px; color: var(--accent); }
.back {
  color: var(--accent); text-decoration: none; font-size: 34px; line-height: 1;
  padding: 0 8px 4px 2px; font-weight: 300;
}
.top .back { padding-right: 0; }
.link { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 6px; }

/* formulários */
.form { display: flex; flex-direction: column; gap: 14px; padding: 20px 16px; max-width: 460px; width: 100%; margin: 0 auto; }
.form.inline { flex-direction: row; align-items: center; gap: 8px; max-width: 560px; }
.form.inline input { flex: 1; min-width: 0; }
.form.inline .btn { width: auto; margin: 0; padding: 12px 18px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.form input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--text);
  font: inherit; font-size: 16px; outline: none;
}
.form input:focus { border-color: var(--accent); }
.at { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.at:focus-within { border-color: var(--accent); }
.at span { padding-left: 14px; color: var(--accent); font-weight: 800; font-size: 18px; }
.at input { border: 0; background: transparent; padding-left: 4px; font-size: 18px; font-weight: 700; }
.err { margin: 0; color: var(--danger); font-size: 13.5px; }
.group-chip { padding: 10px 14px; border-radius: 14px; background: var(--soft); color: var(--soft-text); }
.form.center { align-items: stretch; text-align: center; }

/* ---------- iPhone (iOS 26+): desfocado do sistema no topo ----------
   O iOS desenha um "vidro" desfocado por cima da barra da hora e ~40pt abaixo dela.
   1) faixa de cor lisa por trás da barra, para não haver nada para desfocar;
   2) se a app estiver por baixo da barra (instalações antigas), o conteúdo do topo
      desce para fora da zona desfocada (classe .ios-pad, posta pelo app.js). */
.sb-cover {
  position: fixed; top: 0; left: 0; right: 0;
  height: env(safe-area-inset-top);
  background-color: var(--bg);
  z-index: 50;
  pointer-events: none;
}
.ios-pad .sb-cover { height: calc(env(safe-area-inset-top) + 40px); }
.ios-pad .top, .ios-pad .bar { padding-top: calc(env(safe-area-inset-top) + 50px); }
.ios-pad .hero { padding-top: calc(env(safe-area-inset-top) + 60px); }
.ios-pad .bar { position: relative; z-index: 51; background: transparent; border-bottom: 0; }
.ios-pad .top { position: relative; z-index: 51; background: transparent; border-bottom: 0; }
.ios-pad .app { background-color: var(--panel); }

/* escolha de aparência */
.appearance { max-width: 460px; width: 100%; margin: 6px auto 0; padding: 0 16px; }
.appearance .label { margin-left: 0; }
.theme-pick {
  display: flex; gap: 4px; padding: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
}
.theme-pick button {
  flex: 1; border: 0; border-radius: 12px; padding: 9px 4px;
  background: transparent; color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.theme-pick button.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.sheet .theme-pick { margin-bottom: 4px; }

/* =========================================================
   Guia de instalação (só no browser)
   ========================================================= */
.howto {
  max-width: 460px; width: calc(100% - 32px); margin: 8px auto 0;
  padding: 16px 14px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 2px 10px rgba(122, 52, 96, .07);
}
.howto-head h2 { margin: 0 0 4px; font-size: 18px; }
.howto-head p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.howto #installNow { margin: 0 0 12px; }
.howto-warn {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 12px;
  background: var(--danger-soft); color: var(--danger); font-size: 13.5px;
}
.howto-tabs {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
}
.howto-tabs button {
  flex: 1; border: 0; border-radius: 10px; padding: 8px 2px;
  background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.howto-tabs button.on { background: var(--panel); color: var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.howto-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.howto-step {
  display: grid; grid-template-columns: 24px max-content 1fr; align-items: center; gap: 10px;
  padding: 8px; border-radius: 14px; background: var(--bg);
}
.howto-step .num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 800; font-size: 13px;
}
.howto-step p { margin: 0; font-size: 14px; line-height: 1.4; }
.howto-note { margin: 10px 2px 4px; font-size: 12.5px; color: var(--muted); }
.howto .link { display: block; margin: 2px auto 0; }
.kbd {
  display: inline-block; min-width: 18px; padding: 0 4px; border-radius: 5px; text-align: center;
  background: var(--soft); color: var(--accent); font-weight: 700;
}

/* desenhos dos ecrãs */
.mk { width: 92px; height: auto; display: block; overflow: visible; }
.mk.wide { width: 128px; }
.mk .f { fill: var(--panel); stroke: var(--line); stroke-width: 2; }
.mk .s { fill: var(--bg); }
.mk .mbar { fill: var(--in); }
.mk .mpill { fill: var(--bg); stroke: var(--line); }
.mk .g { fill: var(--line); }
.mk .mdim { fill: rgba(0, 0, 0, .25); }
.mk .msheet { fill: var(--panel); stroke: var(--line); }
.mk .mrow { fill: var(--bg); }
.mk .mrow.on { fill: var(--soft); }
.mk .btnk { fill: var(--accent); }
.mk .tog { fill: #34c759; }
.mk .togk { fill: #fff; }
.mk text { font: 600 7px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; fill: var(--text); }
.mk .tm { fill: var(--muted); font-weight: 500; }
.mk .tb { fill: var(--accent); font-weight: 800; }
.mk .tw { fill: #fff; font-weight: 800; }
.mk .ti { font-size: 13px; fill: var(--text); }
.mk .ic { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.mk .hl {
  fill: none; stroke: var(--accent); stroke-width: 2.5;
  animation: hlpulse 1.4s ease-in-out infinite;
}
@keyframes hlpulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .mk .hl { animation: none; } }
.mk .ts { font-size: 6.2px; }

/* =========================================================
   Brave Defender: fundo igual de cima abaixo, mensagens laranja
   ========================================================= */
.top, .bar { background: var(--bg); border-bottom: 1px solid var(--line); color: var(--text); }
.top .room-info h1, .bar h1 { color: var(--text); }
.top .room-info p { color: var(--muted); }
.top .back, .bar .back { color: var(--accent); }
.bar .sub { color: var(--accent); }
.bar .link { color: var(--accent); }
.top .icon-btn { background: var(--soft); }
.avatar.sm { box-shadow: 0 0 0 2px var(--accent); }
.ios-pad .top, .ios-pad .bar { background: var(--bg); }
.sb-cover, .ios-pad .sb-cover { background-color: var(--bg); }
.composer, .read-only { background: var(--bg); }

h1, h2, .me-name, .code, .sheet-title, .howto-head h2 { font-family: "Bricolage Grotesque", -apple-system, sans-serif; letter-spacing: -.2px; }
.who, .q-who { letter-spacing: .1px; }

/* as minhas mensagens: laranja com texto creme */
.row.mine .bubble { background: var(--out); border-color: var(--out-border); color: var(--out-text); }
.row.mine .time { color: var(--out-muted); }
.row.mine .bubble .quote { background: var(--quote-mine); border-left-color: var(--out-text); }
.row.mine .bubble .q-who { color: var(--out-text); }
.row.mine .bubble .q-text { color: var(--out-muted); }
.row.mine.deleted .bubble { background: var(--panel); color: var(--muted); border-color: var(--line); }

/* ecrã inicial: faixa azul com o logótipo, como no kit de marca */
/* ecrã inicial: fundo neutro, logótipo + "Brave" (texto) "Chat" (laranja) */
.hero { background: transparent; color: var(--text); padding-bottom: 14px; }
.hero img { box-shadow: 0 10px 30px rgba(2, 35, 105, .22); }
/* título em estilo logótipo: "Brave" extra bold + "chat" leve, mesma letra e mesma largura */
.hero h1.wordmark {
  background: none; -webkit-background-clip: border-box; background-clip: border-box;
  margin: 16px 0 4px;
  color: var(--text); font-size: 44px; line-height: 1; letter-spacing: -1.4px;
  font-weight: 800; font-stretch: 100%;
  font-variation-settings: "wght" 800, "wdth" 100, "opsz" 72;
}
.hero h1.wordmark span {
  color: var(--accent); letter-spacing: -.9px; margin-left: 1px;
  font-weight: 340; font-stretch: 100%;
  font-variation-settings: "wght" 340, "wdth" 100, "opsz" 72;
}
.hero p { color: var(--muted); }

/* botões: laranja liso da marca */
.btn, .composer button, .theme-pick button.on, .howto-step .num { background: var(--accent); }
.btn.alt { background: var(--panel); color: var(--text); border-color: var(--line); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.sm.alt { background: var(--panel); }
.howto-tabs button.on { color: var(--accent); }
.install-bar button, .notif-bar button { background: #234eaa; }
.notif-bar, .install-bar { background: var(--lilac-soft); color: var(--lilac-text); }
.code { color: var(--accent); }
.group-chip { background: var(--soft); color: var(--soft-text); }
.mk .tog { fill: #38bfc2; }
.mk text { font-family: "Bricolage Grotesque", -apple-system, sans-serif; }

/* seta de voltar: desenho do sistema (a Bricolage tem um ‹ muito fino) */
.back, .card .go { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-weight: 400; }


/* botões com ícone desenhado */
.btn.with-icon { display: flex; align-items: center; justify-content: center; gap: 9px; }
.bi { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.btn.alt .bi { stroke: var(--accent); }

/* "Como instalar a app?" com mais destaque */
#howtoShow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 20px;
  background: var(--soft); color: var(--soft-text); border: 1px solid rgba(240, 109, 17, .35);
  font-size: 14px; font-weight: 700;
}

/* ---------- janelas acima do teclado ----------
   As janelas ficam centradas só na parte visível do ecrã (acima do teclado, em iPhone e Android),
   e fazem scroll por dentro se não couberem. */
dialog.sheet {
  position: fixed;
  top: var(--app-top, 0px);
  bottom: var(--app-bottom, 0px);
  margin: auto;
  max-height: calc(var(--app-h, 100dvh) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ícones da interface: todos com o mesmo traço */
.bi { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -4px; }
.icon-btn { color: var(--accent); }
.icon-btn .bi { width: 21px; height: 21px; }
.theme-pick button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.theme-pick button .bi { width: 17px; height: 17px; }
.menu-reply { display: flex; align-items: center; justify-content: center; gap: 8px; }
.menu-reply .bi { width: 18px; height: 18px; }
.link .bi, .promote .bi { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; }
#gdAdminTools .link, #mdNewCode { display: inline-flex; align-items: center; }
#howtoShow .bi { width: 17px; height: 17px; margin-right: 2px; }
.howto-head h2 { display: flex; align-items: center; gap: 8px; }
.howto-head h2 .bi { width: 22px; height: 22px; color: var(--accent); }
.note-ic { display: flex; align-items: flex-start; gap: 8px; }
.note-ic .bi { width: 16px; height: 16px; margin-top: 1px; color: var(--accent); }
.read-only.note-ic { justify-content: center; align-items: center; }
.notif-bar .note-ic { align-items: center; }
.howto-warn { display: flex; gap: 8px; align-items: flex-start; }
.howto-warn .bi { width: 18px; height: 18px; flex-shrink: 0; }
.new-photo .cam .bi { width: 15px; height: 15px; color: #fff; vertical-align: 0; }
.new-photo.big .cam .bi { width: 17px; height: 17px; }
.new-photo.has-photo .cam .bi { color: var(--accent); }
.notice.tip-only .bi { width: 16px; height: 16px; color: var(--accent); vertical-align: -3px; }
.plus-btn { padding: 0; }
.plus-btn .bi { width: 22px; height: 22px; stroke-width: 2.4; color: #fff; }


/* =========================================================
   bravemaps: ecrã de entrar + mapa
   ========================================================= */
#vLogin { position: fixed; inset: 0; overflow-y: auto; }
#vLogin #backMap { max-width: 428px; width: calc(100% - 32px); margin: 16px auto; }
.code-input { text-align: center; font-size: 22px !important; font-weight: 800; letter-spacing: 3px; font-family: ui-monospace, Menlo, monospace !important; }
.form select, .zmore select, .zmore input {
  width: 100%; padding: 12px 12px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 16px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.form.flat { padding: 8px 0 4px; max-width: none; }
.flabel { font-size: 13.5px; color: var(--muted); font-weight: 600; display: block; margin-bottom: 6px; }
label.check { flex-direction: row !important; align-items: center; gap: 10px !important; color: var(--text) !important; font-weight: 500 !important; }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.map-screen { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }

/* topo: procurar + eu + filtros */
.mtop { position: absolute; top: 0; left: 0; right: 0; z-index: 5; padding: calc(env(safe-area-inset-top) + 10px) 12px 0; pointer-events: none; }
.mtop > * { pointer-events: auto; }
.mtop-row { display: flex; gap: 8px; max-width: 640px; }
.search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 6px 0 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 23px; box-shadow: var(--shadow); color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 16px; }
.search input::-webkit-search-cancel-button { display: none; }
.q-x { border: 0; background: none; color: var(--muted); padding: 8px; cursor: pointer; display: grid; }
.me-dot, .pdot {
  --c: var(--accent);
  width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--panel); flex-shrink: 0;
  background: var(--c); color: #fff; font: inherit; font-weight: 800; font-size: 15px; letter-spacing: .3px;
  display: grid; place-items: center; box-shadow: var(--shadow); cursor: pointer;
}
.pdot { width: 44px; height: 44px; box-shadow: none; border: 0; cursor: default; }
.pdot.sm { width: 34px; height: 34px; font-size: 12.5px; }
.results {
  list-style: none; margin: 8px 0 0; padding: 6px; max-width: 586px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.results button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 12px;
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.results button:hover, .results button:focus { background: var(--soft); outline: none; }
.results .bi { color: var(--accent); }
.results span { display: flex; flex-direction: column; }
.results small { color: var(--muted); font-size: 12.5px; }
.results .none { padding: 10px; color: var(--muted); }
.chips { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 13px; border-radius: 17px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(2, 35, 105, .1); cursor: pointer;
}
.chip .bi { width: 15px; height: 15px; color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.on .bi { color: #fff; }
.chip.person i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.chip.person { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.person .bi { color: var(--bg); width: 14px; height: 14px; }

/* botões redondos à direita */
.fabs { position: absolute; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 56px); z-index: 4; display: flex; flex-direction: column; gap: 10px; }
.fab {
  width: 50px; height: 50px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--accent);
  display: grid; place-items: center; box-shadow: var(--shadow); cursor: pointer;
}
.fab .bi { width: 23px; height: 23px; }
.fab.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* legenda em baixo à esquerda */
.legend {
  position: absolute; left: 12px; bottom: calc(env(safe-area-inset-bottom) + 28px); z-index: 4;
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.lg-scale { display: flex; gap: 8px; }
.lg-scale span, .fade-preview span { display: inline-flex; align-items: center; gap: 4px; }
.lg-scale i, .fade-preview i { width: 14px; height: 14px; border-radius: 4px; background: #16a34a; display: inline-block; }
.lg-plan { display: inline-flex; align-items: center; gap: 4px; padding-left: 10px; border-left: 1px solid var(--line); }
.lg-plan i { width: 14px; height: 14px; border-radius: 4px; border: 2px dashed #16a34a; display: inline-block; }
.maplibregl-ctrl-bottom-left { bottom: calc(env(safe-area-inset-bottom) + 0px); }
.maplibregl-ctrl-attrib.maplibregl-compact { background: var(--panel); color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted); }

.zoom-hint {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 84px); z-index: 3;
  margin: 0; padding: 8px 14px; border-radius: 18px; background: var(--toast-bg); color: var(--toast-fg);
  font-size: 13px; box-shadow: var(--shadow); white-space: nowrap; pointer-events: none; opacity: .92;
}
.sel-bar {
  position: absolute; left: 12px; right: 74px; bottom: calc(env(safe-area-inset-bottom) + 70px); z-index: 6; max-width: 460px;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-radius: 26px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 700;
}
.sel-bar span { flex: 1; }
.sel-bar .btn { width: auto; margin: 0; padding: 9px 16px; }

/* folha da zona: por baixo, deixa ver o mapa por cima */
.bsheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; max-width: 560px; margin: 0 auto;
  max-height: 72vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 18px calc(env(safe-area-inset-bottom) + 18px);
  background: var(--panel); border-radius: 24px 24px 0 0; box-shadow: 0 -8px 30px rgba(2, 35, 105, .18);
  transform: translateY(30px); opacity: 0; transition: transform .22s ease, opacity .18s ease;
}
.bsheet.open { transform: none; opacity: 1; }
.bs-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.bs-x { position: absolute; top: 12px; right: 12px; border: 0; background: var(--soft); color: var(--accent); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.bsheet h2 { margin: 0 44px 0 0; font-size: 21px; }
.bsheet > .muted { margin: 2px 0 10px; }
.zmarks { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.zmarks.left { text-align: left; margin-top: 10px; }
.zm { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 14px; background: var(--bg); }
.zm.plan { border: 1.5px dashed var(--line); }
.zm.free { color: #16a34a; }
.zm.free .bi { width: 26px; height: 26px; margin: 0 4px; }
.zm-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.zm-t span { font-size: 13px; color: var(--muted); }
.zm-t em { font-size: 13px; color: var(--text); margin-top: 2px; }
.zm-del { border: 0; background: none; color: var(--danger); padding: 8px; cursor: pointer; display: grid; }
.zactions .row-btns .btn { margin-top: 0; padding: 13px 8px; font-size: 14.5px; }
.zactions .row-btns .btn .bi { width: 18px; height: 18px; }
.more-btn { display: inline-flex; align-items: center; margin-top: 8px; }
.zmore { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.zmore label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
.zmore .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* menu */
.profile { display: flex; align-items: center; gap: 12px; }
.profile b { display: block; font-size: 18px; }
.people, .plist { display: flex; flex-direction: column; gap: 4px; max-height: 38vh; overflow-y: auto; margin-bottom: 4px; }
.plist { max-height: 52vh; margin-top: 10px; }
.person-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 14px;
  background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.person-row:hover, .person-row.on { background: var(--soft); }
.person-row.off { opacity: .5; }
.pr-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pr-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-t small, .pr-n { color: var(--muted); font-size: 12.5px; }
.person-row .go { color: var(--muted); font-size: 22px; }
.credits { margin: 14px 0 0; font-size: 11px; line-height: 1.4; }
.big-ic { width: 40px !important; height: 40px !important; }
.big-ic.warn { color: var(--amber); }

/* cores */
.colors { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.sw { aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--c); cursor: pointer; position: relative; }
.sw.used::after { content: ""; position: absolute; inset: 38%; border-radius: 50%; background: rgba(255, 255, 255, .55); }
.sw.on { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--c); }

/* definições */
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 14px 0; }
.stepper button { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--accent); font-size: 26px; cursor: pointer; }
.stepper output { font-size: 40px; font-weight: 800; min-width: 60px; }
.fade-preview { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.fade-preview .gone { font-weight: 700; color: #16a34a; }

/* resumo */
.hlist { display: flex; flex-direction: column; gap: 8px; max-height: 56vh; overflow-y: auto; margin: 10px 0 4px; }
.hrow { display: flex; flex-direction: column; gap: 4px; }
.hr-t small { display: block; color: var(--muted); font-size: 12.5px; }
.hbar { height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

@media (min-width: 900px) {
  .bsheet { left: 16px; right: auto; bottom: 16px; width: 400px; border-radius: 24px; max-height: calc(100vh - 150px); margin: 0; }
}
.profile .muted { display: block; margin-top: 1px; }
.invite-box { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-top: 10px; }
.code { font-size: 28px; font-weight: 800; letter-spacing: 4px; color: var(--accent); font-family: ui-monospace, Menlo, monospace; }
.row-btns { display: flex; gap: 8px; }
.row-btns .btn { flex: 1; }
.code { color: var(--accent); }

/* ---------- meta do dia, sugestões, lápis ---------- */
.meter { padding: 10px 12px; border-radius: 14px; background: var(--bg); margin-bottom: 10px; }
.mt-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.mt-top span { color: var(--muted); font-size: 12.5px; }
.mt-bar { position: relative; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 7px 0 6px; }
.mt-bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px; }
.mt-bar em { position: absolute; inset: 0 auto 0 0; background: rgba(0, 0, 0, .25); }
.meter.ok .mt-bar i { background: #16a34a; }
.mt-msg { margin: 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.meter.ok .mt-msg { color: #16a34a; font-weight: 600; }
.mt-msg .bi { width: 16px; height: 16px; }
.zc-label { margin: 4px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; }
.zchips { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.zchip {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 14px;
  border: 1.5px dashed var(--accent); background: var(--soft); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.zchip .bi { color: var(--accent); width: 18px; height: 18px; }
.zchip span { display: flex; flex-direction: column; min-width: 0; }
.zchip small { color: var(--muted); font-size: 12.5px; }
.zchip.on { border-style: solid; background: var(--panel); }
.zchip:disabled { opacity: .45; cursor: not-allowed; }
.zm-z { display: block; font-size: 11.5px; color: var(--accent); font-weight: 700; }
.draw-layer { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 7; touch-action: none; cursor: crosshair; background: rgba(240, 109, 17, .04); }
.fab.pencil { color: var(--accent); }
#drawBar { z-index: 8; right: 12px; max-width: 520px; }
#drawBar .bi { color: var(--accent); }
#drawBar span { font-size: 13.5px; font-weight: 600; }
.tip {
  position: absolute; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 70px); z-index: 9; max-width: 420px;
  padding: 14px 16px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.tip b { font-size: 16px; }
.tip p { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; font-size: 14px; }
.tip .bi { width: 16px; height: 16px; color: var(--accent); vertical-align: -3px; }
.tip-n { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 12.5px; display: grid; place-items: center; }
.tip .btn { width: auto; padding: 9px 18px; margin-top: 4px; }
.set-gap { margin-top: 18px; }
@media (max-width: 899px) { .bsheet { max-height: 62vh; } }

/* ecrã de entrar: aviso do código, "Como instalar" e aparência mais juntos */
#loginForm { padding-bottom: 4px; }
#loginForm .muted { margin: 0; }
#howtoShowWrap { margin: 20px 0 0; }
#vLogin .appearance { margin-top: 0; }
#vLogin .appearance .label { margin-top: 20px; }
.bs-grip { width: 48px; height: 6px; margin-bottom: 12px; cursor: grab; }
.bsheet { touch-action: pan-y; }
.bsheet h2, .bs-grip { touch-action: none; }
