/* estilos.css
   Sistema visual da app, tirado de docs/design/prototipo-groomer.html:
   fontes, cores, 3 temas, modo escuro, botões, cartões,
   menu lateral (portátil) e barra inferior (telemóvel).
   Os temas e o modo são escolhidos em tema.js (atributos data-skin e data-mode no <html>). */

:root {
  /* Tema por defeito = Pêssego e menta */
  --skin-bg: #FFF7F2; --skin-accent: #E7835A; --skin-second: #4FAE8F;
  --skin-accent-strong: #B85A33; --skin-accent-light: #F4A882;
  --skin-second-strong: #2E7F66; --skin-second-light: #7FD0B4;
  --skin-bg-d: #1C1714; --skin-surface-d: #272019; --skin-line-d: #3B322C;

  --bg: var(--skin-bg); --surface: #FFFFFF; --ink: #2A2421; --muted: #6F6560; --line: #EADFD8;
  --accent: var(--skin-accent); --accent-text: var(--skin-accent-strong);
  --second: var(--skin-second); --second-text: var(--skin-second-strong);
  /* Cor do texto sobre os botões: o tema.js escolhe a que se lê melhor */
  --on-accent: #2A2421; --on-second: #2A2421;
  --ok: #3E9E68; --warn: #D99A1E; --bad: #D2534A;
  --shadow: 0 1px 2px rgba(60,40,30,.06), 0 6px 20px rgba(60,40,30,.06);
  --f-display: "Bricolage Grotesque", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --f-body: "Figtree", ui-sans-serif, "Segoe UI", system-ui, sans-serif;
  --r: 16px; --r-sm: 10px;
  --pattern: color-mix(in srgb, var(--skin-accent) 16%, transparent);
  color-scheme: light;
}

