/* o atributo hidden vence sempre o display dos componentes (ex.: .notice é flex) */
[hidden] { display: none !important; }
/* Identidade «Terracota e linho» (claro) e «ardósia» (escuro): terracota só nas ações principais, item ativo e marcas do assistente;
   atendimento humano em azul-ardósia para se distinguir do assistente; âmbar só para modo de teste; vermelho só para falhas. */
:root {
  /* superfícies e texto */
  --bg: #f5f3ef; --surface: #ffffff; --surface-2: #f0ede7; --surface-3: #e6e1d8; --selected: #ffffff;
  --border: #e3ded6;          /* decorativo: cartões e separadores */
  --control: #7c8184;         /* fronteira de campos, interruptores e botões (≥3:1) */
  --text: #22282b; --muted: #5f6568;
  /* marca (assistente) */
  --brand: #8e5a43; --brand-ink: #ffffff; --brand-soft: #f4e9e2;
  /* atendimento humano / pedido à equipa */
  --human: #3e5f70; --human-ink: #ffffff; --human-soft: #e2ebef;
  /* estados */
  --warn: #7a4b00; --warn-soft: #fbf0d9;
  --ok: #2e6b45; --ok-soft: #e4f1e8;
  --danger: #b42318; --danger-ink: #ffffff; --danger-soft: #fde4e1;
  --ai: var(--brand); --ai-soft: var(--brand-soft);
  /* balões */
  --bubble-in: #ffffff; --bubble-bot: #f6ede6; --bubble-human: #e5edf1;
  /* raios, espaços, tipografia */
  --r-sm: 8px; --r-md: 10px; --r-lg: 12px; --r-xl: 16px; --radius: var(--r-lg);
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-6: 1.5rem; --sp-8: 2rem;
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.5rem;
  --measure: 860px;
  --shadow: none; /* cartões e secções sem sombra; só os elementos flutuantes têm --shadow-float */
  --shadow-float: 0 8px 24px rgba(34,40,43,.18);
  --shadow-bar: 0 -4px 14px rgba(34,40,43,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121517; --surface: #22282b; --surface-2: #2b3337; --surface-3: #3a4247; --selected: #3a4247;
    --border: #3f4a4f; --control: #7a8387; --text: #eee8dd; --muted: #b0aca4;
    --brand: #d49a7c; --brand-ink: #22282b; --brand-soft: #3a2b24;
    --human: #9fbccb; --human-ink: #22282b; --human-soft: #263640;
    --warn: #f0c36b; --warn-soft: #3d3118;
    --ok: #8fd0a5; --ok-soft: #1f3328;
    --danger: #f97066; --danger-ink: #22282b; --danger-soft: #3b1714;
    --bubble-in: #2a3134; --bubble-bot: #3a2b24; --bubble-human: #263640;
    --shadow: none; --shadow-float: 0 8px 24px rgba(0,0,0,.45); --shadow-bar: 0 -4px 14px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121517; --surface: #22282b; --surface-2: #2b3337; --surface-3: #3a4247; --selected: #3a4247;
  --border: #3f4a4f; --control: #7a8387; --text: #eee8dd; --muted: #b0aca4;
  --brand: #d49a7c; --brand-ink: #22282b; --brand-soft: #3a2b24;
  --human: #9fbccb; --human-ink: #22282b; --human-soft: #263640;
  --warn: #f0c36b; --warn-soft: #3d3118;
  --ok: #8fd0a5; --ok-soft: #1f3328;
  --danger: #f97066; --danger-ink: #22282b; --danger-soft: #3b1714;
  --bubble-in: #2a3134; --bubble-bot: #3a2b24; --bubble-human: #263640;
  --shadow: none; --shadow-float: 0 8px 24px rgba(0,0,0,.45); --shadow-bar: 0 -4px 14px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body { margin: 0; font: var(--fs-md)/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select { font-size: var(--fs-md); } /* 16 px: o iOS não amplia ao focar */
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Botões */
.btn { border: 1px solid var(--control); background: var(--surface); color: var(--text); border-radius: var(--r-md); padding: .6rem 1rem; min-height: 44px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.warn { background: var(--human); border-color: var(--human); color: var(--human-ink); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 36px; padding: .35rem .8rem; font-size: var(--fs-sm); }
.btn.icon { min-width: 36px; padding: .35rem; }
.btn.icon svg { width: 18px; height: 18px; }
.btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:disabled.primary { background: var(--surface-3); border-color: var(--surface-3); color: var(--muted); opacity: 1; }
.pill { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .1rem .6rem; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
.pill.ai { background: var(--brand-soft); color: var(--brand); }
.pill.human { background: var(--human-soft); color: var(--human); }
.pill.alert { background: var(--danger-soft); color: var(--danger); }
.pill.plain { background: var(--surface-2); color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 1.5rem; overflow: auto; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 2rem 1.5rem; box-shadow: var(--shadow); }
.login-card h1 { font-size: var(--fs-xl); margin: .8rem 0 .2rem; }
.login-card p { color: var(--muted); margin: 0 0 1.2rem; }
.login-card input[readonly] { opacity: .75; }
.field { display: block; margin-bottom: 1rem; }
.field > span, .field > label > span { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: .25rem; }
.field > label { display: block; }
.tabs.inlist { margin: 0 1rem .6rem; }
.field input { width: 100%; min-height: 46px; border: 1px solid var(--control); border-radius: var(--r-md); padding: .5rem .8rem; background: var(--surface); }
.error { background: var(--danger-soft); color: var(--danger); border-radius: var(--r-md); padding: .6rem .8rem; margin-bottom: 1rem; font-size: var(--fs-sm); }
.error.flush { margin: 0 0 .5rem; }
.logo { width: 44px; height: 44px; background: url("/painel/favicon.svg") center / contain no-repeat; }
.logo.small { width: 36px; height: 36px; }

/* Estrutura */
.shell { display: grid; grid-template-columns: 232px 1fr; height: 100vh; height: 100dvh; }
.side { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 1rem .75rem; gap: 1rem; min-height: 0; }
.brand { display: flex; align-items: center; gap: .65rem; padding: .25rem .5rem; min-width: 0; }
.brand > div { min-width: 0; }
.brand b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; line-height: 1.2; }
.brand small { display: block; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: .2rem; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .65rem .75rem; border-radius: var(--r-md); color: var(--text); text-decoration: none; font-weight: 600; position: relative; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.nav svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav .count { margin-left: auto; background: var(--brand); color: var(--brand-ink); border-radius: 999px; font-size: var(--fs-xs); min-width: 1.4rem; text-align: center; padding: 0 .4rem; }
.nav .count.todo { background: var(--surface-3); color: var(--text); }
.side-foot { margin-top: auto; font-size: var(--fs-sm); color: var(--muted); padding: .5rem; overflow-wrap: anywhere; }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.page { padding: 1.25rem; overflow: auto; flex: 1 1 0px; min-height: 0; }
.page h1 { font-size: var(--fs-xl); margin: 0 0 1rem; line-height: 1.25; }
.empty { color: var(--muted); text-align: center; padding: 3rem 1rem; }
.offline { background: var(--human-soft); color: var(--human); padding: .4rem 1rem; font-size: var(--fs-sm); text-align: center; }
.skel { display: grid; gap: var(--sp-2); padding: var(--sp-2) 0; }
.skel span { display: block; height: 3.5rem; border-radius: var(--r-md); background: var(--surface-2); }
.skel span:nth-child(2) { opacity: .7; }

/* Conversas */
.chat { display: grid; grid-template-columns: 340px 1fr; flex: 1 1 0px; min-height: 0; }
.clist { border-right: 1px solid var(--border); background: var(--surface); overflow: auto; min-height: 0; }
.clist h1 { font-size: var(--fs-xl); margin: 0; padding: 1rem 1rem .5rem; line-height: 1.25; }
.citem { display: flex; gap: .7rem; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: none; padding: .8rem 1rem; min-height: 68px; }
.citem:hover { background: var(--surface-2); }
.citem[aria-current="true"] { background: var(--brand-soft); }
/* Pesquisa e filtros da lista de conversas: uma linha, que se desloca na horizontal no telemóvel */
.csearch { margin: 0 1rem .6rem; }
.csearch input[type=search] { width: 100%; min-height: 44px; border: 1px solid var(--control); border-radius: var(--r-md); padding: .5rem .8rem; background: var(--field, var(--surface)); }
.csearch input[type=search]:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.tabs.inlist { display: flex; flex-wrap: nowrap; max-width: calc(100% - 2rem); overflow-x: auto; scrollbar-width: none; }
.tabs.inlist::-webkit-scrollbar { display: none; }
.tabs.inlist button { flex: none; white-space: nowrap; padding: .4rem .5rem; font-size: var(--fs-sm); }
.cprev mark { background: var(--brand-soft); color: inherit; border-radius: 3px; padding: 0 .1em; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; font-weight: 700; flex: none; }
.cbody { display: block; min-width: 0; flex: 1; }
.crow { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.crow b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.crow time { color: var(--muted); font-size: var(--fs-xs); flex: none; }
.cprev { display: block; color: var(--muted); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmeta { display: flex; gap: .35rem; margin-top: .25rem; flex-wrap: wrap; }
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.thead { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.thead .who { flex: 1; min-width: 0; }
.thead .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thead .who small { color: var(--muted); }
.back { display: none; }
.msgs { flex: 1; overflow: auto; padding: 1rem; display: flex; flex-direction: column; gap: .35rem; min-height: 0; }
.day { align-self: center; color: var(--muted); font-size: var(--fs-xs); background: var(--surface); border-radius: 999px; padding: .1rem .7rem; margin: .5rem 0; }
.bubble { max-width: min(78%, 560px); padding: .5rem .75rem .35rem; border-radius: 14px; background: var(--bubble-in); border: 1px solid transparent; box-shadow: var(--shadow); overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble.out { align-self: flex-end; border-bottom-right-radius: 4px; border-color: var(--border); }
.bubble.in { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.bot { background: var(--bubble-bot); }
.bubble.human { background: var(--bubble-human); }
.bubble .tag { display: block; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: .1rem; }
.bubble .foot { display: block; text-align: right; font-size: var(--fs-xs); color: var(--muted); margin-top: .15rem; white-space: normal; }
.bubble.failed { border: 1px solid var(--danger); }
.bubble .voice-note { display: block; font-size: var(--fs-xs); color: var(--muted); font-style: italic; margin-top: .15rem; }
.bubble.failed .foot { color: var(--danger); font-weight: 600; }
.bubble.cancelled .foot { color: var(--muted); }
.bubble.system { font-style: italic; color: var(--muted); }
.composer { background: var(--surface); border-top: 1px solid var(--border); padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom)); }
.composer form { display: flex; gap: .6rem; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 46px; max-height: 140px; border: 1px solid var(--control); border-radius: var(--r-lg); padding: .6rem .8rem; background: var(--field, var(--surface)); }
.notice { display: flex; gap: .8rem; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--surface-2); color: var(--text); border-radius: var(--r-md); padding: .55rem .8rem; font-size: var(--fs-sm); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.danger { background: var(--danger-soft); color: var(--danger); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.human { background: var(--human-soft); color: var(--human); }
.notice.plain { background: none; padding: 0; color: var(--muted); }
.notice span { flex: 1 1 14rem; }
.placeholder { flex: 1; display: grid; place-items: center; color: var(--muted); padding: 2rem; text-align: center; }

/* Separadores segmentados (uma só implementação para Conversas, Pedidos e Horário) */
.tabs, .seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 3px; gap: 2px; flex-wrap: wrap; }
.tabs { margin-bottom: 1rem; }
.tabs button, .seg button { border: 0; background: none; padding: .4rem .9rem; border-radius: var(--r-sm); font-weight: 600; min-height: 36px; color: var(--muted); }
.tabs button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--selected); color: var(--text); box-shadow: var(--shadow); outline: 1px solid var(--control); outline-offset: -1px; }
.tabs button:hover, .seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"].is-follow { color: var(--human); }
.seg button[aria-pressed="true"]:not(.is-follow) { color: var(--brand); }

/* Pedidos */
.cards { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .6rem; }
.card header { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.card header small { color: var(--muted); display: block; }
.card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; font-size: var(--fs-md); }
.card dt { color: var(--muted); }
.card dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.card .actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: auto; align-items: center; }
.orig { background: var(--surface-2); border-radius: var(--r-md); padding: .55rem .75rem; font-size: var(--fs-sm); }
.orig small { display: block; color: var(--muted); font-weight: 600; margin-bottom: .1rem; }
.orig div { white-space: pre-wrap; overflow-wrap: anywhere; }
.orig.spaced { margin-bottom: .8rem; }
.orig .gap { margin-top: .3rem; }

/* Definições */
.tiles { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.25rem; max-width: var(--measure); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.tile b { display: block; font-size: var(--fs-xl); line-height: 1.2; }
.tile span { color: var(--muted); font-size: var(--fs-sm); }
.panel-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); max-width: var(--measure); }
.panel-box h2 { font-size: var(--fs-lg); margin: 0 0 .3rem; }
.panel-box p { color: var(--muted); margin: 0 0 .8rem; }
.panel-box p b { color: var(--text); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.switch { position: relative; width: 56px; height: 32px; border-radius: 999px; border: 1px solid var(--control); background: var(--surface-3); flex: none; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--brand); border-color: var(--brand); }
.switch[aria-checked="true"]::after { transform: translateX(24px); background: var(--brand-ink); }
.switch:disabled { opacity: .55; cursor: not-allowed; }
.at-switch input[type=checkbox], .at-req-lbl input[type=checkbox], .at-row input[type=checkbox] { accent-color: var(--brand); }
.plannote { margin-bottom: 1rem; max-width: var(--measure); }
/* Transcrição de voz (fase 5): cartão de minutos do mês; barra com tokens (claro e escuro) */
.transcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; max-width: var(--measure); display: grid; gap: .6rem; }
.transcard h3 { margin: 0; font-size: var(--fs-md); }
.transc-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem .9rem; flex-wrap: wrap; }
.transc-val { color: var(--muted); font-size: var(--fs-sm); }
.transcard .hint { margin: 0; }
.meter { height: .6rem; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.meter-fill.full { background: var(--warn); }
.transcard .notice { margin: 0; }
@media (max-width: 480px) { .transcard { padding: .85rem; } }

.banner { background: var(--human-soft); color: var(--human); padding: .55rem 1rem; font-size: var(--fs-sm); font-weight: 600; border-bottom: 1px solid var(--border); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.danger { background: var(--danger-soft); color: var(--danger); }
.btn.block { width: 100%; }
.logo.small { width: 36px; height: 36px; }

/* A minha empresa */
.tabs2 { display: flex; gap: .4rem; flex-wrap: wrap; margin: -.4rem 0 1rem; }
.tabs2 a { padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--control); background: var(--surface); text-decoration: none; color: var(--text); font-weight: 600; font-size: var(--fs-sm); min-height: 36px; display: inline-flex; align-items: center; }
.tabs2 a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.finput { width: 100%; min-height: 46px; border: 1px solid var(--control); border-radius: var(--r-md); padding: .5rem .8rem; background: var(--field, var(--surface)); }
select.finput { appearance: auto; }
textarea.finput { resize: vertical; }
.finput[aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.field .hint, .hint { display: block; color: var(--muted); font-size: var(--fs-sm); margin-top: .25rem; }
.ferr { color: var(--danger); font-size: var(--fs-sm); font-weight: 600; margin-top: .25rem; }
.day-row { display: grid; grid-template-columns: 96px 1fr; gap: .5rem 1rem; padding: .7rem 0; border-top: 1px solid var(--border); align-items: start; }
.day-body { display: flex; flex-wrap: wrap; gap: .5rem .7rem; align-items: center; }
.ranges { display: flex; flex-direction: column; gap: .4rem; width: 100%; }
.range { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.range .btn { flex: none; }
.ranges > .btn { align-self: flex-start; }
.finput.time { flex: 1 1 0; width: auto; min-width: 0; max-width: 9rem; padding: .5rem .5rem; }
.svc { border: 1px solid var(--border); border-radius: var(--r-md); padding: .8rem .9rem; margin-bottom: .8rem; background: var(--surface-2); }
.svc .finput { background: var(--surface); }
.pricebox { display: flex; gap: .5rem; align-items: center; }
.pricebox select { flex: 1; min-width: 0; }
.eur { display: inline-flex; align-items: center; gap: .3rem; width: 8rem; flex: none; font-weight: 600; }
.eur .finput { min-width: 0; flex: 1; }
.savebar { position: sticky; bottom: 0; display: flex; gap: .6rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem 1rem; box-shadow: var(--shadow-bar); max-width: var(--measure); margin-bottom: .5rem; }
.savebar span { flex: 1; min-width: 12rem; color: var(--muted); font-size: var(--fs-sm); }
.savebar span.dirty { color: var(--warn); font-weight: 600; }
.at-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .45rem 0; }
.at-row input[type=text] { flex: 1 1 180px; min-width: 0; min-height: 42px; border: 1px solid var(--control); border-radius: var(--r-md); padding: .4rem .7rem; background: var(--field, var(--surface)); }
.at-row select { min-height: 42px; border: 1px solid var(--control); border-radius: var(--r-md); padding: .3rem .5rem; background: var(--field, var(--surface)); max-width: 100%; }
.at-row input[type=checkbox] { width: 20px; height: 20px; }
.at-req { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .8rem; margin: .6rem 0; }
.at-field { margin-left: 1rem; }
.at-switch { display: flex; gap: .5rem; align-items: center; font-weight: 600; margin-bottom: .3rem; }
.at-req-lbl { display: inline-flex; gap: .3rem; align-items: center; font-size: var(--fs-sm); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center; margin-top: .6rem; }
.chips.left { justify-content: flex-start; margin-top: .3rem; }
.chip { border: 1px solid var(--control); background: var(--surface); border-radius: 999px; padding: .4rem .85rem; font-size: var(--fs-sm); min-height: 36px; }
.chip:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.hint.center { text-align: center; margin-top: .8rem; }
.lead { color: var(--muted); margin: 0 0 1rem; }
.empty.tight { padding: 1rem; }
.hintline { margin-top: .35rem; }
.nomargin { margin: 0 !important; }

/* Primeiros passos */
.steps { list-style: none; padding: 0; margin: 0 0 1rem; max-width: var(--measure); display: grid; gap: .7rem; }
.step { display: flex; gap: .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.step .num { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-2); color: var(--text); border: 1px solid var(--control); }
.step .num svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.step.done .num { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.step.todo-now .num { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.step-body { min-width: 0; }
.step-body p { margin: .15rem 0 .6rem; color: var(--muted); }
.step-body .btn { text-decoration: none; }
.step-body b { display: block; }
.step-body .note { color: var(--muted); font-size: var(--fs-sm); margin: .3rem 0 0; }
.ok-banner { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--ok-soft); color: var(--ok); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; max-width: var(--measure); font-weight: 600; }
.wa-line { display: flex; gap: .7rem; align-items: center; margin-bottom: .5rem; flex-wrap: wrap; }
.actions-row { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
a.btn { color: var(--text); text-decoration: none; }
a.btn.primary { color: var(--brand-ink); }

/* Ligação WhatsApp: opções (número da app WhatsApp Business / número novo) e coexistência */
.wa-option { border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .7rem; }
.wa-option > b { display: block; margin-bottom: .2rem; }
.wa-option details { margin: .3rem 0 .7rem; }
.wa-option summary { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); min-height: 36px; display: flex; align-items: center; }
.coex { margin: .3rem 0 .5rem; }
.bubble.phone { border: 1px dashed var(--control); }
.push-block { padding: .6rem 0; border-top: 1px solid var(--border); }
.push-block:first-of-type { border-top: 0; }

/* Testar assistente (simulador) */
.sim { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; max-width: var(--measure); width: 100%; margin: 0 auto; padding: 1.25rem 1.25rem .9rem; }
.sim-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.sim-head h1 { margin: 0; font-size: var(--fs-xl); }
.sim-warn { margin-bottom: .5rem; }
.sim-msgs { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); flex: 1 1 0; }
.sim-empty { margin: auto; max-width: 460px; text-align: center; color: var(--muted); }
.sim-empty b { display: block; color: var(--text); font-size: var(--fs-lg); margin-bottom: .3rem; }
.sim-flag { align-self: flex-end; display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; max-width: min(78%, 560px); text-align: right; margin-bottom: .3rem; }
.sim-flag small { color: var(--muted); }
.sim-form { display: flex; gap: .6rem; align-items: flex-end; margin-top: .6rem; }
.sim-form textarea { flex: 1; resize: none; min-height: 46px; max-height: 120px; border: 1px solid var(--control); border-radius: var(--r-lg); padding: .6rem .8rem; background: var(--field, var(--surface)); }
.sim-note { margin: .4rem 0 0; }
.sim a { color: var(--brand); }
.sim-lead { align-self: flex-end; max-width: min(78%, 560px); background: var(--surface); border: 1px dashed var(--brand); border-radius: var(--radius); padding: .5rem .8rem; margin-bottom: .3rem; }
.sim-lead dl { margin: .3rem 0; display: grid; grid-template-columns: auto 1fr; gap: .1rem .7rem; }
.sim-lead dt { color: var(--muted); } .sim-lead dd { margin: 0; } .sim-lead small { color: var(--muted); }

/* Diálogo próprio (substitui confirm()) */
dialog.dlg { border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); color: var(--text); width: min(440px, calc(100vw - 2rem)); max-width: none; padding: 1.25rem; box-shadow: var(--shadow-float); }
dialog.dlg::backdrop { background: rgba(24,28,30,.45); }
dialog.dlg h2 { font-size: var(--fs-lg); margin: 0 0 .5rem; }
dialog.dlg p { margin: 0; color: var(--text); }
dialog.dlg .actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1.1rem; }

/* Avisos breves (toast): canto inferior direito, fecham-se; erros anunciam-se como alerta */
.toasts { position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 20; display: grid; gap: .5rem; width: min(420px, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: .6rem; align-items: flex-start; justify-content: space-between; margin: 0; box-shadow: var(--shadow-float); border: 1px solid var(--border); }
.toast span { flex: 1; min-width: 0; }
.toast button { flex: none; min-width: 36px; min-height: 36px; border: 0; background: none; color: inherit; border-radius: var(--r-sm); font-size: var(--fs-lg); line-height: 1; }
.toast button:hover { background: rgba(127,127,127,.18); }
.toast.ok { background: var(--ok-soft); color: var(--ok); }

/* Atendimento (menu e pedidos) */
.at-row input[type=text]:focus, .finput:focus, .field input:focus, .composer textarea:focus, .sim-form textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }

/* Início: contadores e estados */
.step-note { color: var(--muted); }

/* Telemóvel */
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .side { order: 2; flex-direction: row; border-right: 0; border-top: 1px solid var(--border); padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); gap: 0; }
  .brand, .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; gap: 0; }
  .nav a { flex: 1 1 0; min-width: 0; flex-direction: column; gap: .1rem; font-size: var(--fs-xs); line-height: 1.15; padding: .35rem .15rem; min-height: 52px; justify-content: center; text-align: center; }
  .nav svg { width: 22px; height: 22px; }
  .nav .count { position: absolute; top: 0; left: 55%; margin: 0; min-width: 1.2rem; }
  .chat { grid-template-columns: 1fr; }
  .chat .thread { display: none; }
  .chat.open .clist { display: none; }
  .chat.open .thread { display: flex; }
  .back { display: inline-flex; min-width: 44px; min-height: 44px; padding: 0; }
  .thead { padding: .5rem .6rem; gap: .5rem; }
  .thead .who b { font-size: var(--fs-md); }
  .banner { font-size: var(--fs-sm); line-height: 1.35; padding: .4rem .7rem; }
  .bubble { max-width: 88%; }
  .page { padding: 1rem; }
  .cards { grid-template-columns: 1fr; }
  .btn.small, .tabs button, .seg button, .chip, .tabs2 a { min-height: 44px; }
  .tabs button, .seg button { padding: .4rem .7rem; }
  .tabs2 a { min-height: 44px; }
  .sim { padding: .9rem .8rem .6rem; }
  .sim-head h1 { font-size: var(--fs-lg); }
  .fgrid { grid-template-columns: 1fr; }
  .day-row { grid-template-columns: 1fr; }
  .pricebox { flex-wrap: nowrap; }
  .eur { width: 7rem; }
  .toasts { left: .8rem; right: .8rem; width: auto; bottom: calc(5.4rem + env(safe-area-inset-bottom)); }
  .composer { padding: .6rem .7rem calc(.6rem + env(safe-area-inset-bottom)); }
  .composer form, .sim-form { gap: .5rem; }
  .composer textarea, .sim-form textarea { min-height: 44px; }
}
@media (max-width: 560px) { /* telemóvel: mensagem numa linha e os dois botões lado a lado (a barra fixa ocupava um quarto do ecrã) */
  .savebar { padding: .55rem .7rem; gap: .4rem; }
  .savebar span { flex: 1 1 100%; min-width: 0; font-size: var(--fs-sm); }
  .savebar .btn { flex: 1 1 0; }
  .savebar .btn.primary { flex: 2 1 0; }
  .range { gap: .35rem; }
  .range .btn.small { padding-inline: .6rem; }
  .finput.time { padding-inline: .35rem; }
  .login-card { padding: 1.5rem 1.1rem; }
}

html, body { overflow: hidden; }
.login { overflow: auto; }
#view { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; }
.toasts { position: fixed; }

/* Estado vazio de página: alinhado com o conteúdo, uma frase de contexto */
.empty-state { max-width: var(--measure); padding: var(--sp-6, 1.5rem) 0; color: var(--muted); }
.empty-state b { display: block; color: var(--text); font-size: var(--fs-md); margin-bottom: .25rem; }
.empty-state p { margin: 0; max-width: 60ch; }
/* Avisos de página com a mesma largura do conteúdo e espaço antes do que se segue */
.page > .notice, .page > .lead { max-width: var(--measure); margin-bottom: 1rem; }
/* Primeiros passos: uma só lista com separadores (em vez de um cartão por passo) */
.steps { gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.steps .step { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 1rem 1.1rem; }
.steps .step + .step { border-top: 1px solid var(--border); }
.steps .step-body p:last-child { margin-bottom: 0; }
/* Separadores de página (A minha empresa): sublinhado, distintos dos filtros segmentados */
.tabs2 { gap: 1.5rem; margin: 0 0 1.25rem; border-bottom: 1px solid var(--border); max-width: var(--measure); }
.tabs2 a { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: .5rem 0; margin-bottom: -1px; color: var(--muted); font-size: var(--fs-md); }
.tabs2 a:hover { color: var(--text); }
.tabs2 a[aria-current="page"] { background: none; color: var(--text); border-bottom-color: var(--brand); }
/* Remover linhas (opções, perguntas, serviços): discreto em repouso, vermelho só ao passar/focar. O vermelho cheio fica para a confirmação. */
.btn.small.danger { color: var(--muted); border-color: var(--control); }
.btn.small.danger:hover:not(:disabled), .btn.small.danger:focus-visible { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.dlg .btn.danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink, #fff); }

/* Navegação: rótulo curto só na barra inferior do telemóvel */
.nav .lbl-s { display: none; }
@media (max-width: 860px) {
  .nav a { justify-content: flex-start; padding-top: .45rem; }
  .nav .lbl.has-short { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav .lbl-s { display: block; }
  .nav .lbl, .nav .lbl-s { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Cabeçalho da conversa: nome em cima; número e estado por baixo; uma só ação à direita (não se sobrepõe em ecrãs pequenos) */
.thead { flex-wrap: nowrap; }
.thead .who-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .1rem; }
.thead .who-meta .pill { font-size: var(--fs-xs); }
.thead > .btn { flex: none; white-space: nowrap; }
@media (max-width: 860px) {
  .nav a { padding-left: 0; padding-right: 0; }
  .nav .lbl, .nav .lbl-s { letter-spacing: -.01em; }
}
/* Avisos dentro das páginas: mesma largura de leitura que o conteúdo e espaço antes do bloco seguinte */
.page .notice:not(.plain) { max-width: var(--measure); }
#abody > .notice, #cform > .notice { margin-bottom: 1rem; }
/* Telemóvel: sem alterações, a barra de gravação fica no fim do formulário (não ocupa o ecrã); com alterações fica fixa em baixo */
@media (max-width: 860px) { .savebar.clean { position: static; box-shadow: none; } }

/* Passo ligado só em modo de teste: âmbar, não concluído */
.step.testing .num { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.step-body b .pill { vertical-align: middle; margin-left: .35rem; font-size: var(--fs-xs); }

/* Respostas rápidas: lista no composer (insere texto, nunca envia) e gestão em «A minha empresa» */
.composer { position: relative; }
.qr-bar { display: flex; justify-content: flex-end; margin: -.2rem 0 .4rem; }
.qr-pop { position: absolute; left: 1rem; right: 1rem; bottom: 100%; margin-bottom: .3rem; max-height: min(320px, 50vh); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-float); z-index: 20; }
.qr-opt { display: flex; flex-direction: column; gap: .15rem; padding: .6rem .8rem; min-height: 44px; cursor: pointer; border-bottom: 1px solid var(--border); }
.qr-opt:last-child { border-bottom: 0; }
.qr-opt b { font-size: var(--fs-sm); }
.qr-opt span { color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.qr-opt:hover, .qr-opt[aria-selected="true"] { background: var(--brand-soft); }
.qr-empty { margin: 0; padding: .7rem .8rem; color: var(--muted); font-size: var(--fs-sm); }
.qr-empty a { color: var(--brand); font-weight: 600; }
.qr-item { border-top: 1px solid var(--border); padding: .8rem 0 .4rem; }
.qr-item textarea { width: 100%; min-height: 80px; border: 1px solid var(--control); border-radius: var(--r-md); padding: .5rem .7rem; font: inherit; font-size: var(--fs-md); background: var(--field, var(--surface)); color: var(--text); resize: vertical; }
.qr-empty-box { margin-bottom: .6rem; }
.qr-empty-box p { color: var(--muted); }
.field-err { color: var(--danger); font-size: var(--fs-sm); font-weight: 600; margin: .3rem 0; }

/* Notas internas: painel lateral no desktop, folha a ecrã inteiro no telemóvel */
.tmain { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.notes { display: flex; flex-direction: column; gap: .6rem; background: var(--surface); padding: .9rem 1rem 1rem; min-height: 0; overflow: auto; }
.notes-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.notes-head h2 { font-size: var(--fs-lg); margin: 0; }
.notes-head h2:focus { outline: none; }
.notes-who { margin: 0; color: var(--muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.notes-warn { font-size: var(--fs-sm); }
.notes-list { display: flex; flex-direction: column; gap: .5rem; }
.note { border: 1px solid var(--border); border-radius: var(--r-md); padding: .55rem .7rem; background: var(--bg); }
.note-body { margin: 0 0 .3rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.note-foot small { color: var(--muted); }
.note-form { display: flex; flex-direction: column; gap: .4rem; border-top: 1px solid var(--border); padding-top: .8rem; }
.note-form label { font-weight: 600; font-size: var(--fs-sm); }
.note-form textarea { width: 100%; min-height: 80px; border: 1px solid var(--control); border-radius: var(--r-md); padding: .5rem .7rem; font: inherit; font-size: var(--fs-md); background: var(--field, var(--surface)); color: var(--text); resize: vertical; }
.note-form .btn { align-self: flex-end; }
.note-form .error { margin: 0; }
.count-in { display: inline-block; min-width: 1.3rem; padding: 0 .35rem; margin-left: .25rem; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: var(--fs-xs); font-weight: 700; line-height: 1.3rem; text-align: center; }
@media (min-width: 861px) {
  .thread.notes-open { flex-direction: row; }
  .thread.notes-open .notes { flex: 0 0 300px; width: 300px; border-left: 1px solid var(--border); }
}
@media (max-width: 860px) {
  .thread.notes-open .notes { position: fixed; inset: 0; z-index: 60; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
  .notes-head .btn, .note-form textarea { min-height: 44px; }
  .note-form textarea { font-size: 1rem; }
  .notes-head .btn { min-width: 44px; }
}
/* Com o painel de notas aberto no desktop, o cabeçalho quebra linha em vez de sobrepor o número ao botão */
@media (min-width: 861px) {
  .thread.notes-open .thead { flex-wrap: wrap; }
  .thread.notes-open .thead .who { flex: 1 1 12rem; }
}
/* Telemóvel: o botão de notas fica só com ícone e contador (o nome acessível continua no aria-label) */
@media (max-width: 560px) { .notes-lbl { display: none; } }

/* Separadores de «A minha empresa» numa só linha (desliza na horizontal em ecrãs pequenos) */
.tabs2 { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.tabs2::-webkit-scrollbar { display: none; }
.tabs2 a { white-space: nowrap; flex: none; }
/* Respostas rápidas no telemóvel: título em largura total; subir/descer/remover numa linha por baixo */
@media (max-width: 560px) {
  .qr-item .at-row { display: grid; grid-template-columns: auto auto 1fr; gap: .5rem; }
  .qr-item .at-row > input { grid-column: 1 / -1; }
  .qr-item .at-row > .danger { justify-self: end; }
}

/* @agenda-início — Agenda de marcações (opcional). Só tokens: funciona em claro e escuro sem cores próprias. */
.ag { display: flex; flex: 1 1 0; min-height: 0; min-width: 0; }
.ag-main { flex: 1 1 0; min-width: 0; }
.ag-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.ag-top .btn { flex: none; }
.ag-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-bottom: .9rem; }
.ag-nav { display: flex; gap: .35rem; align-items: center; }
.ag-title { font-size: var(--fs-lg); margin: 0; flex: 1 1 14rem; min-width: 0; }
.ag-bar .seg { flex-wrap: nowrap; }
.ag-check { display: inline-flex; gap: .45rem; align-items: center; font-size: var(--fs-sm); color: var(--muted); min-height: 36px; }
.ag-check input, .ag-holsw input, .ag-cform .at-switch input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.ag-none-note { margin-bottom: .8rem; max-width: var(--measure); }
.pill.ag-x { text-decoration: line-through; }
/* grelha horária (desktop): dias em colunas, marcações posicionadas pela hora; horas fechadas sombreadas */
.ag-grid { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.ag-ghead, .ag-gbody { display: grid; grid-template-columns: 3.5rem repeat(var(--n, 7), minmax(0, 1fr)); }
.ag-ghead { position: sticky; top: -1.25rem; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--border); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.ag-dhead { border: 0; border-left: 1px solid var(--border); background: none; padding: .35rem .25rem; min-height: 52px; min-width: 0; display: flex; flex-direction: column; align-items: center; color: var(--muted); font-size: var(--fs-sm); }
.ag-dhead b { font-size: var(--fs-lg); color: var(--text); line-height: 1.3; min-width: 1.9rem; text-align: center; }
.ag-dhead small { font-size: var(--fs-xs); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-dhead.today b { background: var(--brand); color: var(--brand-ink); border-radius: 999px; padding: 0 .35rem; }
button.ag-dhead:hover { background: var(--surface-2); }
.ag-gutter { position: relative; }
.ag-hour { position: absolute; right: .45rem; margin-top: .1rem; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.ag-col { position: relative; border-left: 1px solid var(--border); background: var(--surface-2); min-width: 0; }
.ag-open { position: absolute; left: 0; right: 0; background: var(--surface); }
.ag-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); pointer-events: none; }
.ag-closure { position: absolute; left: 0; right: 0; background: var(--surface-3); color: var(--muted); font-size: var(--fs-xs); padding: .2rem .35rem; overflow: hidden; }
.ag-closure span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--brand); z-index: 3; pointer-events: none; }
.ag-b { position: absolute; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; text-align: left; overflow: hidden; border-radius: var(--r-sm); border: 1px solid var(--control); border-left-width: 4px; padding: .1rem .35rem; font-size: var(--fs-xs); line-height: 1.3; background: var(--surface); color: var(--text); min-width: 0; }
.ag-b span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-b-l1 { font-weight: 600; }
.ag-b-l3 { color: var(--muted); }
.ag-b.s-pending { background: var(--warn-soft); border-color: var(--warn); border-style: dashed; border-left-style: solid; }
.ag-b.s-pending .ag-b-l1 { color: var(--warn); }
.ag-b.s-confirmed { background: var(--ok-soft); border-color: var(--ok); }
.ag-b.s-confirmed .ag-b-l1 { color: var(--ok); }
.ag-b.s-completed { background: var(--surface-2); border-color: var(--control); color: var(--muted); }
.ag-b.s-cancelled { background: var(--surface); border-color: var(--border); color: var(--muted); }
.ag-b.s-cancelled .ag-b-l2, .ag-b.s-cancelled .ag-b-l3 { text-decoration: line-through; }
.ag-b:hover { box-shadow: var(--shadow-float); z-index: 2; }
.ag-b { container-type: inline-size; }
.ag-b .st-short { display: none; }
@container (max-width: 120px) { .ag-b .st-long { display: none; } .ag-b .st-short { display: inline; } }
.ag-b.short, .ag-b.tiny { padding-top: 0; padding-bottom: 0; line-height: 1.2; }
.ag-b.short .ag-b-l3, .ag-b.tiny .ag-b-l2, .ag-b.tiny .ag-b-l3 { display: none; }
.ag-b[aria-current="true"] { outline: 2px solid var(--brand); outline-offset: 1px; z-index: 2; }
/* lista por dia (telemóvel) */
.ag-list { display: grid; gap: .8rem; }
.ag-lday { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.ag-lhead { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; width: 100%; border: 0; background: var(--surface-2); color: var(--text); text-align: left; padding: .55rem .8rem; min-height: 44px; font-size: var(--fs-md); }
.ag-lday.today .ag-lhead b { color: var(--brand); }
.ag-row { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: .1rem .7rem; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--border); background: none; color: var(--text); padding: .65rem .8rem; min-height: 56px; }
.ag-row:hover, .ag-row[aria-current="true"] { background: var(--brand-soft); }
.ag-row-t b, .ag-row-m b { display: block; }
.ag-row-t small, .ag-row-m small { display: block; color: var(--muted); font-size: var(--fs-sm); }
.ag-row-t { font-variant-numeric: tabular-nums; }
.ag-row-m { min-width: 0; }
.ag-row-m b, .ag-row-m small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-row-m .pill { margin-top: .25rem; white-space: normal; }
.ag-row.s-cancelled .ag-row-m b, .ag-row.s-cancelled .ag-row-t b { text-decoration: line-through; color: var(--muted); }
.ag-none { margin: 0; padding: .6rem .8rem; color: var(--muted); font-size: var(--fs-sm); border-top: 1px solid var(--border); }
/* mês */
.ag-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.ag-mwd { padding: .4rem; text-align: center; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.ag-mday { min-height: 92px; min-width: 0; border: 0; border-top: 1px solid var(--border); border-left: 1px solid var(--border); background: var(--surface); color: var(--text); display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; padding: .35rem .45rem; text-align: left; }
.ag-mday:nth-child(7n+1) { border-left: 0; }
.ag-mday.closed { background: var(--surface-2); }
.ag-mday.out { color: var(--muted); }
.ag-mday.out .ag-mnum { font-weight: 400; }
.ag-mday:hover { background: var(--brand-soft); }
.ag-mnum { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 1.6rem; text-align: center; border-radius: 999px; }
.ag-mday.today .ag-mnum { background: var(--brand); color: var(--brand-ink); }
.ag-mcount, .ag-mpend { font-size: var(--fs-xs); border-radius: 999px; padding: 0 .45rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-mcount { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.ag-mpend { background: var(--warn-soft); color: var(--warn); font-weight: 700; border: 1px dashed var(--warn); }
.ag-legend { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin: .6rem 0 0; font-size: var(--fs-sm); color: var(--muted); }
.ag-legend .ag-mpend { margin-left: .6rem; }
.ag-mhol { font-size: var(--fs-xs); color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* folha da marcação: painel lateral no desktop, ecrã inteiro no telemóvel */
.ag-sheet { display: flex; flex-direction: column; gap: .8rem; background: var(--surface); padding: 1rem 1.1rem 1.25rem; overflow: auto; min-height: 0; }
.ag-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.ag-sheet-head h2 { font-size: var(--fs-lg); margin: 0; }
.ag-sheet-head h2:focus { outline: none; }
.ag-sh-info { display: flex; flex-direction: column; gap: .7rem; }
.ag-sh-status { display: flex; gap: .4rem; flex-wrap: wrap; }
.ag-dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .3rem .9rem; margin: 0; }
.ag-dl dt { color: var(--muted); font-size: var(--fs-sm); padding-top: .1rem; }
.ag-dl dd { margin: 0; overflow-wrap: anywhere; }
.ag-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.ag-sec { border-top: 1px solid var(--border); padding-top: .8rem; display: flex; flex-direction: column; gap: .6rem; }
.ag-sec h3, .ag-h3 { font-size: var(--fs-md); margin: 0; }
.ag-h3 { margin: 1rem 0 .5rem; }
.ag-sheet .field, .ag-form .field { margin-bottom: 0; }
.ag-form { display: flex; flex-direction: column; gap: .8rem; }
.ag-lbl { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: .25rem; }
.ag-slots { display: flex; flex-wrap: wrap; gap: .4rem; }
.ag-slots .chip { min-width: 4.2rem; font-variant-numeric: tabular-nums; }
.ag-slots .chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.ag-sheet textarea.finput, .ag-form textarea.finput { min-height: 70px; }
@media (min-width: 861px) {
  .ag.sheet-open .ag-sheet { flex: 0 0 360px; width: 360px; border-left: 1px solid var(--border); }
}
/* definições da agenda */
.ag-svc { display: grid; grid-template-columns: minmax(0, 2fr) 7.5rem 7.5rem minmax(0, 1.3fr) auto; gap: .5rem .7rem; align-items: start; padding: .7rem 0; border-top: 1px solid var(--border); }
.ag-svc .field { margin: 0; min-width: 0; }
.ag-svc > .btn { margin-top: 1.85rem; }
.ag-fs { border: 0; margin: 0 0 .5rem; padding: 0; min-width: 0; }
.ag-fs legend { font-weight: 600; font-size: var(--fs-sm); margin-bottom: .4rem; padding: 0; }
.ag-radio { display: flex; gap: .65rem; align-items: flex-start; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: .5rem; cursor: pointer; }
.ag-radio input { margin: .2rem 0 0; width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.ag-radio b { display: block; }
.ag-radio small { display: block; color: var(--muted); font-size: var(--fs-sm); }
.ag-radio:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.ag-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.ag-hours { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; margin: .3rem 0 0; font-size: var(--fs-sm); }
.ag-hours dt { color: var(--muted); }
.ag-hours dd { margin: 0; }
.ag-holsw { margin-top: .4rem; }
.ag-clist { list-style: none; padding: 0; margin: .3rem 0 0; }
.ag-clist li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .55rem 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.ag-clist li > span { min-width: 0; }
.ag-clist small { display: block; color: var(--muted); }
.ag-cform .at-switch { margin: 0 0 .8rem; min-height: 36px; }
#ag-set > .notice { margin-bottom: 1rem; }
#ag-err ul { margin: .3rem 0 0; padding-left: 1.2rem; }
/* Testar assistente: escolha entre simulador e demonstração no WhatsApp */
.sim-mode { align-self: flex-start; margin-bottom: .6rem; }
.demo-links:empty { display: none; }
@media (max-width: 860px) {
  .ag-sheet { position: fixed; inset: 0; z-index: 60; padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); }
  .ag-sheet-head .btn { min-width: 44px; min-height: 44px; }
  .ag-bar { gap: .5rem; }
  .ag-title { flex: 1 1 100%; order: -1; }
  .ag-nav .btn.icon { min-width: 44px; }
  .ag-check { min-height: 44px; }
  .ag-mday { min-height: 64px; padding: .3rem .2rem; align-items: center; }
  .ag-mcount, .ag-mpend { padding: 0 .3rem; }
  .ag-rules { grid-template-columns: 1fr; }
  .ag-svc { grid-template-columns: 1fr 1fr; }
  .ag-svc .f-name, .ag-svc .f-price { grid-column: 1 / -1; }
  .ag-svc > .btn { grid-column: 1 / -1; justify-self: end; margin-top: 0; }
  .ag-slots .chip { min-height: 44px; }
  .sim-mode button { min-height: 44px; }
}
@media (max-width: 560px) {
  .ag-top h1 { font-size: var(--fs-xl); }
  .ag-bar .seg { flex: 1 1 100%; }
  .ag-bar .seg button { flex: 1 1 0; }
}
.ag-warn { margin-bottom: .9rem; max-width: var(--measure); }
#ag-set .panel-box > .notice { margin: .3rem 0 .6rem; }
/* telemóvel: «Nova marcação» ao alcance do polegar, por cima da barra de navegação */
@media (max-width: 860px) {
  .ag-top #ag-new { position: fixed; right: 1rem; bottom: calc(4.75rem + env(safe-area-inset-bottom)); z-index: 10; box-shadow: var(--shadow-float); }
  .ag-main:has(#ag-new) { padding-bottom: 5rem; }
}
/* @agenda-fim */

/* Fase 5 (revisão de produto): alvos de toque, rodapé com a barra de gravação, fuso horário */
.switch::before { content: ""; position: absolute; inset: -6px -8px; border-radius: 999px; } /* área de toque de 44 px em altura sem mudar o desenho */
@media (max-width: 860px) {
  .btn.small.icon { min-width: 44px; min-height: 44px; }
}
.page:has(.savebar) { padding-bottom: 7rem; } /* a barra «Guardar» fixa não tapa o último botão */
@media (max-width: 860px) { .page:has(.savebar) { padding-bottom: 8rem; } }
.tz-more { margin-top: .5rem; }
.tz-more summary { cursor: pointer; color: var(--brand); font-weight: 600; min-height: 44px; display: flex; align-items: center; font-size: var(--fs-sm); }
.tz-more label { margin-top: .4rem; }
/* Separadores de «A minha empresa» no telemóvel: deslocam-se na horizontal e o fim esbate-se (sinal visível de que há mais) */
@media (max-width: 560px) {
  .tabs2 { padding-right: 2.5rem; scroll-padding-right: 2.5rem; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent); }
}

/* Configuração guiada (#/configurar): secções que se expandem uma de cada vez; mobile-first, alvos de toque de 44 px+ */
.setup-page { max-width: var(--measure); }
.setup-prog { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 .9rem; }
.setup-prog li { font-size: var(--fs-xs); color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: .15rem .6rem; background: var(--surface); }
.setup-prog li.done { color: var(--ok); border-color: var(--ok); }
.setup-prog li.now { color: var(--text); border-color: var(--brand); font-weight: 700; }
.setup-missing { background: var(--warn-soft); color: var(--text); border-radius: var(--r-md); padding: .7rem .9rem; margin-bottom: .9rem; }
.setup-missing ul, .setup-todo { margin: .35rem 0 0; padding-left: 1.2rem; }
.setup-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: .7rem; }
.setup-sec > h2 { margin: 0; font-size: 1rem; }
.setup-toggle { width: 100%; min-height: 56px; display: flex; align-items: center; gap: .8rem; text-align: left; background: none; border: 0; border-radius: var(--radius); padding: .8rem 1rem; color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.setup-toggle:hover { background: var(--surface-2); }
.setup-toggle:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
.setup-toggle .sum { display: block; font-weight: 400; font-size: var(--fs-sm); color: var(--muted); margin-top: .1rem; }
.setup-num { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); }
.setup-num.done { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.setup-num svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Seta de expandir/recolher: roda quando a secção está aberta (aria-expanded="true") */
.setup-chev { margin-left: auto; flex: none; display: inline-flex; color: var(--muted); transition: transform .15s ease; }
.setup-chev svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.setup-toggle[aria-expanded="true"] .setup-chev { transform: rotate(180deg); }
.setup-apply { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; margin-top: .6rem; }
.setup-apply .hint { margin: 0; }
.setup-apply button:disabled { opacity: .55; cursor: not-allowed; }
.wa-form { display: grid; gap: .6rem; margin-top: .6rem; }
.wa-inuse { border: 0; padding: 0; margin: 0; }
.wa-inuse legend { font-weight: 600; padding: 0; margin-bottom: .3rem; }
.wa-inuse .check { margin-right: 1rem; }
.eur-box { display: inline-flex; flex-direction: column; gap: .2rem; flex: none; }
.eur-lbl { font-size: var(--fs-sm); color: var(--muted); font-weight: 400; }
.setup-body { padding: .2rem 1rem 1rem; }
.setup-body > p { color: var(--muted); margin: .2rem 0 .8rem; }
.setup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .9rem; }
.setup-actions .hint { margin: 0; flex-basis: 100%; }
.setup-rev { border: 1px dashed var(--control); border-radius: var(--r-md); padding: .8rem; margin: .8rem 0; }
.setup-rev h3 { margin: 0 0 .3rem; font-size: 1rem; }
.setup-rev-row { border-bottom: 1px solid var(--border); padding: .6rem 0; display: grid; gap: .2rem; }
.setup-rev-row:last-of-type { border-bottom: 0; }
.setup-rev-row label { display: flex; gap: .5rem; align-items: flex-start; }
.setup-rev-row input[type=checkbox] { width: 22px; height: 22px; flex: none; margin-top: .1rem; }
.setup-src { color: var(--muted); overflow-wrap: anywhere; }
.setup-src q { display: block; margin-top: .2rem; font-style: italic; }
.setup-conf { border: 1px solid var(--warn); border-radius: var(--r-md); padding: .6rem .8rem; margin: .6rem 0; }
.setup-conf legend { font-weight: 700; padding: 0 .3rem; }
.setup-conf label { display: flex; gap: .5rem; align-items: flex-start; min-height: 44px; }
.setup-conf input[type=radio] { width: 20px; height: 20px; margin-top: .15rem; flex: none; }
.setup-pick { display: flex; gap: .5rem; align-items: center; min-height: 44px; }
.setup-pick input { width: 22px; height: 22px; flex: none; }
.setup-bot { background: var(--surface-2); border-radius: var(--r-md); padding: .8rem; margin-bottom: .8rem; }
.setup-bot p { color: var(--text); }
.setup-resume { border-color: var(--brand); }
.setup-resume p { color: var(--muted); margin: .2rem 0 .7rem; }
.setup-page .btn { min-height: 44px; }
.setup-page .btn.small { min-height: 44px; }

/* Configuração guiada (segunda ronda de testes): sugestões com frase de ação, botão «Aplicar» que explica o que falta, resumo de erros */
.setup-pick { flex-wrap: wrap; }
.setup-pick .setup-same { flex-basis: 100%; margin: 0 0 0 2.2rem; }
.setup-apply [aria-disabled="true"] { opacity: .6; cursor: not-allowed; }
.setup-ok { color: var(--ok); font-weight: 600; margin: .5rem 0 0; }
.setup-ok:empty { display: none; }
.sim.sim-embedded { flex: none; max-width: none; padding: 0; }
.sim.sim-embedded .sim-msgs { flex: none; height: clamp(260px, 55vh, 480px); min-height: 260px; }
.sim.sim-embedded .sim-form { margin-top: .6rem; }
.field-errors { margin: 0 0 .8rem; padding-left: 1.2rem; }
.field-errors li { margin: .2rem 0; }
.field-errors button { background: none; border: 0; padding: 0; color: var(--danger); font: inherit; font-weight: 600; text-align: left; text-decoration: underline; cursor: pointer; min-height: 44px; }
.page:has(.savebar) { scroll-padding-bottom: 8rem; }
@media (max-width: 860px) { .page:has(.savebar) { scroll-padding-bottom: 9rem; } }
.setup-conf:focus-within { box-shadow: 0 0 0 3px var(--warn-soft); }

/* Quando responde o assistente (Definições): estado agora, modos e ativação temporária */
.bm-now { display: flex; gap: .55rem; align-items: flex-start; margin: .75rem 0 .9rem; font-weight: 600; }
.bm-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; margin-top: .4rem; }
.bm-now.on .bm-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.bm-fs legend { margin-bottom: .55rem; }
.ag-radio.is-disabled { opacity: .6; cursor: not-allowed; }
.bm-days { margin: .25rem 0 .75rem; }
.bm-days .day-row { padding: .5rem 0; }
.bm-h3 { font-size: var(--fs-md, 1rem); margin: 1rem 0 .2rem; }
.bm-pick { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; }
.bm-pick .finput { max-width: 15rem; }
.bm-temp-on { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; }
@media (max-width: 600px) { .bm-pick .finput { max-width: none; flex: 1 1 100%; } .bm-pick .btn { flex: 1 1 100%; } }

/* Revisão do painel: no telemóvel, quatro destinos na barra inferior e o resto em «Mais» */
.nav-more { display: none; }
.chat, .thead, .clist, .thread { min-width: 0; }
@media (max-width: 860px) {
  .nav a.in-more { display: none; }
  .nav-more { display: flex; flex: 1 1 0; min-width: 0; flex-direction: column; align-items: center; justify-content: flex-start; gap: .1rem; padding: .45rem 0 .35rem; min-height: 52px;
    border: 0; background: none; color: var(--text); font: inherit; font-size: var(--fs-xs); font-weight: 600; line-height: 1.15; border-radius: var(--r-md); cursor: pointer; }
  .nav-more[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
}
.more-sheet { position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: none; border: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; padding: .5rem .75rem calc(.75rem + env(safe-area-inset-bottom));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-float); }
.more-sheet::backdrop { background: rgb(0 0 0 / .35); }
.more-sheet nav { display: flex; flex-direction: column; margin-bottom: .5rem; }
.more-sheet a { display: flex; align-items: center; gap: .8rem; min-height: 52px; padding: 0 .75rem; border-radius: var(--r-md); color: var(--text); text-decoration: none; font-weight: 600; font-size: var(--fs-md); }
.more-sheet a + a { border-top: 1px solid var(--border); }
.more-sheet a[aria-current="page"] { color: var(--brand); }
.more-sheet svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.more-sheet .count { margin-left: auto; background: var(--brand); color: var(--brand-ink); border-radius: 999px; font-size: var(--fs-xs); min-width: 1.4rem; text-align: center; padding: 0 .4rem; }
.more-sheet .count.todo { background: var(--surface-3); color: var(--text); }
@media (min-width: 861px) { .more-sheet { display: none; } }

/* Revisão do painel: uma só caixa por secção, alvos de toque de 44 px, texto ≥ 13 px */
small { font-size: .8125rem; }
.svc { border: 0; border-top: 1px solid var(--border); border-radius: 0; background: none; padding: 1rem 0 .25rem; margin: 0; }
.svc:first-of-type { border-top: 0; padding-top: .25rem; }
.setup-rev { border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: .8rem 0; }
.setup-body .setup-bot { background: none; padding: 0; }
.sim-lead { border-style: solid; }
.ag-radio { border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: .75rem 0; margin: 0; }
.ag-radio:first-of-type { border-top: 0; }
.ag-radio:has(input:checked) { background: none; border-color: var(--border); }
.ag-radio:has(input:checked) b { color: var(--text); }
/* caixas de seleção e opções: o rótulo inteiro é o alvo (44 px) e a caixa tem 22 px */
:where(label):has(> input[type=checkbox], > input[type=radio]) { display: flex; align-items: center; gap: .6rem; min-height: 44px; cursor: pointer; }
:where(.ag-radio, .setup-rev-row label):has(> input) { align-items: flex-start; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; flex: none; margin: 0; accent-color: var(--brand); }
.at-row input[type=text], .at-row select, .at-row .finput { min-height: 44px; }
.toast button { min-width: 44px; min-height: 44px; }
.hint.center a { display: inline-flex; align-items: center; min-height: 44px; }
/* interruptor ligado em verde (estado «ligado»); a terracota fica para a ação principal */
.switch[aria-checked="true"] { background: var(--ok); border-color: var(--ok); }
.switch[aria-checked="true"]::after { background: var(--surface); }
@media (max-width: 560px) {
  .panel-box, .transcard, .setup-sec { background: none; border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 1.25rem 0 0; margin-bottom: 1.5rem; box-shadow: none; }
  .setup-sec { padding-top: .5rem; margin-bottom: .5rem; }
}
/* Serviços: valor em euros com o símbolo ao lado; marcações num bloco próprio, sem caixa */
.svc .eur { width: 100%; max-width: 12rem; }
.svc-book { margin: .25rem 0 .5rem; }
.svc-book .fgrid { margin-top: .25rem; }
.svc > .btn.small.danger { margin: .25rem 0 .75rem; }
/* Fuso horário numa linha, com «Alterar» */
.tz-line { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .5rem; margin: .25rem 0 0; }
.tz-line span { color: var(--muted); }
.tz-edit { display: grid; gap: .75rem; margin-top: .5rem; }
.tz-edit label, .tz-other { display: grid; gap: .25rem; }
/* Horário anterior (texto), só para consulta */
details.legacy { margin: 0 0 1rem; font-size: var(--fs-sm); }
details.legacy summary { cursor: pointer; color: var(--brand); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
details.legacy p { white-space: pre-wrap; overflow-wrap: anywhere; margin: .25rem 0 .5rem; }
.field > label > span.eur { display: inline-flex; margin: 0; font-size: var(--fs-md); }
/* Filtros das conversas: etiquetas que passam à linha seguinte (nunca escondidas por deslocamento) */
.tabs.inlist { display: flex; flex-wrap: wrap; gap: .4rem; overflow: visible; background: none; border: 0; padding: 0; max-width: none; margin: 0 1rem .75rem; }
.tabs.inlist button { flex: none; white-space: nowrap; border: 1px solid var(--border); border-radius: 999px; padding: .3rem .8rem; min-height: 36px; font-size: var(--fs-sm); color: var(--text); background: var(--surface); }
.tabs.inlist button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); outline: 0; box-shadow: none; }
@media (max-width: 860px) { .tabs.inlist button { min-height: 44px; padding: .3rem .85rem; } }
/* Segmentados: só o item escolhido tem fundo; sem sombra */
.tabs button[aria-pressed="true"], .seg button[aria-pressed="true"] { box-shadow: none; }
.bm-now.on.test .bm-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.linklike { border: 0; background: none; padding: 0; color: var(--brand); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; min-height: 44px; }
/* Atendimento: cada opção do menu e cada pedido separados por uma linha, sem caixa */
.at-items { margin: .5rem 0 .75rem; }
.at-item { display: grid; gap: .6rem; padding: .9rem 0; border-top: 1px solid var(--border); }
.at-item:first-child { border-top: 0; padding-top: .25rem; }
.at-lbl { display: grid; gap: .25rem; }
.at-lbl > span { font-size: var(--fs-sm); font-weight: 600; }
.at-lbl input[type=text], .at-lbl select { width: 100%; min-height: 44px; border: 1px solid var(--control); border-radius: var(--r-md); padding: .4rem .7rem; background: var(--field, var(--surface)); }
.at-item-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.at-item-foot .at-switch { margin: 0; font-weight: 400; }
.at-item-btns { display: flex; gap: .4rem; }
.at-req { border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: .9rem 0 .5rem; margin: 0; }
.at-req:first-of-type { border-top: 0; }
.field-errors { margin: .4rem 0 0; padding-left: 1.2rem; }
@media (max-width: 560px) { .at-row.at-field { display: grid; grid-template-columns: 1fr auto auto auto; } .at-row.at-field > input[type=text] { grid-column: 1 / -1; } .at-row.at-field > .at-req-lbl { grid-column: 1; } }
.qr-tools { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }
.qr-item { border-top: 1px solid var(--border); padding: .9rem 0; }
.qr-item:first-of-type { border-top: 0; }
.bubble.in { border-color: var(--border); } /* sem sombra, o balão branco precisa de contorno no fundo claro */
.switch-row { cursor: pointer; min-height: 44px; -webkit-tap-highlight-color: transparent; }
.switch-row:has(.switch:disabled) { cursor: default; }
/* Folha da marcação no telemóvel: os botões do formulário ficam sempre à vista no fundo, acima da zona do gesto do iPhone */
#ag-new svg { width: 18px; height: 18px; }
@media (max-width: 860px) {
  .ag-sheet form > .ag-actions { position: sticky; bottom: calc(-1.25rem - env(safe-area-inset-bottom)); background: var(--surface); margin: 0 -1.1rem; padding: .75rem 1.1rem calc(.75rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); z-index: 1; }
  .ag-sheet form > .ag-actions .btn { flex: 1 1 0; min-height: 48px; }
  .ag-sheet form > .ag-actions .btn.primary { flex: 2 1 0; }
  .ag-top #ag-new { border-radius: 999px; padding-inline: 1.1rem; }
}
.more-sheet:focus { outline: none; }
/* iOS: campos de data e hora com a largura do contentor (o Safari dá-lhes uma largura própria) */
input[type=date], input[type=time], input[type=datetime-local] { min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; text-align: left; }
input[type=date].finput, input[type=datetime-local].finput { display: block; width: 100%; }
input::-webkit-date-and-time-value { text-align: left; }
/* Folha da marcação com o teclado aberto: os botões deixam de ficar presos ao fundo (o teclado tapava-os) e ficam no fim do formulário */
@media (max-width: 860px) { .ag-sheet form:focus-within > .ag-actions { position: static; margin: 0; padding: .5rem 0 0; border-top: 0; } }
/* Telemóvel com teclado aberto: espaço extra no fundo para se poder deslocar até aos botões, acima do teclado */
@media (max-width: 860px) and (pointer: coarse) {
  .ag-sheet:has(input:focus, textarea:focus, select:focus), .page:has(input:not([type=checkbox]):not([type=radio]):focus, textarea:focus) { padding-bottom: 45vh; }
}