/* Os outros dois temas */
:root[data-skin="clean"] {
  --skin-bg: #F3F7F8; --skin-accent: #0E6F78; --skin-accent-strong: #0B5A61; --skin-accent-light: #5FC2CB;
  --skin-second: #E39264; --skin-second-strong: #B0603A; --skin-second-light: #F0B48F;
  --skin-bg-d: #111A1C; --skin-surface-d: #192427; --skin-line-d: #2A393C;
}
:root[data-skin="equilibrio"] {
  --skin-bg: #F7F5F1; --skin-accent: #2F8F7E; --skin-accent-strong: #21685B; --skin-accent-light: #6CCDBA;
  --skin-second: #EA8F6A; --skin-second-strong: #B65E3B; --skin-second-light: #F5B394;
  --skin-bg-d: #141A17; --skin-surface-d: #1D2521; --skin-line-d: #2F3A35;
}
/* Cores personalizadas: o tema.js põe só as duas cores; o resto calcula-se aqui */
:root[data-skin="custom"] {
  --skin-bg: color-mix(in srgb, var(--skin-accent) 6%, #FFFFFF);
  --skin-accent-strong: color-mix(in srgb, var(--skin-accent) 72%, #000000);
  --skin-accent-light: color-mix(in srgb, var(--skin-accent) 62%, #FFFFFF);
  --skin-second-strong: color-mix(in srgb, var(--skin-second) 72%, #000000);
  --skin-second-light: color-mix(in srgb, var(--skin-second) 62%, #FFFFFF);
  --skin-bg-d: color-mix(in srgb, var(--skin-accent) 9%, #131110);
  --skin-surface-d: color-mix(in srgb, var(--skin-accent) 11%, #1D1917);
  --skin-line-d: color-mix(in srgb, var(--skin-accent) 16%, #2C2724);
}

/* Modo escuro: automático (segue o aparelho) ou escolhido */
@media (prefers-color-scheme: dark) {
  :root[data-mode="auto"] {
    --bg: var(--skin-bg-d); --surface: var(--skin-surface-d); --ink: #F1ECE8; --muted: #ABA39D; --line: var(--skin-line-d);
    --accent-text: var(--skin-accent-light); --second-text: var(--skin-second-light);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    --pattern: color-mix(in srgb, var(--skin-accent) 13%, transparent); color-scheme: dark;
  }
}
:root[data-mode="escuro"] {
  --bg: var(--skin-bg-d); --surface: var(--skin-surface-d); --ink: #F1ECE8; --muted: #ABA39D; --line: var(--skin-line-d);
  --accent-text: var(--skin-accent-light); --second-text: var(--skin-second-light);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
  --pattern: color-mix(in srgb, var(--skin-accent) 13%, transparent); color-scheme: dark;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.45;
       -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent-text); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Fundo com padrão de patinhas (a cor vem do tema) */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  /* 33% x intensidade por defeito (0.4) = os 13% de antes. A intensidade vem das preferências. */
  background: color-mix(in srgb, var(--skin-accent) 33%, transparent); opacity: var(--paws-op, .4);
  -webkit-mask-image: var(--paws); mask-image: var(--paws);
  -webkit-mask-size: 280px 280px; mask-size: 280px 280px; -webkit-mask-repeat: repeat; mask-repeat: repeat;
}
/* Fundo de cor lisa: tinge ligeiramente o fundo do modo atual, sem patinhas */
:root[data-fundo="cor"] body { background: color-mix(in srgb, var(--fundo-cor, var(--bg)) 30%, var(--bg)); }
:root[data-fundo="cor"] body::before, :root[data-fundo="foto"] body::before { display: none; }
/* Fundo com foto própria + véu por cima para o texto se ler bem */
/* A foto preenche toda a área da direita (à direita do menu lateral, 236 px) */
#fundo-foto { display: none; position: fixed; inset: 0 0 0 236px; z-index: 0; pointer-events: none;
              background-size: cover; background-repeat: no-repeat; background-position: center; }
/* Com patinhas ou foto de fundo, os blocos ficam semitransparentes (com desfoque, para o texto se ler bem) */
:root[data-fundo="foto"] .main .panel, :root[data-fundo="foto"] .main #faixa,
:root[data-fundo="patinhas"] .main .panel, :root[data-fundo="patinhas"] .main #faixa {
  background: color-mix(in srgb, var(--surface) var(--bloco-pct, 62%), transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
@media (max-width: 860px) { #fundo-foto { inset: 0; } }   /* sem menu lateral: ocupa o ecrã todo */
#fundo-foto::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 74%, transparent); }
:root[data-fundo="foto"] #fundo-foto { display: block; }

/* ---------- Botões, chips, campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
       padding: 10px 16px; min-height: 42px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .92rem;
       text-decoration: none; color: var(--ink); }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.pri:hover { filter: brightness(.95); }
.btn.sec { background: var(--second); border-color: var(--second); color: var(--on-second); }
.btn.ghost { border-color: transparent; background: none; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn:focus-visible, .nav button:focus-visible, .chip:focus-visible, .tipo:focus-visible, .tcard:focus-visible,
input:focus-visible, select:focus-visible, .bottom button:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .78rem; font-weight: 600;
        border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.chip.acc { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); color: var(--accent-text); }
button.chip { cursor: pointer; min-height: 36px; padding: 6px 14px; font-size: .86rem; }
button.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.fld { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.fld > span, .fld > label { font-size: .84rem; font-weight: 600; color: var(--muted); }
.fld input[type=text], .fld input[type=email], .fld input[type=password], .fld input[type=tel], .fld input[type=date], .fld input[type=time],
.fld input[type=number], .fld select, .fld textarea {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); width: 100%; }
.fld input[type=color] { height: 46px; width: 100%; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.fld small { color: var(--muted); font-size: .8rem; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; margin-top: 16px; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.panel > h2 + p, .panel > h3 + p { margin-top: 4px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center;
        font-family: var(--f-display); font-weight: 800; font-size: 1.25rem; flex: none; overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Foto de perfil (redonda); sem foto mostra a inicial do email */
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; overflow: hidden; display: grid; place-items: center;
          background: var(--second); color: var(--on-second); font-family: var(--f-display); font-weight: 800; font-size: 1rem; }
.avatar.grande { width: 64px; height: 64px; font-size: 1.6rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.eu { display: flex; align-items: center; gap: 10px; min-width: 0; }
.eu span { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fld > label.btn { color: var(--ink); font-size: .92rem; align-self: flex-start; }
.fld input[type=range] { width: 100%; accent-color: var(--accent); }
label.btn:has(+ input:focus-visible), label.btn:has(~ input:focus-visible) { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.stamp { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--muted); }
.stamp img { display: block; height: 25px; width: auto; flex: none; }
.stamp b { color: var(--ink); }

/* Faixa de aviso do estado do negócio */
#faixa { padding: 11px 14px; border-radius: 12px; font-size: .9rem; background: color-mix(in srgb, var(--second) 18%, var(--surface));
         border: 1px solid color-mix(in srgb, var(--second) 40%, var(--line)); }
#faixa.aviso { background: color-mix(in srgb, var(--warn) 16%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
#faixa.grave { background: color-mix(in srgb, var(--bad) 13%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }

/* Mensagens (erro / ok): fixas no fundo para se verem sempre */
#mensagem { position: fixed; left: 50%; transform: translateX(-50%); z-index: 60; bottom: 24px;
            width: calc(100% - 32px); max-width: 460px; padding: 13px 16px; border-radius: 14px; font-weight: 600; font-size: .92rem;
            background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.2); cursor: pointer; }
#mensagem:empty { display: none; }
#mensagem.erro { background: color-mix(in srgb, var(--bad) 13%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
#mensagem.ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }

/* ---------- Ecrãs de entrada e assistente (sem menu) ---------- */
.auth { position: relative; z-index: 1; min-height: 100dvh; display: grid; place-items: center;
        padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.auth-box { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 18px; }
.auth-box.largo { max-width: 760px; }
.auth-marca { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.auth-marca .logo { width: 52px; height: 52px; border-radius: 16px; }
.auth-marca p { color: var(--muted); }
/* Logótipo da marca no topo dos ecrãs de entrada (139x160: mantém a proporção) */
.auth-marca .logo-marca { width: 64px; height: auto; display: block; }
.links { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; align-items: center; font-size: .92rem; }
.auth-foot { display: flex; justify-content: center; }

/* Assistente "Criar negócio" */
.steps { display: flex; gap: 6px; }
.steps span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.steps span.on { background: var(--accent); }
.wz-intro { display: flex; flex-direction: column; gap: 6px; }
.wz-intro .eyebrow { color: var(--accent-text); }
.wz-nav { display: flex; gap: 10px; justify-content: space-between; margin-top: 22px; flex-wrap: wrap; }
.wz-nav .btn { min-width: 130px; }
.tipos { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 18px; }
.tipo { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px; border-radius: var(--r); cursor: pointer; text-align: left;
        border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); min-height: 150px; }
.tipo:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.tipo.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.tipo .ico { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
             background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent-text); }
.tipo.on .ico { background: var(--accent); color: var(--on-accent); }
.tipo b { font-family: var(--f-display); font-size: 1.1rem; }
.tipo span.d { color: var(--muted); font-size: .85rem; }
.logo-linha { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.logo-linha .logo { width: 56px; height: 56px; border-radius: 16px; }
.logo-linha small { color: var(--muted); }

/* Temas */
.themecards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.tcard { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; background: var(--surface); color: var(--ink);
         display: flex; flex-direction: column; gap: 10px; text-align: left; }
.tcard.on { border-color: var(--ink); }
.tcard b { font-size: .92rem; }
.tprev { height: 54px; border-radius: 10px; display: flex; gap: 6px; padding: 8px; align-items: flex-end; border: 1px solid var(--line); }
.tprev span { flex: 1; border-radius: 6px; }

/* Pré-visualização ao vivo (usa as cores da página, que mudam ao escolher um tema) */
.mock { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg); display: grid; grid-template-columns: 150px 1fr; min-height: 190px; }
.mock-side { background: var(--surface); border-right: 1px solid var(--line); padding: 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.mock-brand { display: flex; align-items: center; gap: 8px; font-family: var(--f-display); font-weight: 700; font-size: .85rem; min-width: 0; }
.mock-brand .logo { width: 28px; height: 28px; border-radius: 9px; font-size: .9rem; }
.mock-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mock-item { height: 26px; border-radius: 9px; background: color-mix(in srgb, var(--muted) 14%, transparent); }
.mock-item.on { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.mock-main { padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mock-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.mock-line { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 12%, transparent); }
.mock-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mock-btns .btn { min-height: 34px; padding: 6px 14px; font-size: .82rem; pointer-events: none; }

/* ---------- App: menu lateral + conteúdo ---------- */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 236px 1fr; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; padding: 20px 14px; display: flex; flex-direction: column; gap: 22px;
        border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; min-width: 0; }
.brand b { font-family: var(--f-display); font-size: 1.02rem; display: block; line-height: 1.15; overflow-wrap: anywhere; }
.brand small { color: var(--muted); font-size: .78rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 0; background: none; border-radius: 12px; cursor: pointer;
              text-align: left; color: var(--muted); font-weight: 600; font-size: .95rem; }
.nav button:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--ink); }
.nav button.on { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); color: var(--accent-text); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 0 6px; }
.main { min-width: 0; padding-inline: clamp(16px, 3vw, 36px); padding-block: 22px 40px; }
.wrap { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar .grow { flex: 1; min-width: 0; }
.topbar .logo { width: 38px; height: 38px; border-radius: 11px; }
.mob-only { display: none; }
.bottom { display: none; }
.wrap > .auth-foot { display: none; }   /* no portátil o selo já está no menu lateral */

.soon { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 26px 22px; }
.soon .ico { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
             background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent-text); }
.soon p { color: var(--muted); max-width: 52ch; }

.linha { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.linha:first-of-type { border-top: 0; }
.linha .grow { flex: 1; min-width: 180px; }
.linha .grow b { display: block; }
.aspeto-acoes { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
/* Blocos das Definições: minimizados por defeito, abrem ao tocar no título */
details.bloco > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; }
details.bloco > summary::-webkit-details-marker { display: none; }
details.bloco > summary::after { content: ""; width: 9px; height: 9px; flex: none; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
                                 transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
details.bloco[open] > summary::after { transform: rotate(-135deg); }
details.bloco > summary:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
details.bloco[open] > summary { margin-bottom: 8px; }
.aviso-eliminar { padding: 12px 14px; border-radius: 12px; font-size: .92rem; background: color-mix(in srgb, var(--bad) 13%, var(--surface));
                  border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line)); }
#faixa-eliminacao { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#form-eliminar, #eliminar-confirmar { margin-top: 6px; }
.sub-bloco { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
details.avancado { margin-top: 16px; }
details.avancado summary { cursor: pointer; font-weight: 600; color: var(--accent-text); }

/* ---------- Tablet e telemóvel ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .mob-only { display: flex; }
  .wrap > .auth-foot { display: flex; }
  .main { padding-block: 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line);
            padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .bottom button { flex: 1; min-width: 0; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px;
                   font-size: .7rem; font-weight: 600; color: var(--muted); padding: 7px 2px; border-radius: 10px; cursor: pointer; }
  .bottom button.on { color: var(--accent-text); }
  #mensagem { bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
  input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea { font-size: 16px; }   /* evita o zoom automático no iPhone */
}
@media (max-width: 640px) {
  h1 { font-size: 1.45rem; }
  /* Temas lado a lado, mais pequenos, para ver a pré-visualização sem andar a rolar */
  .themecards { gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tcard { padding: 8px; gap: 8px; }
  .tcard b { font-size: .78rem; line-height: 1.2; }
  .tprev { height: 40px; padding: 6px; gap: 4px; }
  .tipos { grid-template-columns: 1fr 1fr; }
  .tipo { min-height: 0; padding: 14px; }
  .mock { grid-template-columns: 1fr; min-height: 0; }
  .mock-side { display: none; }
  .wz-nav .btn { flex: 1; }
  .panel { padding: 14px; }
}
@media (max-width: 360px) {
  .tipos { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  #mensagem { animation: sobe .2s ease-out; }
  @keyframes sobe { from { transform: translate(-50%, 10px); opacity: 0; } }
}

/* Interruptor ligar/desligar (módulos em Definições) */
.switch { position: relative; flex: none; width: 48px; height: 28px; border-radius: 999px; cursor: pointer;
          border: 1.5px solid var(--line); background: color-mix(in srgb, var(--ink) 14%, var(--surface)); transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 21px; height: 21px; border-radius: 50%;
                 background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.switch:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- Ecrã Animais: lista, cartões, fichas e formulários ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search { flex: 1; min-width: 200px; display: flex; align-items: center; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); min-height: 42px; }
.search input { border: 0; background: none; outline: none; flex: 1; min-width: 0; padding: 9px 0; }
.search:focus-within { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.acard { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
         cursor: pointer; text-align: left; box-shadow: var(--shadow); color: var(--ink); min-width: 0; }
.acard:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.acard:focus-visible, .search input:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.top { display: flex; gap: 12px; align-items: center; min-width: 0; }
.grow-min { min-width: 0; display: flex; flex-direction: column; }
.grow-min b, .grow-min h2 { overflow-wrap: anywhere; font-family: var(--f-display); font-size: 1.1rem; }
.pequeno { font-size: .86rem; }
/* Círculo do animal/cliente: tom leve, igual ao do item ativo do menu */
.pet-av { width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center;
          background: color-mix(in srgb, var(--accent) 15%, var(--surface)); color: var(--accent-text);
          font-family: var(--f-display); font-weight: 800; font-size: 1.3rem; }
.pet-av.cli { background: color-mix(in srgb, var(--second) 18%, var(--surface)); color: var(--second-text); }
/* Botão do WhatsApp: verde da marca */
.btn.wa { background: #25D366; border-color: #25D366; color: #08361b; }
.btn.wa:hover { filter: brightness(.95); border-color: #25D366; }
.pet-av.grande { width: 68px; height: 68px; font-size: 1.7rem; }
.chip.aviso { background: color-mix(in srgb, var(--warn) 18%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.factos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.nota { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.duas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sub-form { margin-top: 4px; padding: 0 0 4px 12px; border-left: 3px solid color-mix(in srgb, var(--accent) 40%, var(--line)); }
.fld textarea { padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); width: 100%; resize: vertical; }
#form-animal, #form-cliente { max-width: 640px; }
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .toolbar .btn { flex: 1; }
  .duas { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- Comportamento: semáforo, respostas e questionário ---------- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.chip.sem-verde { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.chip.sem-amarelo { background: color-mix(in srgb, var(--warn) 18%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.chip.sem-vermelho { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.sem-verde .dot { color: var(--ok); } .sem-amarelo .dot { color: var(--warn); } .sem-vermelho .dot { color: var(--bad); }
.chip.ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.chip.nivel-0 { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.chip.nivel-1 { background: color-mix(in srgb, var(--warn) 18%, var(--surface)); }
.chip.nivel-2 { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); }
.respostas { display: flex; flex-direction: column; }
.linha-resp { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.linha-resp:first-child { border-top: 0; }
.linha-resp small { flex-basis: 100%; }
.resp { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn.sm { min-height: 34px; padding: 4px 12px; font-size: .84rem; }
fieldset.questionario { border: 1px solid var(--line); border-radius: var(--r-sm); margin: 16px 0 0; padding: 0 14px 14px; }
fieldset.questionario legend { padding: 0 6px; font-weight: 700; font-family: var(--f-display); }

/* ---- Serviços e preços por porte (Definições → O teu negócio) ---- */
.servicos-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.servico { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.servico.desligado { opacity: .75; }
.servico-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.servico-topo b { overflow-wrap: anywhere; }
.servico-form { display: flex; flex-direction: column; }
.porte-linha { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: end; padding: 10px 0; border-top: 1px solid var(--line); }
.porte-linha .porte-atende { grid-column: 1 / -1; margin-top: 0; font-weight: 600; }
.porte-linha .fld { margin-top: 6px; }
@media (min-width: 640px) {
  .porte-linha { grid-template-columns: 150px 1fr 1fr; }
  .porte-linha .porte-atende { grid-column: auto; align-self: center; margin-bottom: 8px; }
}

/* ---------- Agenda: semana (portátil/tablet), dia (telemóvel) e marcações ---------- */
.agenda-barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.agenda-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.agenda-periodo { font-family: var(--f-display); font-size: 1.05rem; margin-left: 6px; }
.btn.icone { width: 42px; padding: 0; font-size: 1.3rem; line-height: 1; }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.dot.sem-verde { color: var(--ok); } .dot.sem-amarelo { color: var(--warn); } .dot.sem-vermelho { color: var(--bad); }
/* A grelha da semana: se não couber, desliza só dentro da caixa (a página nunca ganha barra lateral) */
.cal-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); max-width: 100%; }
.cal { display: grid; min-width: 600px; }
.cal-h { position: sticky; top: 0; padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center; background: var(--surface); z-index: 2; }
.cal-h b { display: block; font-family: var(--f-display); font-size: 1.2rem; }
.cal-h.hoje b { color: var(--accent-text); }
.cal-h.hoje { box-shadow: inset 0 -3px 0 var(--accent); }
.cal-h.canto { left: 0; z-index: 4; }
.horas { position: sticky; left: 0; z-index: 3; background: var(--surface); }
.horas div { height: 56px; font-size: .72rem; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.horas div:first-child { transform: none; }
.diacol { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 56px; }
.diacol.hoje { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.marcavel .diacol { cursor: copy; }   /* tocar num espaço vazio = marcar */
.blk { position: absolute; border-radius: 10px; padding: 3px 7px; font-size: .78rem; overflow: hidden; cursor: pointer; text-align: left; color: var(--ink);
       border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 16%, var(--surface));
       display: flex; flex-direction: column; gap: 0; z-index: 1; line-height: 1.3; }
.blk b { display: flex; align-items: center; gap: 5px; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blk span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blk.feito { opacity: .55; }
.blk.falta { opacity: .45; text-decoration: line-through; }
.blk:focus-visible, .marc:focus-visible, .dchip:focus-visible, .achado:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.agora { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 2; pointer-events: none; }
.agora::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
/* Telemóvel: tira com os dias da semana e lista das marcações do dia */
.tira-dias { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.dchip { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0; border-radius: 12px; border: 1px solid var(--line);
         background: var(--surface); cursor: pointer; color: var(--ink); min-width: 0; }
.dchip span { font-size: .68rem; color: var(--muted); font-weight: 600; }
.dchip b { font-family: var(--f-display); font-size: 1.05rem; }
.dchip i { font-style: normal; font-size: .66rem; color: var(--muted); }
.dchip.hoje b { color: var(--accent-text); }
.dchip.on { background: var(--accent); border-color: var(--accent); }
.dchip.on span, .dchip.on b, .dchip.on i { color: var(--on-accent); }
.marc { display: grid; grid-template-columns: 52px 44px minmax(0, 1fr); gap: 10px; align-items: center; padding: 12px; border-radius: var(--r);
        background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); text-align: left; cursor: pointer; color: var(--ink); width: 100%; }
.marc .pet-av { width: 44px; height: 44px; font-size: 1.1rem; }
.marc-hora b { display: block; font-family: var(--f-display); font-size: 1.1rem; line-height: 1; font-variant-numeric: tabular-nums; }
.marc-hora small { display: block; font-size: .72rem; color: var(--muted); margin-top: 4px; }
.marc .chips { margin-top: 4px; gap: 4px; }
.marc.feito { opacity: .62; box-shadow: none; }
.marc.falta { opacity: .55; box-shadow: none; }
.marc.falta b { text-decoration: line-through; }
/* Ver uma marcação: dados à esquerda, ficha curta à direita (uma por baixo da outra em ecrãs estreitos) */
.cols-marc { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .cols-marc { grid-template-columns: 1fr; } }
/* Formulário da marcação */
#form-marcacao { max-width: 640px; }
.achados { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 320px; overflow-y: auto; }
.achado, .escolhido { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: left; min-width: 0; }
.achado { cursor: pointer; }
.achado:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.achado .pet-av, .escolhido .pet-av { width: 38px; height: 38px; font-size: 1rem; }
.escolhido .grow-min { flex: 1; }
.aviso-porte { margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: .9rem;
               background: color-mix(in srgb, var(--warn) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); }
@media (max-width: 640px) {
  .agenda-barra > .btn.pri { width: 100%; }
  .agenda-periodo { flex-basis: 100%; margin: 4px 0 0; }
}

/* ---- Ecrã Hoje ---- */
.hoje-data { margin: 0; }
.hoje-titulo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 1.15rem; margin: 6px 0 0; }
.hoje-cartao { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.hoje-cartao .top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hoje-cartao .top .grow-min { flex: 1 1 140px; }
.hoje-cartao .pet-av { width: 44px; height: 44px; font-size: 1.1rem; }
.hoje-cartao.feito { opacity: .7; }
.hoje-cartao.falta { opacity: .6; }
.hoje-cartao .chips { gap: 4px; }
.hoje-notas { margin: 0; }
.hoje-cartao .aspeto-acoes { margin: 0; }

/* Fotos: círculo do animal com foto e miniaturas Chegou / Pronto */
.pet-av { overflow: hidden; }
.pet-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fotos-marc { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.fotos-marc .foto { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fotos-marc .foto a { display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.fotos-marc .foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fotos-marc .btn { padding: 6px 10px; font-size: .85rem; }
input.so-ficheiro { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Horário de funcionamento: sombra nas horas fechadas da Agenda e linhas das Definições */
.diacol .fora { position: absolute; left: 0; right: 0; pointer-events: none; background: color-mix(in srgb, var(--muted) 12%, transparent); }
.horario-dias { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.horario-dia { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.horario-nome { display: flex; align-items: center; gap: 8px; min-width: 150px; text-transform: capitalize; }
.horario-horas { display: flex; align-items: center; gap: 6px; }
.horario-horas input[type=time] { width: auto; min-width: 0; }

/* ---- Equipa na Agenda ---- */
.agenda-equipa { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.agenda-equipa select { max-width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; }
#equipa-bloco select { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; }

/* Seletor de negócio (quem tem mais do que um) */
.seletor-negocio { padding: 0 6px; min-width: 0; }
.seletor-negocio select { width: 100%; max-width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; }
.side .seletor-negocio { margin-top: 10px; }

/* ---- Painel: números do mês ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi b { font-size: 1.5rem; line-height: 1.15; overflow-wrap: anywhere; }
.barras { display: flex; flex-direction: column; gap: 10px; }
.barra-linha { display: grid; grid-template-columns: minmax(70px, 28%) 1fr auto; align-items: center; gap: 10px; font-size: .88rem; }
.barra-nome { overflow-wrap: anywhere; }
.barra-trilho { height: 12px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); overflow: hidden; }
.barra-trilho i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.barra-valor { color: var(--muted); font-size: .8rem; text-align: right; white-space: nowrap; }
@media (max-width: 480px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi b { font-size: 1.25rem; } .barra-linha { grid-template-columns: minmax(60px, 32%) 1fr auto; } }

/* ---- Imagem antes/depois ---- */
.img-antes-depois { width: 100%; max-width: 420px; height: auto; border-radius: 12px; border: 1px solid var(--line); align-self: flex-start; }

.servico-topo { flex-wrap: wrap; }
.servico-topo > b { min-width: 9ch; }
