/* =====================================================================
   Visual do consultório — proposta aprovada pelo dono em 05/10/2026
   (.claude/skills/visual-moderno/propostas/nutricionista-aprovada.html;
   o rascunho chamava "Prato", o produto é NutricaoCarbon).

   Cozinha boa, não hospital: fundo creme, berinjela como padrão da marca,
   Fraunces (serifa macia, SOFT 100) nos títulos, Figtree no texto e DM Mono
   nos números (kcal, gramas, kg), com tabular-nums. A cor da marca vem do
   consultório (Brand::cssRoot); a berinjela é só o padrão.

   Os macros têm cor FIXA em todo o sistema e nunca seguem a marca:
   proteína = salmão (--pro), carboidrato = trigo (--carb), gordura =
   abacate (--fat). O vermelho de erro/atraso (--bad) é framboesa, longe do
   salmão da proteína.

   Bootstrap continua por baixo: as telas usam as classes dele, e é aqui
   que elas ganham a cara nova. Esqueleto portado do dentista (mesmo núcleo).
   ===================================================================== */

/* ---------- 1. Fontes locais (OFL; a CSP é font-src 'self') ---------- */
/* Fraunces com SOFT fixo em 100 e o eixo óptico livre (o título grande fica
   mais fino, o pequeno mais firme); só o subconjunto latino, que cobre o
   português. É ela que pinta o título da tela: vai com preload. */
@font-face {
    font-family: 'Fraunces';
    src: url('../fonts/fraunces-soft-400-700.woff2') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Figtree';
    src: url('../fonts/figtree-var.woff2') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'DM Mono';
    src: url('../fonts/dm-mono-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'DM Mono';
    src: url('../fonts/dm-mono-500.woff2') format('woff2');
    font-weight: 500 700;
    font-style: normal;
    font-display: swap;
}

/* ---------- 2. Tokens ---------- */
:root {
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-sans: 'Figtree', 'Helvetica Neue', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    --r-xs: 7px;
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 24px;

    --sidebar-w: 214px;
    --sidebar-w-collapsed: 72px;
    --topbar-h: 60px;
    --tabbar-h: 66px;

    --ease: cubic-bezier(.4, 0, .2, 1);
    --ease-out: cubic-bezier(.2, .8, .2, 1);
    --spring: cubic-bezier(.2, .9, .25, 1);
    --fast: .15s;
    --normal: .22s;
    --slow: .32s;

    /* superfícies — claro (creme) */
    --bg:            #f7f4ec;
    --bg-subtle:     #efeadd;
    --surface:       #fffdf8;
    --surface-2:     #faf7f0;
    --surface-hover: #f3efe4;
    --border:        #e4ddcc;
    --border-strong: #cfc6b0;
    --text:          #1f1b14;
    --text-muted:    #5f5849;
    /* "apagado" que ainda passa 4,5:1 sobre o afundado: o da proposta
       (#857d6b) ficava em 3,4:1 e não passa no AA em texto pequeno. */
    --text-faint:    #6b6453;

    /* status: ok = verde, warn = âmbar, bad = framboesa (longe do salmão da
       proteína); info é a própria marca, suave. */
    --ok:   #2f7a4f;  --ok-bg:   #e2f2e8;
    --warn: #9a5b00;  --warn-bg: #fbefd9;
    --bad:  #b0283f;  --bad-bg:  #fbe4e8;
    --info: #5f5849;  --info-bg: #efeadd;
    --neutral-bg: #efeadd;

    /* Macros: cores de comida, fixas (nunca seguem a marca do consultório).
       Para preencher (anel, barra, ponto); texto usa --text. */
    --pro:  #c2462e; --pro-soft:  #fbe7e1;
    --carb: #a87100; --carb-soft: #f8edd2;
    --fat:  #5f7f1e; --fat-soft:  #ebf1dc;

    --brand-ink: #ffffff;
    --brand-soft: color-mix(in srgb, var(--brand) 11%, var(--surface));

    --shadow-xs: 0 1px 2px rgb(31 27 20 / .05);
    --shadow-sm: 0 1px 2px rgb(31 27 20 / .05), 0 6px 16px -10px rgb(31 27 20 / .18);
    --shadow-md: 0 1px 2px rgb(31 27 20 / .05), 0 12px 30px -16px rgb(31 27 20 / .25);
    --shadow-lg: 0 2px 6px rgb(31 27 20 / .06), 0 24px 48px -18px rgb(31 27 20 / .3);
    --shadow-brand: 0 10px 24px -12px rgba(var(--brand-rgb), .55);

    color-scheme: light;

    /* Bootstrap lê estas: sem elas, azul e cinza do Bootstrap vazam nos componentes dele. */
    --bs-body-font-family: var(--font-sans);
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-emphasis-color: var(--text);
    --bs-secondary-color: var(--text-muted);
    --bs-tertiary-color: var(--text-faint);
    --bs-secondary-bg: var(--surface-2);
    --bs-tertiary-bg: var(--bg-subtle);
    --bs-border-color: var(--border);
    --bs-border-color-translucent: var(--border);
    --bs-heading-color: var(--text);
    --bs-link-color-rgb: var(--brand-rgb);
    --bs-focus-ring-color: rgba(var(--brand-rgb), .25);
}

[data-bs-theme="dark"] {
    --bg:            #14120e;
    --bg-subtle:     #171510;
    --surface:       #1c1914;
    --surface-2:     #201d17;
    --surface-hover: #25211a;
    --border:        #2c2820;
    --border-strong: #3d382d;
    --text:          #f0ebe0;
    --text-muted:    #b3ab98;
    --text-faint:    #8d8573;

    --ok:   #7fd3a0;  --ok-bg:   #173326;
    --warn: #f0bd64;  --warn-bg: #38290d;
    --bad:  #ff8fa0;  --bad-bg:  #3d1720;
    --info: #b3ab98;  --info-bg: #25211a;
    --neutral-bg: #25211a;

    --pro:  #f08a73; --pro-soft:  #3d1f17;
    --carb: #e6b44a; --carb-soft: #3a2c0d;
    --fat:  #a8c86a; --fat-soft:  #26301a;

    --brand-soft: color-mix(in srgb, var(--brand) 24%, var(--surface));

    --shadow-xs: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4), 0 6px 16px -10px rgb(0 0 0 / .6);
    --shadow-md: 0 1px 2px rgb(0 0 0 / .4), 0 14px 30px -14px rgb(0 0 0 / .7);
    --shadow-lg: 0 2px 6px rgb(0 0 0 / .5), 0 28px 56px -18px rgb(0 0 0 / .8);

    color-scheme: dark;
}

/* ---------- 3. Base ---------- */
* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    font-size: .9375rem;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Serifa macia (Fraunces, SOFT 100) no título da tela e nos destaques: o resto
   é texto, em Figtree. Peso 500, como na proposta: a serifa já dá o contraste. */
h1, h2, .h1, .h2, .display {
    font-family: var(--font-display);
    font-weight: 500;
    font-variation-settings: "SOFT" 100;
    letter-spacing: -.02em;
    color: var(--text);
    text-wrap: balance;
}
h3, h4, h5, h6, .h3, .h4, .h5, .h6 {
    font-family: var(--font-sans);
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--text);
    text-wrap: balance;
}
h1 em, h2 em, .display em { font-style: normal; color: var(--brand-text); }

a { color: var(--brand-text); text-decoration: none; transition: color var(--fast) var(--ease); }
a:hover { color: var(--brand-text); text-decoration: underline; text-underline-offset: 3px; }
a.btn:hover, a.nav-link:hover, a.dropdown-item:hover, .mobile-nav a:hover, a.card-link-block:hover,
a.list-row:hover, a.sess-row:hover, a.icon-btn:hover, a.brand-mark:hover, a.chip:hover, a.li-row:hover,
a.mitem:hover, a.blk:hover, a.pitem:hover, a.agenda-item:hover, a.next-card:hover, a.tl-link:hover { text-decoration: none; }

/* Números: monoespaçados e de largura fixa — número que muda não faz a linha pular. */
.num, .tabular, .mono, .stat-value, .kpi-value, .money-value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
}
.mono { font-size: .9em; }
time { font-variant-numeric: tabular-nums; }

.text-muted   { color: var(--text-muted) !important; }
.text-faint   { color: var(--text-faint) !important; }
.text-brand   { color: var(--brand-text) !important; }
.text-body    { color: var(--text) !important; }
.text-ok, .text-success { color: var(--ok) !important; }
.text-bad, .text-danger { color: var(--bad) !important; }
.text-warn, .text-warning { color: var(--warn) !important; }
.text-info    { color: var(--info) !important; }
.fw-medium    { font-weight: 500; }
.fw-semibold  { font-weight: 600 !important; }
.fs-tiny      { font-size: .75rem; }
.fs-small     { font-size: .8125rem; }
.lh-tight     { line-height: 1.28; }
.min-w-0      { min-width: 0; }
.eyebrow {
    display: block;
    font: 500 .72rem/1 var(--font-mono);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--brand-text);
}

::selection { background: rgba(var(--brand-rgb), .2); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

/* Ícone de traço (SVG próprio, o mesmo desenho da proposta). */
.ico {
    width: 18px; height: 18px; flex: none;
    stroke: currentColor; fill: none; stroke-width: 1.7;
    stroke-linecap: round; stroke-linejoin: round;
    vertical-align: -3px;
}

/* ---------- 4. Estrutura ---------- */
.app-shell { min-height: 100vh; }

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width var(--normal) var(--ease), transform var(--slow) var(--spring);
    view-transition-name: sidebar;
}

.app-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--normal) var(--ease);
}

body.sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .app-main    { margin-left: var(--sidebar-w-collapsed); }
/* Recolhida = só ícones (display: none tira a largura do texto; opacity não). */
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-badge { display: none; }
body.sidebar-collapsed .nav-section-title {
    font-size: 0; padding: 0; margin: .6rem .55rem .35rem;
    border-top: 1px solid var(--border);
}
body.sidebar-collapsed .sidebar-nav .nav-link,
body.sidebar-collapsed .sidebar-foot .btn { justify-content: center; padding-inline: 0; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: 0; }
body.sidebar-collapsed .sidebar-foot .btn .ico { transform: rotate(180deg); }

.sidebar-brand {
    height: calc(var(--topbar-h) + 10px);
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 0 1rem;
    flex-shrink: 0;
    overflow: hidden;
}
/* A marca é um prato visto de cima (dois círculos), num círculo da cor da marca. */
.brand-mark {
    width: 32px; height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--brand);
    color: var(--brand-ink);
}
.brand-mark .ico { width: 18px; height: 18px; stroke-width: 2; vertical-align: 0; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.brand-text { min-width: 0; }
/* O nome do consultório costuma ser longo ("Nogueira & Lemos Nutrição"):
   quebra em até duas linhas em vez de virar "Nogueira ...". */
.brand-text strong {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    font: 600 1.125rem/1.1 var(--font-display); font-variation-settings: "SOFT" 100; letter-spacing: -.015em; color: var(--text);
}
.brand-text span { display: block; font-size: .6875rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .25rem .75rem 1.25rem;
}
.nav-section-title {
    font: 500 .6875rem/1 var(--font-mono);
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
    padding: 1rem .55rem .5rem;
    white-space: nowrap;
}
.sidebar-nav .nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .6rem;
    margin-bottom: 2px;
    border-radius: var(--r-sm);
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.sidebar-nav .nav-link .ico { width: 17px; height: 17px; vertical-align: 0; }
.sidebar-nav .nav-link:hover { background: var(--surface-hover); color: var(--text); }
.sidebar-nav .nav-link.active {
    background: var(--brand-soft);
    color: var(--brand-text);
    font-weight: 600;
}
.nav-badge {
    margin-left: auto;
    font: 500 .6875rem/1 var(--font-mono);
    padding: .22rem .5rem;
    border-radius: 99px;
    background: var(--warn-bg);
    color: var(--warn);
}
.nav-badge.soft { background: var(--neutral-bg); color: var(--text-muted); }
.nav-badge.bad { background: var(--bad-bg); color: var(--bad); }

.sidebar-foot { padding: .6rem .75rem; border-top: 1px solid var(--border); flex-shrink: 0; }

/* Topo (vidro fosco: uma das duas superfícies que pode ter) */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: 0 1.25rem;
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    backdrop-filter: saturate(150%) blur(14px);
    -webkit-backdrop-filter: saturate(150%) blur(14px);
    border-bottom: 1px solid var(--border);
    view-transition-name: topbar;
}
.topbar-title {
    font: 500 1.25rem/1.1 var(--font-display);
    letter-spacing: -.02em;
    margin: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    min-width: 0;
}
.topbar-brand { display: flex; align-items: center; gap: .55rem; min-width: 0; min-height: 44px; color: var(--text); }
.topbar-brand .brand-mark { width: 30px; height: 30px; }
.topbar-brand .brand-mark .ico { width: 16px; height: 16px; }

.icon-btn {
    width: 40px; height: 40px;
    display: inline-grid; place-items: center;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 1.05rem;
    padding: 0;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.icon-btn .ico { vertical-align: 0; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.has-dot { position: relative; }
.icon-btn.has-dot::after {
    content: '';
    position: absolute; top: 9px; right: 9px;
    width: 8px; height: 8px;
    border-radius: 99px;
    background: var(--brand);
    border: 2px solid var(--bg);
}

.topbar-search { position: relative; flex: 1; max-width: 420px; }
.topbar-search .ico {
    position: absolute; left: .8rem; top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    width: 16px; height: 16px;
    pointer-events: none;
}
.topbar-search input {
    width: 100%;
    height: 40px;
    padding: 0 2.8rem 0 2.3rem;
    border: 1px solid var(--border);
    border-radius: 99px;
    background: var(--surface);
    color: var(--text);
    font-size: .875rem;
    transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.topbar-search input::placeholder { color: var(--text-faint); }
.topbar-search input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .16);
}
.topbar-search kbd {
    position: absolute; right: .6rem; top: 50%;
    transform: translateY(-50%);
    font: 500 .6875rem/1 var(--font-mono);
    padding: .25rem .4rem;
    border-radius: 6px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.app-content { flex: 1; padding: 1.6rem 1.75rem 3rem; }
.container-app { width: 100%; max-width: 1240px; margin-inline: auto; }
main.app-content { view-transition-name: conteudo; }

.app-footer {
    padding: 1rem 1.5rem 1.4rem;
    text-align: center;
    font-size: .75rem;
    color: var(--text-muted);
}
.app-footer a { color: var(--text-muted); font-weight: 500; }

/* ---------- 5. Cabeçalho de página ---------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: .75rem 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.4rem;
}
.page-head h1 { font-size: 2rem; margin: 0; line-height: 1.08; }
.page-head .subtitle { color: var(--text-muted); font-size: .8125rem; margin-top: .4rem; display: flex; flex-wrap: wrap; gap: .3rem .4rem; align-items: center; }
.page-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.breadcrumb-mini {
    display: flex; align-items: center; gap: .35rem;
    font-size: .75rem; color: var(--text-muted);
    margin-bottom: .4rem;
    flex-wrap: wrap;
}
.breadcrumb-mini a { color: var(--text-muted); }

/* ---------- 6. Cartões e painéis ---------- */
.card {
    --bs-card-bg: var(--surface);
    --bs-card-color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: none;
    transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: .9rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}
.card-header:first-child { border-radius: var(--r-md) var(--r-md) 0 0; }
.card-header h2, .card-header h3, .card-header .card-title {
    font: 600 1rem/1.3 var(--font-sans);
    letter-spacing: -.01em;
    margin: 0;
}
/* O ícone colorido antes do título saiu: a proposta é texto e espaço. */
.card-header .card-title > i.bi:first-child { display: none; }
.card-body { padding: 1.1rem; }
.card-footer { background: var(--surface-2); border-top: 1px solid var(--border); padding: .8rem 1.1rem; }
.card-footer:last-child { border-radius: 0 0 var(--r-md) var(--r-md); }

.card-hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.card-link-block { display: block; color: inherit; }
.card-link-block:hover { color: inherit; }

/* Indicador: sem ícone colorido; número em mono, rótulo pequeno. */
.stat-card { position: relative; padding: 1rem 1.1rem; }
.stat-icon { display: none; }
.stat-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; }
.stat-value {
    font-size: 1.375rem;
    font-weight: 500;
    letter-spacing: -.02em;
    line-height: 1.15;
    margin-top: .25rem;
    color: var(--text);
}
.stat-value.fs-4 { font-size: 1.375rem !important; }
.stat-value small { font-size: .85rem; font-weight: 500; color: var(--text-muted); }
.stat-trend { font-size: .75rem; margin-top: .3rem; display: flex; align-items: center; gap: .25rem; color: var(--text-muted); }

/* Faixa de números: um bloco só com divisórias de 1px. */
.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(170px, 45%), 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
}
.kpi { background: var(--surface); padding: .95rem 1.05rem; display: grid; gap: .25rem; align-content: start; min-width: 0; color: inherit; }
.kpi-label { font-size: .75rem; color: var(--text-muted); }
.kpi-value { font-size: 1.375rem; font-weight: 500; letter-spacing: -.02em; line-height: 1.2; color: var(--text); overflow-wrap: anywhere; }
.kpi-note { font-size: .75rem; color: var(--text-muted); }
.kpi-note.ok { color: var(--ok); }
.kpi-note.bad { color: var(--bad); }
.kpi-note.warn { color: var(--warn); }

/* Barra recebido / previsto */
.meter { height: 6px; border-radius: 99px; background: var(--bg-subtle); overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; transform-origin: left; animation: meterIn .7s var(--ease-out) both; }
.meter .m-ok { background: var(--ok); }
.meter .m-open { background: var(--border-strong); }
.meter .m-late { background: var(--warn); }
@keyframes meterIn { from { transform: scaleX(0); } }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 1.1rem 1.15rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .75rem;
    align-content: start;
    min-width: 0;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.panel-head h2, .panel-head h3 { font: 600 1rem/1.3 var(--font-sans); margin: 0; letter-spacing: -.01em; }
.panel-head a { font-size: .8125rem; color: var(--brand-text); white-space: nowrap; }

/* ---------- 7. Botões ---------- */
.btn {
    --bs-btn-font-weight: 600;
    border-radius: 12px;
    font-size: .875rem;
    font-weight: 600;
    padding: .5rem 1rem;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    transition: transform .12s var(--ease), background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
    border-width: 1px;
}
.btn i { font-size: 1rem; }
.btn .ico { width: 17px; height: 17px; vertical-align: 0; }
.btn:active { transform: scale(.97); }
.btn-lg { padding: .75rem 1.2rem; font-size: .95rem; border-radius: 16px; min-height: 50px; }
.btn-sm { padding: .3rem .7rem; font-size: .8125rem; min-height: 34px; border-radius: 10px; }

.btn-primary, .btn-brand {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brand-ink);
}
.btn-primary:hover, .btn-primary:focus-visible, .btn-brand:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: var(--brand-ink);
}
.btn-primary:active, .btn-primary.active { background: var(--brand-dark) !important; border-color: var(--brand-dark) !important; color: var(--brand-ink) !important; }
[data-bs-theme="dark"] .btn-primary:hover { filter: brightness(1.08); background: var(--brand); border-color: var(--brand); }
.btn-primary:disabled, .btn-primary.disabled {
    background: var(--brand); border-color: var(--brand); color: var(--brand-ink);
    opacity: .45; box-shadow: none; transform: none;
}

.btn-outline-secondary, .btn-light {
    border-color: var(--border-strong);
    color: var(--text);
    background: var(--surface);
}
.btn-outline-secondary:hover, .btn-light:hover, .btn-outline-secondary:active, .btn-outline-secondary.active {
    background: var(--surface-hover) !important;
    border-color: var(--border-strong) !important;
    color: var(--text) !important;
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-text); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand) 18%, var(--surface)); color: var(--brand-text); }
.btn-warning { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.btn-warning:hover { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
[data-bs-theme="dark"] .btn-danger { color: #14120e; }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; filter: brightness(1.08); }
[data-bs-theme="dark"] .btn-danger:hover { color: #14120e; }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
[data-bs-theme="dark"] .btn-success { color: #14120e; }
.btn-outline-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: transparent; }
.btn-outline-danger:hover { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.btn-outline-primary { color: var(--brand-text); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.btn-outline-primary:hover { background: var(--brand-soft); color: var(--brand-text); border-color: var(--brand); }
.btn-link { color: var(--brand-text); }

.btn-group-tight .btn { border-radius: var(--r-xs); }
.btn-block, .btn-big {
    width: 100%; min-height: 52px; border-radius: 16px;
    font-size: .975rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; gap: .5rem;
}
.btn-big { background: var(--brand); color: var(--brand-ink); border: 0; transition: transform .12s var(--ease), filter var(--fast) var(--ease); }
.btn-big:hover { color: var(--brand-ink); filter: brightness(1.06); text-decoration: none; }
.btn-big:active { transform: scale(.98); }
.btn-big.calm { background: var(--ok); color: #fff; }
[data-bs-theme="dark"] .btn-big.calm { color: #14120e; }
.btn-big.quiet { background: var(--bg-subtle); color: var(--text-muted); }

.btn-close { filter: none; }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* Foco de teclado nos botões: anel na cor da marca. */
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .32); }
.btn-outline-secondary:focus-visible, .btn-light:focus-visible, .btn-ghost:focus-visible {
    background: var(--surface); color: var(--text); border-color: var(--brand);
}

/* ---------- 8. Formulários ---------- */
.form-label { font-size: .8125rem; font-weight: 600; color: var(--text-muted); margin-bottom: .35rem; }
.form-label .req { color: var(--bad); }

.form-control, .form-select {
    border-radius: 12px;
    border-color: var(--border-strong);
    background-color: var(--surface);
    color: var(--text);
    font-size: .9375rem;
    padding: .55rem .85rem;
    min-height: 42px;
    transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.form-control-sm, .form-select-sm { min-height: 36px; font-size: .875rem; padding: .35rem .65rem; border-radius: 10px; }
.form-control-lg, .form-select-lg { min-height: 50px; font-size: 1rem; }
.form-control::placeholder { color: var(--text-faint); }
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .16);
    background-color: var(--surface);
    color: var(--text);
}
.form-control:disabled, .form-control[readonly] { background: var(--surface-2); color: var(--text-muted); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--bad); }
.invalid-feedback { font-size: .78rem; color: var(--bad); }
.form-text { font-size: .78rem; color: var(--text-muted); }
textarea.form-control { min-height: 92px; line-height: 1.6; }
.form-control-color { min-height: 42px; padding: .3rem; }
.form-select { padding-right: 2.25rem; }
[data-bs-theme="dark"] .form-select { --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23a2afa9' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }

.input-group-text {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-muted);
    font-size: .84rem;
    border-radius: 12px;
}

.form-check-input { border-color: var(--border-strong); background-color: var(--surface); cursor: pointer; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .16); border-color: var(--brand); }
.form-switch .form-check-input { width: 2.4em; height: 1.35em; }
.form-check { min-height: 1.6rem; }
.form-check-label { cursor: pointer; }

.field-icon { position: relative; }
.field-icon > i, .field-icon > .ico {
    position: absolute; left: .8rem; top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    font-size: .95rem;
    pointer-events: none;
}
.field-icon > .form-control { padding-left: 2.35rem; }
.field-icon:focus-within > i { color: var(--brand-text); }

/* Seletor segmentado e abas */
.segmented {
    display: inline-flex;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 3px;
    gap: 2px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}
.segmented a, .segmented button {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: .8125rem;
    font-weight: 500;
    padding: .4rem .8rem;
    min-height: 34px;
    display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
    border-radius: 9px;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
    white-space: nowrap;
}
.segmented a:hover, .segmented button:hover { color: var(--text); text-decoration: none; }
.segmented a.active, .segmented button.active, .segmented [aria-pressed="true"], .segmented [aria-selected="true"] {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-xs);
}

.nav-pills, .nav-tabs {
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 3px;
    background: var(--bg-subtle);
    border-radius: 12px;
    border: 1px solid var(--border);
    max-width: 100%;
    width: fit-content;
}
.nav-pills::-webkit-scrollbar, .nav-tabs::-webkit-scrollbar { display: none; }
.nav-pills .nav-link, .nav-tabs .nav-link {
    white-space: nowrap; border-radius: 9px; font-size: .8125rem; font-weight: 500;
    border: 0; padding: .45rem .85rem; color: var(--text-muted); background: transparent;
    display: inline-flex; align-items: center; gap: .35rem; min-height: 36px;
}
.nav-pills .nav-link:hover, .nav-tabs .nav-link:hover { color: var(--text); text-decoration: none; }
.nav-pills .nav-link.active, .nav-tabs .nav-link.active {
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs);
}

/* Fichas de escolha (forma de pagamento, motivo) */
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choice {
    padding: .55rem .9rem;
    min-height: 44px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: .875rem;
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    cursor: pointer;
    user-select: none;
    transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), color var(--fast) var(--ease), transform .12s var(--ease);
}
.choice:active { transform: scale(.97); }
.choice[aria-pressed="true"], .choice.active, input:checked + .choice {
    border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); font-weight: 600;
}
input:focus-visible + .choice { outline: 2px solid var(--brand); outline-offset: 2px; }
.choice-input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }

/* ---------- 9. Tabelas ---------- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
}
.table-wrap .table-responsive { border-radius: inherit; }

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-hover-bg: var(--surface-hover);
    --bs-table-hover-color: var(--text);
    --bs-table-border-color: var(--border);
    --bs-table-striped-bg: var(--surface-2);
    color: var(--text);
    margin: 0;
    font-size: .875rem;
}
.table > thead th {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font: 500 .6875rem/1.2 var(--font-mono);
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: .7rem .9rem;
    white-space: nowrap;
}
.table > tbody > tr { transition: background var(--fast) var(--ease); }
.table > tbody > tr:hover > * { background: var(--surface-hover); }
.table > tbody td, .table > tfoot td { padding: .72rem .9rem; border-color: var(--border); vertical-align: middle; }
.table > tbody > tr:last-child td { border-bottom: 0; }
.table > tfoot td { border-bottom: 0; }
.table-row-link, [data-href] { cursor: pointer; }
.th-sort { color: inherit; display: inline-flex; align-items: center; gap: .25rem; }
.th-sort:hover { color: var(--brand-text); }
.table td.text-end { font-variant-numeric: tabular-nums; }

@media (min-width: 768px) {
    .table-app > :not(caption) > * > * { padding-top: .72rem; padding-bottom: .72rem; }
    .table-app > :not(caption) > * > *:first-child { padding-left: 1.15rem; }
    .table-app > :not(caption) > * > *:last-child  { padding-right: 1.15rem; }
}

/* ---------- 10. Pílulas e fichas ---------- */
.badge-soft, .pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .72rem;
    font-weight: 600;
    padding: .22rem .62rem;
    border-radius: 99px;
    background: var(--neutral-bg);
    color: var(--text-muted);
    white-space: nowrap;
    line-height: 1.45;
}
.badge-soft i.bi { font-size: .7rem; }
.badge-soft .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; flex-shrink: 0; }
.badge-soft.ok, .pill.ok       { background: var(--ok-bg);   color: var(--ok); }
.badge-soft.warn, .pill.warn   { background: var(--warn-bg); color: var(--warn); }
.badge-soft.bad, .pill.bad     { background: var(--bad-bg);  color: var(--bad); }
.badge-soft.info, .pill.info   { background: var(--brand-soft); color: var(--brand-text); }
.badge-soft.brand, .pill.brand { background: var(--brand-soft); color: var(--brand-text); }

.chip {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .78rem;
    padding: .3rem .7rem;
    border: 1px solid var(--border);
    border-radius: 99px;
    background: var(--surface);
    color: var(--text-muted);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip .btn-close { font-size: .55rem; opacity: .6; }
.badge { font-weight: 600; }

/* ---------- 11. Avatar ---------- */
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    font-size: .75rem;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    user-select: none;
    /* Fundo fixo escuro: o branco das iniciais passa nos dois temas (6:1). */
    background: #5f5849;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar-xs { width: 24px; height: 24px; font-size: .6rem; }
.avatar-sm { width: 30px; height: 30px; font-size: .68rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.05rem; }
.avatar-xl { width: 76px; height: 76px; font-size: 1.5rem; }
/* Iniciais discretas, sem cor gritante por paciente (a proposta usa o afundado). */
.av {
    width: 34px; height: 34px; border-radius: 50%;
    display: inline-grid; place-items: center; flex: none;
    font: 600 .75rem/1 var(--font-sans);
    background: var(--bg-subtle); color: var(--text-muted);
}

/* ---------- 12. Progresso ---------- */
.progress { height: 6px; border-radius: 99px; background: var(--bg-subtle); overflow: hidden; }
.progress-bar { background: var(--brand); border-radius: 99px; transition: width .6s var(--ease-out); }
.progress-thin { height: 4px; }
.progress-bar.ok   { background: var(--ok); }
.progress-bar.warn { background: var(--warn); }
.progress-bar.bad  { background: var(--bad); }
.ring { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-linecap: round; }
.ring .track { stroke: var(--bg-subtle); }
.ring .value { stroke: var(--brand); transition: stroke-dashoffset .8s var(--ease-out); }

/* ---------- 13. Linha do tempo ---------- */
.timeline { position: relative; padding-left: 1.7rem; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--border), transparent); }
.timeline-item { position: relative; padding-bottom: 1.2rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: -1.7rem; top: 2px;
    width: 24px; height: 24px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--surface); border: 2px solid var(--border);
    font-size: .68rem; color: var(--text-muted); z-index: 1;
}
.timeline-dot.brand { border-color: var(--brand); color: var(--brand-text); background: var(--brand-soft); }
.timeline-dot.ok    { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.timeline-dot.warn  { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.timeline-dot.bad   { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }

/* ---------- 14. Estado vazio ---------- */
.empty-state { text-align: center; padding: 2.4rem 1.25rem; }
.empty-state .icon {
    width: 56px; height: 56px;
    margin: 0 auto .9rem;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 1.4rem;
    background: var(--bg-subtle);
    color: var(--text-muted);
}
.empty-state h3 { font: 500 1.4rem/1.2 var(--font-display); margin-bottom: .3rem; }
.empty-state p { color: var(--text-muted); font-size: .875rem; max-width: 380px; margin: 0 auto 1.1rem; }

/* ---------- 15. Menus, modais, folhas ---------- */
.dropdown-menu {
    --bs-dropdown-bg: var(--surface);
    --bs-dropdown-color: var(--text);
    --bs-dropdown-border-color: var(--border);
    --bs-dropdown-link-color: var(--text);
    --bs-dropdown-link-hover-color: var(--text);
    --bs-dropdown-link-hover-bg: var(--surface-hover);
    --bs-dropdown-header-color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    background: var(--surface);
    padding: .35rem;
    font-size: .875rem;
}
.dropdown-menu.show { animation: dropIn var(--fast) var(--ease-out); }
@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } }
.dropdown-item {
    border-radius: 9px;
    padding: .55rem .65rem;
    color: var(--text);
    display: flex; align-items: center; gap: .6rem;
    min-height: 40px;
}
.dropdown-item i, .dropdown-item .ico { font-size: 1rem; color: var(--text-muted); width: 18px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-hover); color: var(--text); }
.dropdown-item.text-danger, .dropdown-item.text-danger i { color: var(--bad) !important; }
.dropdown-item.text-danger:hover { background: var(--bad-bg); color: var(--bad); }
.dropdown-divider { border-color: var(--border); margin: .3rem 0; }
.dropdown-header { font: 500 .6875rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }

.modal { --bs-modal-bg: var(--surface); --bs-modal-color: var(--text); }
.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.modal-header { border-bottom: 1px solid var(--border); padding: 1rem 1.15rem; }
.modal-title { font: 500 1.5rem/1.1 var(--font-display); letter-spacing: -.01em; }
.modal-body { padding: 1.15rem; }
.modal-footer { border-top: 1px solid var(--border); padding: .8rem 1.15rem; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.modal.fade .modal-dialog { transform: translateY(12px) scale(.985); transition: transform var(--slow) var(--spring), opacity var(--normal); }
.modal.show .modal-dialog { transform: none; }
.modal-backdrop { --bs-backdrop-bg: #0f0c08; }
.modal-backdrop.show { opacity: .45; }

.offcanvas { background: var(--surface); color: var(--text); border-color: var(--border); }
.accordion {
    --bs-accordion-bg: var(--surface);
    --bs-accordion-color: var(--text);
    --bs-accordion-border-color: var(--border);
    --bs-accordion-btn-color: var(--text);
    --bs-accordion-active-bg: var(--surface-2);
    --bs-accordion-active-color: var(--text);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .16);
}

/* Folha que sobe (bottom sheet) — <dialog> nativo: foco preso e Esc de graça.
   No celular encosta embaixo; no computador vira painel central. */
.sheet {
    border: 0;
    padding: 0;
    margin: auto auto 0;
    width: 100%;
    max-width: 520px;
    max-height: min(92dvh, 860px);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 -12px 30px -10px rgb(0 0 0 / .35);
    overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; animation: sheetUp var(--slow) var(--spring); }
.sheet.closing { animation: sheetDown .18s var(--ease) forwards; }
.sheet::backdrop { background: rgb(15 12 8 / .45); animation: fadeIn var(--normal) var(--ease); }
.sheet.closing::backdrop { animation: fadeOut .18s var(--ease) forwards; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetDown { to { transform: translateY(100%); } }
@keyframes fadeOut { to { opacity: 0; } }
.sheet-grab {
    display: block;
    width: 100%; height: 22px;
    border: 0; background: transparent;
    flex: none; cursor: grab; touch-action: none;
}
.sheet-grab::before {
    content: ''; display: block; width: 36px; height: 4px; border-radius: 4px;
    background: var(--border-strong); margin: 9px auto 0;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 1rem .5rem; flex: none; }
.sheet-head h2 { font-size: 1.6rem; margin: 0; line-height: 1.1; }
.sheet-head small { display: block; color: var(--text-muted); font-size: .8125rem; margin-top: .2rem; }
.sheet-body { padding: .25rem 1rem 1rem; overflow-y: auto; display: grid; gap: .65rem; overscroll-behavior: contain; }
.sheet-foot {
    flex: none;
    padding: .75rem 1rem calc(.85rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: grid; gap: .6rem;
}
.sheet > form { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.sheet fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.sheet legend { float: none; width: auto; font-size: .78rem; color: var(--text-muted); font-weight: 500; margin-bottom: .45rem; }
@media (min-width: 768px) {
    .sheet { margin: auto; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
    .sheet[open] { animation: popIn var(--slow) var(--spring); }
    .sheet.closing { animation: popOut .16s var(--ease) forwards; }
    .sheet-grab { height: 10px; pointer-events: none; }
    .sheet-grab::before { display: none; }
}
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes popOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* Opção grande da folha (Realizada / Faltou / Remarcar) */
.opt {
    display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: .7rem; align-items: start;
    width: 100%; padding: .8rem .85rem; min-height: 56px;
    border: 1px solid var(--border); border-radius: var(--r-md);
    background: var(--surface); color: var(--text); text-align: left;
    transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform .12s var(--ease);
}
.opt:hover { border-color: var(--border-strong); background: var(--surface-2); }
.opt:active { transform: scale(.985); }
.opt .ico { width: 20px; height: 20px; color: var(--brand-text); margin-top: 1px; vertical-align: 0; }
.opt b { display: block; font-size: .9375rem; font-weight: 600; }
.opt small { display: block; font-size: .78rem; color: var(--text-muted); line-height: 1.45; }
.opt[aria-disabled="true"], .opt:disabled { opacity: .55; pointer-events: none; }
.opt-panel { display: grid; gap: .6rem; padding: .25rem 0 .1rem; }
.opt-panel[hidden] { display: none; }

/* Esqueleto: contorno do que vai chegar, no lugar de spinner */
.skeleton {
    background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--surface-hover) 37%, var(--bg-subtle) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: var(--r-xs);
    color: transparent !important;
}
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ---------- 16. Alertas e avisos (toast) ---------- */
/* O aviso flui como texto, com o ícone ao lado: muitos avisos têm texto solto
   com <strong> no meio, e em flex cada pedaço virava uma coluna. Os que
   precisam de flex (texto + botão) já trazem .d-flex. */
.alert {
    border: 1px solid transparent;
    border-radius: var(--r-md);
    font-size: .875rem;
    padding: .8rem .95rem;
    display: block;
    position: relative;
    gap: .65rem;
}
.alert:has(> i:first-child, > .ico:first-child) { padding-left: 2.55rem; }
.alert > i:first-child, .alert > .ico:first-child { position: absolute; left: .9rem; top: .85rem; }
.alert i { font-size: 1.05rem; flex-shrink: 0; }
.alert > .ico:first-child { width: 18px; height: 18px; }
.alert-success { background: var(--ok-bg);   color: var(--ok);   border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.alert-danger  { background: var(--bad-bg);  color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
.alert-warning { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.alert-info    { background: var(--brand-soft); color: var(--brand-text); border-color: color-mix(in srgb, var(--brand) 18%, transparent); }
.alert-secondary { background: var(--bg-subtle); color: var(--text); border-color: var(--border); }
.alert strong { color: inherit; }
.alert .btn { flex-shrink: 0; }
.alert .fs-small, .alert .fs-tiny { color: inherit; }

.toast-stack {
    position: fixed;
    right: 1rem; top: calc(var(--topbar-h) + .75rem);
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    width: min(380px, calc(100vw - 2rem));
    pointer-events: none;
}
.toast-item {
    pointer-events: auto;
    display: flex; align-items: flex-start; gap: .6rem;
    background: var(--text);
    color: var(--bg);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: .75rem .85rem;
    font-size: .875rem;
    animation: toastIn var(--slow) var(--spring);
}
.toast-item.leaving { animation: toastOut .18s var(--ease) forwards; }
.toast-item .ico { width: 20px; height: 20px; margin-top: 0; stroke-width: 2; vertical-align: 0; }
.toast-item.success .ico { color: #9fe0b8; }
.toast-item.danger .ico  { color: #ffb3be; }
.toast-item.warning .ico { color: #f3cd86; }
.toast-item.info .ico    { color: #dcb8ea; }
[data-bs-theme="dark"] .toast-item.success .ico { color: #2f7a4f; }
[data-bs-theme="dark"] .toast-item.danger .ico  { color: #b0283f; }
[data-bs-theme="dark"] .toast-item.warning .ico { color: #9a5b00; }
[data-bs-theme="dark"] .toast-item.info .ico    { color: #4f2361; }
.toast-item .btn-close { filter: invert(1) grayscale(1) brightness(2); opacity: .7; }
[data-bs-theme="dark"] .toast-item .btn-close { filter: none; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(-12px) scale(.98); } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(-8px) scale(.98); } }

/* ---------- 17. Movimento: entrada de conteúdo e troca de página ---------- */
@keyframes fadeUp { from { opacity: .001; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Só opacidade no contêiner da página: transform aqui prenderia os modais
   (position: fixed) dentro do conteúdo. O deslize fica no .stagger. */
.page-enter { animation: fadeIn var(--normal) var(--ease-out) both; }
.stagger > *, .list-anim > * { animation: fadeUp .36s var(--ease-out) both; }
.stagger > *:nth-child(2), .list-anim > *:nth-child(2) { animation-delay: .05s; }
.stagger > *:nth-child(3), .list-anim > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4), .list-anim > *:nth-child(4) { animation-delay: .15s; }
.stagger > *:nth-child(5), .list-anim > *:nth-child(5) { animation-delay: .2s; }
.stagger > *:nth-child(6), .list-anim > *:nth-child(6) { animation-delay: .24s; }
.stagger > *:nth-child(n+7), .list-anim > *:nth-child(n+7) { animation-delay: .28s; }
.table-app > tbody > tr { animation: fadeUp .36s var(--ease-out) both; }
.table-app > tbody > tr:nth-child(2) { animation-delay: .03s; }
.table-app > tbody > tr:nth-child(3) { animation-delay: .06s; }
.table-app > tbody > tr:nth-child(4) { animation-delay: .09s; }
.table-app > tbody > tr:nth-child(5) { animation-delay: .12s; }
.table-app > tbody > tr:nth-child(n+6) { animation-delay: .15s; }

/* Troca de página: cross-fade curto; topo, menu e barra inferior têm nome
   próprio e não piscam. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; }
::view-transition-old(conteudo) { animation: .16s var(--ease) both fadeOut; }
::view-transition-new(conteudo) { animation: .26s var(--ease-out) both fadeUp; }

/* Check desenhado ao confirmar (presença, sessão realizada) */
.check-draw { width: 76px; height: 76px; }
.check-draw circle { fill: var(--ok-bg); stroke: var(--ok); stroke-width: 3; stroke-dasharray: 220; stroke-dashoffset: 220; animation: draw .45s var(--ease-out) forwards; }
.check-draw path { fill: none; stroke: var(--ok); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .3s .35s var(--ease-out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
/* Cadeado que fecha ao assinar a evolução */
.lock-draw { width: 76px; height: 76px; }
.lock-draw rect { fill: var(--brand-soft); stroke: var(--brand-text); stroke-width: 3; }
.lock-draw path { fill: none; stroke: var(--brand-text); stroke-width: 3.5; stroke-linecap: round; animation: shut .5s .15s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes shut { from { transform: translateY(-8px); } to { transform: none; } }
.done-overlay {
    position: fixed; inset: 0; z-index: 1085;
    display: grid; place-items: center; align-content: center; gap: .8rem;
    background: color-mix(in srgb, var(--surface) 95%, transparent);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    text-align: center; padding: 1.5rem;
    animation: fadeIn var(--normal) var(--ease) both;
}
.done-overlay h2 { font-size: 2rem; margin: 0; }
.done-overlay p { color: var(--text-muted); font-size: .9rem; max-width: 34ch; margin: 0; }
.done-overlay.leaving { animation: fadeOut .2s var(--ease) forwards; }
.seal-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    font: 500 .78rem/1 var(--font-mono);
    padding: .45rem .75rem; border-radius: 99px;
    background: var(--ok-bg); color: var(--ok);
}
.seal-badge.bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- 18. Painel "Hoje" ---------- */
.today-head h1 { font-size: 2.5rem; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.today-grid > * { min-width: 0; }
.today-side { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }

/* A próxima sessão, em destaque, com o tempo até começar */
.next-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1.1rem;
    align-items: center;
    padding: 1.15rem 1.25rem;
    border-radius: var(--r-md);
    background: linear-gradient(135deg, var(--brand-soft), var(--surface) 70%);
    border: 1px solid var(--border);
    color: inherit;
}
.next-when { font: 500 2.6rem/1 var(--font-display); font-variant-numeric: tabular-nums; min-width: 3.2ch; }
.next-when small { display: block; font: 500 .6875rem/1 var(--font-mono); color: var(--text-muted); letter-spacing: .07em; text-transform: uppercase; margin-top: .45rem; }
.next-card b { display: block; font-size: 1rem; font-weight: 600; }
.next-card .meta { font-size: .8125rem; color: var(--text-muted); }
.next-card .acts { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.next-card.empty { grid-template-columns: minmax(0, 1fr) auto; background: var(--surface); }

.sess-list { display: grid; grid-template-columns: minmax(0, 1fr); }
.sess-row {
    display: grid;
    grid-template-columns: 52px 34px minmax(0, 1fr) auto;
    gap: .8rem;
    align-items: center;
    padding: .7rem 0;
    border-top: 1px solid var(--border);
    color: inherit;
    transition: background var(--fast) var(--ease);
}
.sess-row:first-child { border-top: 0; }
a.sess-row:hover { background: var(--surface-2); }
.sess-row time { font: 500 .8125rem/1 var(--font-mono); color: var(--text-muted); }
.sess-row b { display: block; font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-row small { display: block; font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-row.is-done { opacity: .62; }
.sess-row.is-now { box-shadow: inset 3px 0 0 var(--brand); padding-left: .6rem; margin-left: -.6rem; }

.li-row {
    display: flex; justify-content: space-between; align-items: center; gap: .75rem;
    padding: .65rem 0; border-top: 1px solid var(--border); font-size: .875rem; color: inherit;
    min-height: 48px;
}
.li-row:first-child { border-top: 0; }
.li-row small { display: block; font-size: .75rem; color: var(--text-muted); }
.li-row .num { white-space: nowrap; font-weight: 500; }
a.li-row:hover { background: var(--surface-2); }

.money-box { display: grid; gap: .5rem; }
.money-box strong { font: 500 1.75rem/1.1 var(--font-mono); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.money-box .sub { font-size: .8125rem; color: var(--text-muted); }
.note-line { font-size: .78rem; color: var(--text-muted); display: flex; gap: .45rem; align-items: flex-start; margin: 0; }
.note-line .ico { width: 14px; height: 14px; color: var(--ok); margin-top: 3px; vertical-align: 0; }

/* ---------- 19. Hoje no celular: a sessão em destaque ---------- */
.nowcard {
    border-radius: var(--r-lg); padding: 1rem 1.05rem 1.05rem;
    background: var(--brand); color: var(--brand-ink);
    display: grid; gap: .55rem;
}
.nowcard small { font: 500 .6875rem/1 var(--font-mono); letter-spacing: .07em; text-transform: uppercase; }
.nowcard b { font: 500 1.6rem/1.1 var(--font-display); }
.nowcard .meta { font-size: .8125rem; }
.nowcard .acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .2rem; }
.nowcard .acts > :only-child { grid-column: 1 / -1; }
.nowcard .w, .nowcard .o {
    min-height: 46px; border-radius: 12px; font-weight: 600; font-size: .875rem;
    display: flex; align-items: center; justify-content: center; gap: .4rem; padding: 0 .5rem;
    transition: transform .12s var(--ease);
}
.nowcard .w:active, .nowcard .o:active { transform: scale(.97); }
.nowcard .w { background: #fff; color: #3b1749; border: 0; }
.nowcard .o { background: transparent; color: var(--brand-ink); border: 1px solid color-mix(in srgb, var(--brand-ink) 55%, transparent); }
.nowcard .w:hover, .nowcard .o:hover { text-decoration: none; }
.nowcard .w:hover { color: #3b1749; }
.nowcard .o:hover { color: var(--brand-ink); }

.mlist { display: grid; gap: .55rem; grid-template-columns: minmax(0, 1fr); }
.mitem {
    display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: .65rem; align-items: center;
    padding: .75rem .8rem; min-height: 60px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
    color: inherit;
}
.mitem time { font: 500 .78rem/1 var(--font-mono); color: var(--text-muted); }
.mitem b { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mitem small { display: block; font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Só no celular / só no computador (o Hoje tem duas composições) */
.only-mobile { display: none !important; }

/* ---------- 21. Prontuário: abas que não cortam ---------- */
.pt-tabs {
    display: flex; gap: 4px; padding: 4px;
    background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 14px;
    overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
    margin-bottom: 1rem; width: fit-content; max-width: 100%;
}
.pt-tabs::-webkit-scrollbar { display: none; }
.pt-tabs button {
    border: 0; background: transparent; color: var(--text-muted);
    font-size: .875rem; font-weight: 500; white-space: nowrap;
    min-height: 40px; padding: 0 .95rem; border-radius: 10px;
    display: inline-flex; align-items: center; gap: .4rem; scroll-snap-align: start;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.pt-tabs button:hover { color: var(--text); }
.pt-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); font-weight: 600; }
.pt-tabs .count { font: 500 .6875rem/1 var(--font-mono); color: var(--text-faint); }
.pt-pane { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.pt-pane[hidden] { display: none; }
.pt-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 1rem; align-items: start; }
.pt-grid > * { min-width: 0; }
.pt-side { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.tl-link { color: inherit; display: block; }
.tl-link:hover b { color: var(--brand-text); }

/* ---------- 23. Barra inferior (celular) ---------- */
.mobile-nav {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1035;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: saturate(150%) blur(14px);
    -webkit-backdrop-filter: saturate(150%) blur(14px);
    border-top: 1px solid var(--border);
    padding: .3rem .35rem calc(.35rem + env(safe-area-inset-bottom));
    view-transition-name: tabbar;
}
.mobile-nav-inner { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.mobile-nav a, .mobile-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 54px;
    padding: .3rem .2rem;
    font-size: .6875rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 0; background: transparent;
    border-radius: 12px;
    transition: color var(--fast) var(--ease);
}
.mobile-nav .ico { width: 22px; height: 22px; vertical-align: 0; transition: transform var(--normal) var(--spring); }
.mobile-nav a.active { color: var(--brand-text); font-weight: 600; }
.mobile-nav a:active .ico, .mobile-nav button:active .ico { transform: scale(.88); }

/* ---------- 24. Utilitários ---------- */
.divider-text {
    display: flex; align-items: center; gap: .75rem;
    color: var(--text-muted); font-size: .78rem;
    margin: 1.1rem 0;
}
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.hover-reveal .reveal { opacity: 0; transition: opacity var(--fast) var(--ease); }
.hover-reveal:hover .reveal, .hover-reveal:focus-within .reveal { opacity: 1; }
@media (hover: none) { .hover-reveal .reveal { opacity: 1; } }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* Datas em português: só a primeira letra sobe. */
.first-cap { display: inline-block; }
.first-cap::first-letter { text-transform: uppercase; }
.cursor-pointer { cursor: pointer; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; }

.bg-surface { background: var(--surface) !important; }
.bg-subtle  { background: var(--bg-subtle) !important; }
.bg-body    { background: var(--bg) !important; }
.border-app { border-color: var(--border) !important; }
.border, .border-top, .border-bottom { border-color: var(--border) !important; }
.border-warning { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)) !important; }
.border-info { border-color: color-mix(in srgb, var(--brand) 30%, var(--border)) !important; }
.rounded-app { border-radius: var(--r-md) !important; }
code { color: var(--brand-text); font-family: var(--font-mono); font-size: .85em; }

.list-rows { display: flex; flex-direction: column; }
.list-row {
    display: flex; align-items: center; gap: .65rem;
    padding: .65rem 0; border-bottom: 1px solid var(--border);
    min-width: 0; color: inherit;
}
.list-rows > .list-row:last-child { border-bottom: 0; }
a.list-row { text-decoration: none; color: inherit; border-radius: var(--r-xs); }
a.list-row:hover { background: var(--surface-2); }
.mini-stat {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: .65rem .8rem;
    height: 100%;
}
.mini-stat strong { font-weight: 600; }
.section-label {
    font: 500 .6875rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-muted); margin-bottom: .5rem;
}

/* Linhas de indicadores das outras telas viram a mesma faixa compacta do
   painel, sem mexer no HTML de cada uma. */
.row:has(> * > .stat-card) {
    --bs-gutter-x: 0; --bs-gutter-y: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(170px, 45%), 1fr));
    gap: 1px;
    margin-left: 0; margin-right: 0;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
}
.row:has(> * > .stat-card) > * { width: auto; max-width: none; padding: 0; margin: 0; }
.row:has(> * > .stat-card) .stat-card { border: 0; border-radius: 0; height: 100%; }

/* Link no meio de texto não pode depender só da cor (WCAG 1.4.1). */
p a:not(.btn), .subtitle a, .form-text a, .alert a:not(.btn), li a:not(.btn):not(.dropdown-item):not(.nav-link),
.text-muted a:not(.btn), .fs-small a:not(.btn):not(.li-row):not(.list-row) {
    text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}

/* Ícone do tema: os dois no HTML, o CSS mostra o certo (sem piscar no carregamento). */
.theme-ico-light { display: none !important; }
[data-bs-theme="dark"] .theme-ico-dark { display: none !important; }
[data-bs-theme="dark"] .theme-ico-light { display: inline-block !important; }

/* Foco e rolagem automática não escondem o alvo atrás do topo nem da barra inferior. */
html { scroll-padding-top: calc(var(--topbar-h) + 12px); }
.tab-pane:not(.active) { display: none; }

/* ---------- 25. Agenda ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--border); gap: 1px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.cal-weekday { background: var(--surface-2); padding: .5rem; text-align: center; font: 500 .6875rem var(--font-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.cal-day { background: var(--surface); min-height: 112px; padding: .4rem; display: flex; flex-direction: column; gap: .22rem; }
.cal-day.other-month { background: var(--surface-2); }
.cal-day.other-month .cal-daynum { color: var(--text-faint); }
.cal-day.today .cal-daynum { background: var(--brand); color: var(--brand-ink); border-radius: 99px; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-daynum { font: 500 .75rem var(--font-mono); color: var(--text-muted); margin-bottom: .1rem; }
.cal-event {
    display: flex; align-items: center; gap: .3rem;
    font-size: .72rem; padding: .2rem .4rem; border-radius: var(--r-xs);
    background: var(--brand-soft); color: var(--brand-text); border-left: 2.5px solid var(--brand);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-more { font-size: .68rem; color: var(--text-muted); padding-left: .35rem; }
.agenda-item {
    display: flex; gap: .85rem; align-items: center;
    padding: .8rem .9rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: inherit;
    transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.agenda-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.agenda-time { font: 500 .8125rem/1.2 var(--font-mono); font-variant-numeric: tabular-nums; min-width: 46px; color: var(--text-muted); }

/* Kanban genérico (ainda usado pelo app.js para arrastar) */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: .75rem; overflow-x: auto; }
.kanban-col { background: var(--bg-subtle); border-radius: var(--r-md); display: flex; flex-direction: column; }
.kanban-col.drop-target { outline: 2px dashed var(--brand); outline-offset: -2px; }
.kanban-body { padding: .6rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: .7rem .8rem; }
.kanban-card.dragging { opacity: .45; }
.kanban-count { margin-left: auto; font: 500 .7rem var(--font-mono); color: var(--text-muted); }

/* Arquivos */
.file-card { display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.file-icon { width: 38px; height: 38px; border-radius: var(--r-xs); display: grid; place-items: center; background: var(--bg-subtle); color: var(--text-muted); font-size: 1.1rem; flex-shrink: 0; }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); padding: 1.75rem 1rem; text-align: center; background: var(--surface-2); color: var(--text-muted); cursor: pointer; transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease); }
.dropzone:hover, .dropzone.dragover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }

/* ---------- 26. Responsivo ---------- */
@media (max-width: 1199.98px) {
    .app-content { padding: 1.3rem 1.2rem 3rem; }
    .today-grid, .pt-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); width: min(300px, 86vw); }
    body.sidebar-open .app-sidebar { transform: none; }
    .app-main { margin-left: 0 !important; }
    body.sidebar-collapsed .app-sidebar { width: min(300px, 86vw); }
    body.sidebar-collapsed .nav-label, body.sidebar-collapsed .brand-text, body.sidebar-collapsed .nav-badge { display: revert; }
    .sidebar-nav .nav-link { min-height: 44px; }
    .sidebar-backdrop {
        position: fixed; inset: 0;
        background: rgb(15 12 8 / .45);
        z-index: 1039;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--normal) var(--ease);
    }
    body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
}

@media (max-width: 767.98px) {
    body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
    html { scroll-padding-bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); }
    .app-content { padding: 1rem .9rem 1.5rem; }
    .app-topbar { padding: 0 .5rem 0 .85rem; gap: .2rem; }
    .toast-stack { top: auto; bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); right: .75rem; left: .75rem; width: auto; }

    .only-mobile { display: grid !important; }
    .only-desktop { display: none !important; }

    .page-head { margin-bottom: 1rem; align-items: flex-start; }
    .page-head h1, .today-head h1 { font-size: 2rem; }
    .page-head-actions { width: 100%; }
    .page-head-actions > .btn, .page-head-actions > form, .page-head-actions > a { flex: 1; }
    .page-head-actions > form .btn { width: 100%; }
    /* Botão que no computador tem ícone e texto não vira botão vazio no celular. */
    .page-head-actions .btn .d-none.d-sm-inline { display: inline !important; }

    .card-body { padding: .95rem; }
    .card-header { padding: .8rem .95rem; }
    .panel { padding: .95rem; }

    .kpi { padding: .8rem .85rem; }
    .kpi-value, .stat-value { font-size: 1.2rem; }
    .row:has(> * > .stat-card) > :last-child:nth-child(odd) { grid-column: 1 / -1; }

    .mobile-nav { display: block; }
    .app-footer { display: none; }

    .next-card { grid-template-columns: auto minmax(0, 1fr); }
    .next-card .acts { grid-column: 1 / -1; justify-content: stretch; }
    .next-card .acts > * { flex: 1; }
    .sess-row { grid-template-columns: 46px minmax(0, 1fr) auto; }
    .sess-row .av { display: none; }

    .pt-tabs { width: auto; margin-inline: -.9rem; border-radius: 0; border-inline: 0; padding-inline: .9rem; }

    /* Tabela vira lista de cartões no celular */
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tfoot { display: block; width: 100%; }
    .table-cards tbody tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: var(--r-md);
        margin: 0 0 .6rem;
        padding: .35rem 0;
        background: var(--surface);
    }
    .table-wrap .table-cards tbody tr, .card .table-cards tbody tr { margin: .6rem; }
    .table-cards tbody tr:hover > * { background: transparent; }
    .table-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        border: 0;
        padding: .35rem .85rem;
        min-height: 32px;
        text-align: right;
    }
    .table-cards tbody td::before {
        content: attr(data-label);
        font: 500 .6875rem var(--font-mono);
        text-transform: uppercase;
        letter-spacing: .07em;
        color: var(--text-muted);
        flex-shrink: 0;
        text-align: left;
    }
    .table-cards tbody td[data-label=""]::before, .table-cards tbody td:not([data-label])::before { content: none; }
    .table-cards tbody td.cell-main { display: block; padding-top: .55rem; font-weight: 600; text-align: left; }
    .table-cards tbody td.cell-main::before { content: none; }
    .table-cards tbody td[colspan] { display: block; text-align: center; }
    .table-cards tfoot tr { display: flex; justify-content: space-between; padding: .2rem .85rem; }
    .table-cards tfoot td { border: 0; padding: .25rem 0; }
    .table-cards tfoot td:empty { display: none; }

    .modal-footer .btn { flex: 1; }

    /* Os modais do Bootstrap viram folha que sobe */
    .modal-dialog, .modal-dialog-centered {
        position: fixed; left: 0; right: 0; bottom: 0;
        margin: 0; max-width: none; min-height: 0; align-items: flex-end;
    }
    .modal-content {
        border-radius: var(--r-xl) var(--r-xl) 0 0;
        border-bottom: 0;
        max-height: 92dvh;
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .modal-content::before {
        content: ''; display: block; width: 36px; height: 4px; border-radius: 4px;
        background: var(--border-strong); margin: 9px auto 0;
    }
    .modal-footer { border-radius: 0; }
    .modal.fade .modal-dialog { transform: translateY(100%); transition: transform var(--slow) var(--spring); }
    .modal.show .modal-dialog { transform: none; }

    /* Agenda: a grade de sete colunas vira lista por dia. */
    .cal-grid { grid-template-columns: minmax(0, 1fr); }
    .cal-weekday { display: none; }
    .cal-day { min-height: 0; padding: .6rem .75rem; }
    .cal-day.today .cal-daynum { width: auto; height: auto; padding: .15rem .55rem; display: inline-block; }
    .cal-event { white-space: normal; font-size: .8125rem; padding: .45rem .6rem; min-height: 44px; }
}

/* Toque: alvos de 44px (quem atende está em pé, entre uma sessão e outra). */
@media (pointer: coarse), (max-width: 767.98px) {
    .btn, .form-select, .form-control:not(textarea), .page-link { min-height: 44px; }
    .btn-sm { min-height: 44px; }
    .icon-btn { width: 44px; height: 44px; }
    .form-check:not(.form-switch) .form-check-input { width: 1.3em; height: 1.3em; }
    .form-check { min-height: 44px; display: flex; align-items: center; gap: .5rem; padding-left: 0; }
    .form-check .form-check-input { margin: 0; flex-shrink: 0; float: none; }
    .form-switch { padding-left: 0; }
    .dropdown-item { min-height: 44px; }
    .nav-pills .nav-link, .nav-tabs .nav-link, .segmented a, .segmented button { min-height: 44px; }
    .pt-tabs button { min-height: 44px; }
    a.list-row, .li-row { min-height: 48px; }
}

@media (hover: none) {
    .card-hover:hover { box-shadow: none; transform: none; }
}

/* ---------- 27. Acessibilidade: movimento reduzido desliga tudo ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
    @view-transition { navigation: none; }
}

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* ---------- 28. Impressão (recibo, documento, PDF) ---------- */
@media print {
    .app-sidebar, .app-topbar, .mobile-nav, .no-print, .page-head-actions, .support-banner, .demo-banner, .toast-stack { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .app-content { padding: 0 !important; }
    body { background: #fff; color: #000; font-size: 11pt; padding: 0 !important; }
    .card { border: 1px solid #ddd !important; box-shadow: none !important; break-inside: avoid; }
    .print-only { display: block !important; }
    a { color: #000; text-decoration: none; }
    .table-app > tbody > tr, .stagger > *, .list-anim > * { animation: none !important; }
    @page { margin: 14mm; }
}
.print-only { display: none; }

/* ---------- 29. Guia da demonstração (partials/demo-guide) ---------- */
.demo-guide {
    display: grid; gap: 1rem; padding: 1.25rem;
    border-radius: var(--r-lg); background: var(--brand-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 22%, transparent);
    animation: demoGuideIn .5s var(--spring) backwards;
}
.demo-guide[hidden] { display: none; }
.demo-guide-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.demo-guide-tag { font: 500 .75rem/1rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--brand-text); }
.demo-guide-t { font: 500 1.875rem/2.25rem var(--font-display); letter-spacing: -.01em; margin: .25rem 0; text-wrap: balance; }
.demo-guide-p { margin: 0; color: var(--text-muted); max-width: 64ch; text-wrap: pretty; }
.demo-guide-close { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-muted); }
.demo-guide-close:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--text); }
.demo-guide-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.demo-guide-steps li { display: flex; gap: .75rem; align-items: center; }
.demo-guide-steps li > span:last-child { display: grid; }
.demo-guide-steps small { color: var(--text-muted); }
.demo-guide-n { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font: 500 .875rem/1 var(--font-mono); }
.demo-guide-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.demo-guide-actions .btn-link { color: var(--brand-text); }
@media (max-width: 767.98px) {
    .demo-guide-actions > .btn-primary { flex: 1 1 100%; }
    .demo-guide-actions > .btn-outline-secondary { flex: 1 1 0; white-space: nowrap; }
}
@media (min-width: 768px) { .demo-guide { padding: 1.5rem; } .demo-guide-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@keyframes demoGuideIn { from { opacity: 0; transform: translateY(12px); } }

/* ===================================================================
   30. Plataforma (/admin): topo com abas, sem barra lateral de consultório
   =================================================================== */
.platform-top { padding: 0 1rem; gap: .75rem; }
.platform-mark { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; font: 500 1.4rem/1 var(--font-display); white-space: nowrap; color: var(--text); }
.platform-mark .brand-mark { width: 30px; height: 30px; }
.platform-mark .brand-mark .ico { width: 16px; height: 16px; }
.platform-nav { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.platform-nav::-webkit-scrollbar { display: none; }
.platform-nav a {
    display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; padding: 0 .75rem;
    border-radius: 10px; color: var(--text-muted); text-decoration: none; font-size: .875rem; white-space: nowrap;
}
.platform-nav a:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.platform-nav a.active { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.platform-main { padding: 1.4rem 1rem 2.5rem; }
.kv-row { display: flex; justify-content: space-between; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .875rem; }
.kv-row:last-child { border-bottom: 0; }
.kv-row > span:first-child { color: var(--text-muted); }
.kv-row > :last-child { font-family: var(--font-mono); font-size: .8125rem; text-align: right; overflow-wrap: anywhere; min-width: 0; }
/* No celular as abas descem para uma segunda linha que rola, com o nome de
   cada uma (ícone sozinho não diz para onde vai). */
@media (max-width: 991.98px) {
    .platform-top { height: auto; flex-wrap: wrap; padding: .5rem .75rem .35rem; row-gap: .25rem; }
    .platform-top .platform-nav { order: 3; width: 100%; margin-inline: -.25rem; }
    .platform-nav a { min-height: 44px; }
    .platform-main { padding-bottom: 1.5rem; }
}

/* ===================================================================
   31. Assinatura do sistema: "Meu plano" (consultório) e cobrança no /admin.
   Não confundir com o Financeiro (recebimentos dos pacientes).
   =================================================================== */
.plan-hero { background: linear-gradient(160deg, var(--brand-soft), var(--surface) 55%); }
.plan-hero-name { font: 500 2.1rem/1.05 var(--font-display); letter-spacing: -.01em; margin: .3rem 0 .4rem; }
.plan-price { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.plan-meters { display: grid; gap: .75rem; }
@media (min-width: 768px) { .plan-meters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; } }
@media (min-width: 1200px) { .plan-meters { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.plan-grid { display: grid; gap: .75rem; }
@media (min-width: 768px) { .plan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.plan-card {
    display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
    transition: border-color var(--fast) var(--ease);
}
.plan-card:hover { border-color: var(--border-strong); }
.plan-card.current { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.plan-card.chosen { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.plan-card-name { font: 500 1.6rem/1.1 var(--font-display); margin: 0; }
.plan-card-price strong { font-family: var(--font-mono); font-weight: 500; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.plan-card-price span { color: var(--text-muted); font-size: .8125rem; }
.plan-feats { list-style: none; padding: 0; margin: 0 0 .75rem; display: grid; gap: .3rem; font-size: .875rem; flex: 1; }
.plan-feats li { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.plan-feats .bi-check2 { color: var(--ok); }
.plan-feats li.off { color: var(--text-muted); }
.plan-feats li.off .bi-x { color: var(--text-faint); }
.plan-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; padding: .75rem .9rem; border-radius: 12px; background: var(--bg-subtle); }
.pix-box { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
@media (min-width: 576px) { .pix-box { flex-direction: row; align-items: flex-start; } }
.pix-qr { width: 200px; height: 200px; padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--border); image-rendering: pixelated; flex-shrink: 0; }
.plan-pay .choices .choice, .plan-checkout .choices .choice { flex: 1 1 0; }
.billing-notice { display: flex; align-items: flex-start; gap: .6rem; }
.billing-notice .btn { margin-left: auto; flex-shrink: 0; }
@media (max-width: 575.98px) { .billing-notice { flex-wrap: wrap; } .billing-notice .btn { margin-left: 0; width: 100%; } }
.admin-filters { display: flex; flex-direction: row; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.admin-filters > * { flex: 1 1 140px; min-width: 0; }
.admin-filters .form-control, .admin-filters .form-select { min-width: 0; }
.admin-filters > .btn { flex: 0 0 auto; }
td.mono { white-space: nowrap; }

.pill .ico, .seal-badge .ico { width: 13px; height: 13px; vertical-align: -2px; }
/* Abas da ficha no celular: rolam de lado com a borda esmaecida (há mais à
   direita), sem a contagem, que fica no computador. */
@media (max-width: 767.98px) {
    .pt-tabs { margin-inline: -.9rem; padding: 4px .45rem; border-radius: 0; border-inline: 0; width: auto; gap: 2px; justify-content: space-between; }
    .pt-tabs button { padding: 0 .5rem; font-size: .8125rem; flex: 0 0 auto; }
    .pt-tabs .count { display: none; }
}
@media (max-width: 575.98px) {
    .li-row { flex-wrap: wrap; }
    .li-row > span.d-flex { width: 100%; justify-content: flex-end; }
}

/* ===================================================================
   32. Entrada (login, /entrar, escolha, cadastro, senha, /admin/login)
   =================================================================== */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); }
.auth-side {
    display: none; flex-direction: column; justify-content: space-between; gap: 2rem;
    padding: 2.5rem 3rem;
    background: linear-gradient(160deg, var(--brand-soft), var(--bg) 70%);
    border-right: 1px solid var(--border);
}
.auth-side .brand-mark { width: 36px; height: 36px; }
.auth-brand { font: 500 1.6rem/1 var(--font-display); }
.auth-side h2 { font-size: clamp(2.4rem, 3.4vw, 3.25rem); line-height: 1.04; max-width: 14ch; margin: 0 0 1rem; }
.auth-side p { color: var(--text-muted); max-width: 44ch; font-size: 1.0625rem; }
.auth-features { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: 1rem; max-width: 46ch; }
.auth-features li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: .75rem; }
.auth-features .ico { width: 20px; height: 20px; color: var(--brand-text); margin-top: 2px; }
.auth-features b { display: block; font-weight: 600; }
.auth-features span { color: var(--text-muted); font-size: .875rem; }
.auth-main { display: grid; place-items: center; padding: 2rem 1.1rem; }
.auth-card { width: 100%; max-width: 420px; animation: fadeUp .4s var(--ease-out) both; }
.auth-card h1, .auth-card .h5 { font: 500 2rem/1.1 var(--font-display) !important; letter-spacing: -.015em; margin-bottom: .4rem !important; }
.auth-logo {
    width: 52px; height: 52px; border-radius: 50%;
    display: grid; place-items: center; margin: 0 auto 1rem;
    background: var(--brand); color: var(--brand-ink);
    font-weight: 600; font-size: 1.25rem;
}
.auth-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.auth-card > form > .card, .auth-card .card { border-radius: var(--r-lg); }
@media (min-width: 992px) {
    .auth-wrap { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
    .auth-side { display: flex; }
}
.auth-logo .ico { width: 24px; height: 24px; stroke-width: 2; vertical-align: 0; }

/* Selos do Bootstrap (o /admin e algumas telas usam text-bg-*) nos tons calmos. */
.badge.text-bg-success { background: var(--ok-bg) !important; color: var(--ok) !important; }
.badge.text-bg-info, .badge.text-bg-primary { background: var(--brand-soft) !important; color: var(--brand-text) !important; }
.badge.text-bg-warning { background: var(--warn-bg) !important; color: var(--warn) !important; }
.badge.text-bg-danger { background: var(--bad-bg) !important; color: var(--bad) !important; }
.badge.text-bg-secondary, .badge.text-bg-light, .badge.text-bg-dark { background: var(--neutral-bg) !important; color: var(--text-muted) !important; }
.badge { border-radius: 99px; padding: .3em .65em; font-weight: 600; }
/* Na lista de cartões, o valor longo (detalhe técnico) quebra em vez de alargar. */
@media (max-width: 767.98px) {
    .table-cards tbody td { overflow-wrap: anywhere; }
    .table-cards tbody td.text-nowrap, .table-cards tbody td.mono { white-space: normal; }
}
/* Páginas públicas do consultório (convite da sessão, avisos) */
.public-head { background: color-mix(in srgb, var(--bg) 86%, transparent); border-bottom: 1px solid var(--border); padding: .8rem 0; }
.public-head .brand-mark { width: 32px; height: 32px; }
.public-head .brand-mark .ico { width: 17px; height: 17px; }
.public-name { font: 500 1.4rem/1 var(--font-display); }
.public-wrap { max-width: 720px; margin-inline: auto; padding: 0 1rem; }
/* Texto só para leitor de tela (position: absolute) dentro de tabela que rola
   tem de ficar preso a ela: sem ancestral posicionado, alargava a página. */
.table-responsive { position: relative; }


/* ===================================================================
   33. Nutrição — peças que só este nicho tem
   =================================================================== */
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -9px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }
.kanban-col-head {
    display: flex; align-items: center; gap: .5rem; padding: .7rem .85rem;
    font: 500 .6875rem/1.2 var(--font-mono); text-transform: uppercase; letter-spacing: .07em;
    color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.offcanvas-header { border-bottom: 1px solid var(--border); }

/* Fotos de evolução e do diário */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .65rem; }
.photo-tile { position: relative; aspect-ratio: 4/3; border-radius: var(--r-sm); overflow: hidden; background: var(--bg-subtle); border: 1px solid var(--border); margin: 0; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--slow) var(--ease-out); }
.photo-tile:hover img { transform: scale(1.04); }
.photo-tile figcaption { position: absolute; inset: auto 0 0 0; padding: .8rem .55rem .4rem; font-size: .72rem; color: #fff; background: linear-gradient(transparent, rgb(0 0 0 / .78)); }
@media (max-width: 767.98px) { .photo-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); } }

/* Macros: a mesma cor em toda tela (ponto, barra, anel). */
.dotm { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; vertical-align: 0; }
.dotm.pro, .bg-pro { background: var(--pro); }
.dotm.carb, .bg-carb { background: var(--carb); }
.dotm.fat, .bg-fat { background: var(--fat); }
.mac-chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .8125rem; color: var(--text-muted); white-space: nowrap; }
.mac-chip b { font: 500 .8125rem/1 var(--font-mono); color: var(--text); }
.mac-bars { display: inline-flex; gap: 3px; align-items: flex-end; height: 22px; }
.mac-bars i { width: 4px; border-radius: 2px; display: block; }
.mac-bars i:nth-child(1) { background: var(--pro); }
.mac-bars i:nth-child(2) { background: var(--carb); }
.mac-bars i:nth-child(3) { background: var(--fat); }
.meter .m-pro { background: var(--pro); }
.meter .m-carb { background: var(--carb); }
.meter .m-fat { background: var(--fat); }

/* ===================================================================
   34. Hoje — a próxima paciente, as consultas do dia e quem voltar
   =================================================================== */
.today-stack { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.today-head h1 { font-size: 2rem; }
.next-card .meta { display: block; margin-top: .1rem; }
.next-stats { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: .7rem 0 0; }
.next-stats div { display: grid; gap: 0; }
.next-stats dt { font-size: .6875rem; font-weight: 500; color: var(--text-muted); }
.next-stats dd { margin: 0; font: 500 .9375rem/1.3 var(--font-mono); }
.down, .next-stats dd.down { color: var(--ok); }

.day-list { display: grid; grid-template-columns: minmax(0, 1fr); }
.day-row {
    display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: .65rem; align-items: center;
    padding: .65rem .35rem; margin-inline: -.35rem; border-top: 1px solid var(--border);
    color: inherit; font-size: .875rem; min-height: 52px; border-radius: 8px;
    transition: background var(--fast) var(--ease);
}
.day-row:first-child { border-top: 0; }
.day-row:hover { background: var(--surface-2); text-decoration: none; color: inherit; }
.day-row time { font: 500 .78rem/1 var(--font-mono); color: var(--text-muted); }
.day-row b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-row small { display: block; font-size: .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Atendida fica apagada por cor (não por opacity: a pílula também apagaria). */
.day-row.is-done b, .day-row.is-done time { color: var(--text-muted); font-weight: 500; }

.li-link { color: inherit; display: block; }
.li-link:hover { color: var(--brand-text); text-decoration: none; }
.call { white-space: nowrap; flex-shrink: 0; }
.call .ico { width: 15px; height: 15px; }
.money-line { margin: 0; display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.money-line strong { font-size: 1.375rem; font-weight: 500; color: var(--bad); }
.money-line span { font-size: .8125rem; color: var(--text-muted); }
@media (pointer: coarse), (max-width: 767.98px) {
    /* Trilha e links no subtítulo: a área de toque cresce para 44px pelo
       preenchimento (inline não empurra a linha). */
    .breadcrumb-mini a, .page-head .subtitle a { padding-block: .8rem; }
    .table-cards td.cell-main > a { display: inline-block; padding-block: .75rem; margin-block: -.75rem; }
    /* "Agenda →", "Planos →": o alvo cresce para 44px sem empurrar o título. */
    .panel-head a { display: inline-flex; align-items: center; min-height: 44px; margin-block: -12px; }
}
@media (max-width: 767.98px) {
    .today-head h1 { font-size: 1.875rem; }
    .next-card { padding: 1rem; gap: .9rem; }
    .next-when { font-size: 2.2rem; }
}

/* ===================================================================
   35. Montador de plano — refeições à esquerda, total do dia fixo
   =================================================================== */
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.meals { display: grid; gap: .9rem; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.meal { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.meal > header { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem .45rem .9rem; background: var(--bg-subtle); border-bottom: 1px solid var(--border); min-height: 48px; }
.meal > header h2 { font: 500 1.0625rem/1.2 var(--font-display); font-variation-settings: "SOFT" 100; margin: 0; letter-spacing: -.01em; }
.meal > header .num { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.meal > header .icon-btn { width: 36px; height: 36px; }
.meal-empty { margin: 0; padding: .75rem .9rem; font-size: .8125rem; color: var(--text-muted); }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: .75rem; align-items: center; padding: .5rem .5rem .5rem .9rem; border-top: 1px solid var(--border); font-size: .875rem; }
.meal > header + .item, .meal-empty + .item { border-top: 0; }
.item-name { display: block; font-weight: 500; }
.item small { display: block; font-size: .75rem; color: var(--text-muted); }
.item .k { font: 500 .8125rem/1 var(--font-mono); color: var(--text-muted); white-space: nowrap; }
.item .icon-btn { width: 36px; height: 36px; }
.item.is-new { animation: slidein .35s var(--spring); background: color-mix(in srgb, var(--brand) 6%, var(--surface)); transition: background 1.6s var(--ease) .6s; }
@keyframes slidein { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.swaps-d summary { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--brand-text); cursor: pointer; list-style: none; min-height: 28px; }
.swaps-d summary::-webkit-details-marker { display: none; }
.swaps-d summary .ico { width: 13px; height: 13px; }
.swaps-d[open] summary { color: var(--text-muted); }
.swaps { list-style: none; margin: .2rem 0 0; padding: 0 0 0 .6rem; border-left: 2px solid var(--border); display: grid; gap: .1rem; }
.swaps li { display: flex; align-items: center; justify-content: space-between; gap: .4rem; font-size: .78rem; color: var(--text); }
.swaps li .ico { width: 13px; height: 13px; color: var(--text-faint); margin-right: .3rem; vertical-align: -2px; }
.swap-x { border: 0; background: transparent; color: var(--text-faint); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; flex: none; }
.swap-x:hover { background: var(--surface-hover); color: var(--bad); }
.swap-x .ico { width: 14px; height: 14px; }

/* "Buscar alimento…" (computador) / "+ Adicionar alimento" (celular): o mesmo botão. */
.addbtn { display: block; width: 100%; border: 0; border-top: 1px dashed var(--border-strong); background: transparent; padding: .6rem .9rem; text-align: left; color: var(--text-muted); }
.addbtn-search { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border: 1px solid var(--border-strong); border-radius: 11px; background: var(--bg); font-size: .875rem; }
.addbtn-search kbd { margin-left: auto; font: 500 .6875rem/1 var(--font-mono); padding: .2rem .4rem; border: 1px solid var(--border); border-radius: 5px; background: transparent; color: var(--text-muted); }
.addbtn:hover .addbtn-search { border-color: var(--brand); color: var(--text); }
.addbtn-plus { display: none; }
.meal-new > header { background: transparent; }
.meal-new-form { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: .5rem; padding: .75rem .9rem; }

.total { min-width: 0; }
.total-sticky { position: sticky; top: calc(var(--topbar-h) + 1rem); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 1.1rem; display: grid; gap: .85rem; grid-template-columns: minmax(0, 1fr); max-height: calc(100vh - var(--topbar-h) - 2rem); overflow-y: auto; scrollbar-width: thin; }
.ringwrap { display: grid; justify-items: center; position: relative; }
.kcal-ring { width: 170px; height: 170px; }
.kcal-ring circle { fill: none; stroke-width: 12; }
.kcal-ring .bg { stroke: var(--bg-subtle); }
.kcal-ring .seg { animation: ringIn .7s var(--ease-out) both; }
.kcal-ring .seg.pro { stroke: var(--pro); }
.kcal-ring .seg.carb { stroke: var(--carb); }
.kcal-ring .seg.fat { stroke: var(--fat); }
@keyframes ringIn { from { stroke-dasharray: 0 440; } }
.ringc { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.ringc strong { display: block; font: 500 1.75rem/1.1 var(--font-mono); letter-spacing: -.02em; }
.ringc small { font-size: .75rem; color: var(--text-muted); }
.macros { display: grid; gap: .65rem; }
.macro { display: grid; gap: .3rem; }
.macro .top { display: flex; justify-content: space-between; gap: .5rem; font-size: .8125rem; }
.macro .meter { height: 7px; }
.gap { margin: 0; font-size: .8125rem; padding: .6rem .75rem; border-radius: 12px; background: var(--bg-subtle); color: var(--text-muted); font-weight: 600; }
.gap.warn { background: var(--warn-bg); color: var(--warn); }
.gap.bad { background: var(--bad-bg); color: var(--bad); }
.gap.ok { background: var(--ok-bg); color: var(--ok); }
.hint { font-size: .78rem; color: var(--text-muted); margin: 0; }
.hint b { font-weight: 500; color: var(--text); }
.plan-settings { border-top: 1px solid var(--border); padding-top: .65rem; }
.plan-settings summary { cursor: pointer; font-weight: 600; font-size: .875rem; min-height: 44px; display: flex; align-items: center; list-style: none; }
.plan-settings summary::-webkit-details-marker { display: none; }
.plan-settings summary::after { content: '▾'; margin-left: auto; color: var(--text-muted); transition: transform var(--fast) var(--ease); }
.plan-settings[open] summary::after { transform: rotate(180deg); }
.plan-more { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--border); }

/* Total preso acima da barra inferior (só no celular) */
.minitotal { display: none; }

/* A folha de adicionar alimento */
.add-food .foods { display: grid; gap: 6px; max-height: 38dvh; overflow-y: auto; overscroll-behavior: contain; }
.add-food .foods:empty { display: none; }
.food { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; align-items: center; width: 100%; padding: .6rem .75rem; min-height: 52px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); text-align: left; }
.food:hover, .food[aria-selected="true"] { border-color: var(--brand); background: var(--brand-soft); }
.food-name { display: block; font-size: .875rem; font-weight: 500; }
.food small { display: block; font: 400 .72rem/1.3 var(--font-mono); color: var(--text-muted); }
.food .k { font-size: .72rem; color: var(--text-muted); white-space: nowrap; }
.medidas { display: flex; flex-wrap: wrap; gap: 6px; }
.medidas button { padding: .5rem .85rem; min-height: 44px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .8125rem; }
.medidas button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.qty-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.qty-row.only-grams > :first-child { display: none; }
.qty-row.only-grams { grid-template-columns: minmax(0, 1fr); }
.stepper { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 4px; align-items: center; }
.stepper .icon-btn { border: 1px solid var(--border-strong); width: 44px; height: 44px; }
.stepper .form-control { min-height: 44px; }
.add-preview { margin: 0; font-size: .8125rem; color: var(--text-muted); }
.add-food .sheet-head small b { color: var(--text); font-weight: 600; }
.add-food .form-switch { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding-left: 0; }
.add-food .form-switch .form-check-input { margin: 0; float: none; }
@media (min-width: 768px) {
    .add-food { width: min(560px, calc(100vw - 2rem)); }
}

@media (max-width: 1199.98px) {
    .builder { grid-template-columns: minmax(0, 1fr); }
    .total-sticky { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 767.98px) {
    .item { grid-template-columns: minmax(0, 1fr) auto auto; gap: .5rem; padding-left: .75rem; }
    .item .mac-bars { display: none; }
    .item .icon-btn, .meal > header .icon-btn { width: 44px; height: 44px; }
    .swap-x { width: 44px; height: 44px; }
    .swaps-d summary { min-height: 44px; }
    .addbtn { padding: 0; }
    .addbtn-search { display: none; }
    .addbtn-plus { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; font-weight: 600; font-size: .875rem; color: var(--brand-text); }
    .meal-new-form { grid-template-columns: minmax(0, 1fr) 110px; }
    .meal-new-form .btn { grid-column: 1 / -1; }
    /* O total fica preso acima da barra inferior: o desvio da meta é o produto. */
    .minitotal {
        display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 10px; align-items: center;
        position: fixed; left: .75rem; right: .75rem; bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom)); z-index: 1034;
        padding: .6rem .8rem; border-radius: 14px; background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-md);
        min-height: 52px;
    }
    .minitotal:hover { color: var(--brand-ink); text-decoration: none; }
    .minitotal strong { font: 500 1.15rem/1 var(--font-mono); grid-row: span 2; }
    .minitotal .mm { display: flex; height: 5px; border-radius: 99px; overflow: hidden; background: rgb(255 255 255 / .25); }
    .minitotal .mm i { display: block; height: 100%; }
    .minitotal .m-pro { background: #ffb4a3; } .minitotal .m-carb { background: #ffd77a; } .minitotal .m-fat { background: #cfe59a; }
    .minitotal small { font-size: .72rem; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    body:has(.minitotal) .app-content { padding-bottom: 5.5rem; }
    body:has(.minitotal) .toast-stack { bottom: calc(var(--tabbar-h) + 76px + env(safe-area-inset-bottom)); }
}

/* ===================================================================
   36. Evolução — gráfico SVG do servidor e a comparação de duas datas
   =================================================================== */
.evo { display: grid; grid-template-columns: minmax(0, 1fr) 290px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.evo-main { padding: 1.1rem 1.25rem; display: grid; gap: .75rem; min-width: 0; align-content: start; }
.evo-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; }
.evo-head h2 { font: 500 1.375rem/1.15 var(--font-display); margin: 0; }
.chartwrap { overflow-x: auto; scrollbar-width: thin; }
.chart { width: 100%; height: auto; display: block; }
/* Dois desenhos do mesmo gráfico (EvolutionChart): o largo e o do celular. */
.chart-narrow { display: none; }
.chart text { font: 500 11px var(--font-mono); fill: var(--text-faint); }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .band.b25 { fill: var(--warn-bg); opacity: .75; }
[data-bs-theme="dark"] .chart .band.b25 { opacity: .5; }
[data-bs-theme="dark"] .chart .band.b30 { opacity: .4; }
.chart .band.b30 { fill: var(--bad-bg); opacity: .6; }
.chart .band-t { fill: var(--warn); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawl 1s .15s cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes drawl { to { stroke-dashoffset: 0; } }
.chart .goal { stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 5 5; }
.chart .goal-t { fill: var(--ok); }
.chart .year { fill: var(--text-faint); font-size: 10px; }
.chart .pc { fill: var(--brand); stroke: var(--surface); stroke-width: 2; transition: r var(--fast) var(--ease); }
.chart .pc.sel { fill: var(--carb); }
.chart .ph { fill: var(--surface); stroke: var(--brand); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart a.pt { cursor: pointer; }
.chart a.pt:hover .pc, .chart a.pt:focus-visible .pc { r: 9; }
.chart a.pt:focus-visible { outline: none; }
.chart a.pt:focus-visible .hit { stroke: var(--brand); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .78rem; color: var(--text-muted); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.lg-pc { fill: var(--brand); }
.lg-ph { fill: var(--surface); stroke: var(--brand); stroke-width: 2; }
.lg-goal { stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 4 4; }
.lg-b25 { fill: var(--warn-bg); }
.cmp { border-left: 1px solid var(--border); padding: 1.1rem 1.15rem; display: grid; gap: .7rem; align-content: start; background: var(--surface-2); min-width: 0; scroll-margin-top: calc(var(--topbar-h) + 12px); }
.cmp h3 { font: 600 1rem/1.3 var(--font-sans); margin: 0; }
.cmp .dates { font: 500 .8125rem/1 var(--font-mono); color: var(--brand-text); }
.cmp dl { margin: 0; display: grid; }
.cmp dl div { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .5rem 0; border-top: 1px solid var(--border); font-size: .875rem; }
.cmp dl div:first-child { border-top: 0; }
.cmp dt { font-weight: 500; }
.cmp dd { margin: 0; font-size: .875rem; text-align: right; }
.delta { color: var(--text-muted); }
.delta.ok { color: var(--ok); }
.delta.bad { color: var(--bad); }
.cmp-form { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .4rem; align-items: center; }
.cmp-form .btn { grid-column: 1 / -1; }
.cmp-form .form-select { font-size: .8125rem; padding-left: .6rem; }
@media (max-width: 991.98px) {
    .evo { grid-template-columns: minmax(0, 1fr); }
    .cmp { border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 767.98px) {
    .evo-main { padding: .9rem; }
    /* No celular entra o desenho de 360 × 282, na proporção da tela: cabe
       inteiro (sem rolar de lado), com texto de ~11 px e toque de 44 px nos
       pontos. Os seletores de data fazem o mesmo que tocar nos pontos. */
    .chart-wide { display: none; }
    .chart-narrow { display: block; }
    .chart-narrow text { font-size: 12px; }
    .chart-narrow .year { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .chart .line { stroke-dashoffset: 0; animation: none; } }

/* ===================================================================
   37. Avaliação ao vivo — dobras grandes e o resultado fixo embaixo
   =================================================================== */
.folds { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
.fold { display: grid; gap: 2px; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), opacity var(--fast) var(--ease); }
.fold label { font-size: .75rem; color: var(--text-muted); font-weight: 600; margin: 0; }
.fold input { font: 500 1.25rem/1.2 var(--font-mono); color: var(--text); background: transparent; border: 0; padding: 0; width: 100%; min-height: 32px; font-variant-numeric: tabular-nums; }
.fold input:focus { outline: none; }
.fold input::placeholder { color: var(--text-faint); }
.fold span { font-size: .6875rem; color: var(--text-faint); }
.fold:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .16); }
.fold.opacity-50 { opacity: .55; }
.fold.flash { animation: foldFlash .5s ease; }
@keyframes foldFlash { 50% { border-color: var(--carb); box-shadow: 0 0 0 3px var(--carb-soft); } }
.res-kcal { font: 500 2.25rem/1 var(--font-mono); color: var(--brand-text); letter-spacing: -.02em; }
.res-kcal span { font: 400 1rem var(--font-sans); color: var(--text-muted); }
.resbar { display: none; }
.fade-in { animation: fadev .3s ease; }
@keyframes fadev { from { opacity: .2; } to { opacity: 1; } }
@media (max-width: 767.98px) {
    .folds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fold { padding-block: .4rem .45rem; }
    .fold input { min-height: 44px; }
    .resbar {
        display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 6px;
        position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 1034;
        padding: .55rem .9rem .5rem;
        background: color-mix(in srgb, var(--surface) 90%, transparent);
        backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
        border-top: 1px solid var(--border);
    }
    .resbar div { display: grid; justify-items: center; }
    .resbar small { font-size: .625rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
    .resbar strong { font: 500 1.125rem/1.2 var(--font-mono); }
    .resbar .formula { grid-column: 1 / -1; text-align: center; font-size: .6875rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    body:has(.resbar) .app-content { padding-bottom: 6rem; }
    body:has(.resbar) .toast-stack { bottom: calc(var(--tabbar-h) + 84px + env(safe-area-inset-bottom)); }
}
@media (pointer: coarse), (max-width: 767.98px) { [data-calc-result] summary { min-height: 44px; display: flex; align-items: center; } }

/* ===================================================================
   38. Portal do paciente e plano pelo link — o plano como se lê
   =================================================================== */
.portal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.portal-side { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); position: sticky; top: calc(var(--topbar-h) + 1rem); }
.portal-plan-name { margin: 0 0 .6rem; font-size: .875rem; color: var(--text-muted); }
.portal-plan-name b { color: var(--text); font-weight: 600; }
.pmeals { display: grid; gap: .65rem; grid-template-columns: minmax(0, 1fr); }
.pm { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: .75rem .9rem; display: grid; gap: .4rem; }
.pm-h { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.pm-h h2 { font: 500 1.125rem/1.2 var(--font-display); margin: 0; }
.pm-h .num { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.pm-items { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.pm-row { display: flex; justify-content: space-between; gap: .75rem; font-size: .875rem; padding: .2rem 0; }
.pm-qt { color: var(--text-muted); font-size: .8125rem; text-align: right; }
.pm-swap summary { display: inline-flex; align-items: center; gap: .3rem; font-size: .8125rem; font-weight: 600; color: var(--brand-text); cursor: pointer; list-style: none; min-height: 32px; }
.pm-swap summary::-webkit-details-marker { display: none; }
.pm-swap[open] summary span { transform: rotate(180deg); }
.pm-swap summary span { transition: transform var(--fast) var(--ease); }
.drawer { display: grid; gap: .25rem; padding: .55rem .7rem; border-radius: 12px; background: var(--bg-subtle); font-size: .8125rem; animation: fadeUp .3s var(--ease-out); margin-bottom: .25rem; }
.drawer div { display: flex; justify-content: space-between; gap: .75rem; }
.drawer .num { color: var(--text-muted); font-size: .78rem; text-align: right; }
.drawer p { margin: .15rem 0 0; color: var(--text-muted); font-size: .75rem; }
.pm-note { margin: 0; font-size: .78rem; color: var(--text-muted); font-style: italic; }
.day-total { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: .9rem 1rem; display: grid; gap: .55rem; }
.dt-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.dt-top strong { font: 500 1.5rem/1 var(--font-mono); }
.dt-top small { font: 400 .8125rem var(--font-sans); color: var(--text-muted); }
.dt-bar { height: 8px; }
.dt-macros { display: flex; flex-wrap: wrap; gap: .3rem .9rem; }
.install-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .75rem .9rem; border-radius: 16px; background: var(--brand-soft); margin-bottom: 1rem; }
.install-card[hidden] { display: none; }
.install-card b { display: block; font-size: .875rem; }
.install-card small { display: block; font-size: .75rem; color: var(--text-muted); }
.public-plan { display: grid; gap: .75rem; }
.public-plan h1 { font-size: 1.875rem; }
@media (max-width: 991.98px) {
    .portal-grid { grid-template-columns: minmax(0, 1fr); }
    .portal-side { position: static; }
}
@media (max-width: 767.98px) {
    .pm-swap summary { min-height: 44px; }
}
/* Papel: os pontos dos macros saem na impressão (sem eles o total vira só texto). */
@media print { .dotm { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

.food-macros { display: flex; flex-wrap: wrap; gap: .1rem .7rem; margin-top: .3rem; }
.food-macros .mac-chip { font-size: .75rem; }
.choice:hover { text-decoration: none; color: var(--text); border-color: var(--border-strong); }
.choice.active:hover { color: var(--brand-text); border-color: var(--brand); }
@media (pointer: coarse), (max-width: 767.98px) { summary { min-height: 44px; padding-block: .6rem; } }

/* Abas da ficha: rolam de lado com a borda esmaecida enquanto há aba
   escondida (antes "Avaliações" e "Planos" saíam da tela sem indicação). */
[data-scroll-edge] { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
[data-scroll-edge].at-end { -webkit-mask-image: none; mask-image: none; }
@media (max-width: 767.98px) {
    .patient-tabs { margin-inline: -.9rem; border-radius: 0; border-inline: 0; width: auto; padding-inline: .45rem; }
    .patient-tabs .nav-link { padding-inline: .6rem; }
    .patient-tabs .nav-link > i.bi, .patient-tabs .badge-soft { display: none; }
}
@media (min-width: 768px) { .agenda-filters .form-select { width: auto; } }
@media (pointer: coarse), (max-width: 767.98px) {
    .app-footer a, footer a { padding-block: .9rem; }
    td a.d-block.fs-tiny { display: flex !important; align-items: center; min-height: 44px; }
}

/* ---------- Meu plano: mensal × anual ----------
   O seletor dos preços é de links (a tela recarrega com o valor do servidor);
   no formulário de assinar, cada ciclo é um rádio grande com o preço dentro. */
.cycle-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 99px; background: var(--bg-subtle); border: 1px solid var(--border); }
.cycle-switch a {
    display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: .3rem .95rem; border-radius: 99px;
    font-size: .85rem; font-weight: 600; color: var(--text-muted); text-decoration: none;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.cycle-switch a:hover { color: var(--text); text-decoration: none; }
.cycle-switch a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.cycle-badge {
    display: inline-block; font-size: .68rem; font-weight: 700; line-height: 1.4; padding: .1rem .5rem; border-radius: 99px;
    background: var(--ok-bg); color: var(--ok); white-space: nowrap; vertical-align: middle;
}
.cycle-options { display: grid; gap: .6rem; }
@media (min-width: 768px) { .cycle-options { grid-template-columns: 1fr 1fr; } }
.cycle-option {
    display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
    transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.cycle-option:hover { border-color: var(--border-strong); }
.cycle-option:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.cycle-option input { margin-top: .3rem; accent-color: var(--brand); width: 1.05rem; height: 1.05rem; flex-shrink: 0; }
.cycle-option input:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.cycle-option-body { flex: 1; min-width: 0; }
@media (prefers-reduced-motion: reduce) { .cycle-switch a, .cycle-option { transition: none; } }
.signup-choice { padding: .85rem 1rem; border: 1px solid var(--brand); border-radius: var(--r-md); background: var(--brand-soft); }

/* ---------- Aviso de cookies (views/partials/cookies.php) ----------
   Compacto (dono, 06/10/2026: no celular ocupava um terço da tela). No
   celular, uma faixa baixa presa à borda de baixo — ou colada em cima da barra
   inferior do app, como uma peça só —, com uma frase curta e os dois botões
   lado a lado (44 px). No desktop, um cartão pequeno no canto. Não cobre a
   página nem prende o foco. */
.cookie-note {
    position: fixed;
    z-index: 1080;
    left: 0; right: 0;
    bottom: 0;
    background: var(--surface);
    color: var(--text);
    border-top: 1px solid var(--border-strong);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    box-shadow: 0 -10px 30px -18px rgb(0 0 0 / .35);
    animation: cookieIn var(--slow) var(--ease-out) both;
}
.cookie-note.is-leaving { animation: cookieOut .2s var(--ease) forwards; }
.cookie-note-in { margin: 0 auto; max-width: 560px; padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom)); display: grid; gap: .5rem; }
.cookie-note-text { margin: 0; font-size: .8125rem; line-height: 1.45; color: var(--text-muted); }
.cookie-note-text a { color: var(--brand-text); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; white-space: nowrap; display: inline-block; padding: 2px 0; }
.cookie-note-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.cookie-btn {
    appearance: none; min-height: 44px; padding: .5rem .9rem; border-radius: 999px; cursor: pointer;
    font: 600 .875rem/1 var(--font-sans); border: 1px solid var(--border-strong); background: transparent; color: var(--text);
    transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.cookie-btn:hover { background: var(--surface-hover); }
.cookie-btn-main { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.cookie-btn-main:hover { background: var(--brand); filter: brightness(1.08); }
.cookie-btn:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
/* Instalador: um botão só. */
.cookie-note-actions:has(> :only-child) { grid-template-columns: 1fr; }
@keyframes cookieIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes cookieOut { to { opacity: 0; transform: translateY(14px); } }
@media (max-width: 767.98px) {
    /* Em cima da barra inferior do app, sem sombra entre as duas. */
    body:has(.mobile-nav) .cookie-note { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px -22px rgb(0 0 0 / .3); }
    body:has(.mobile-nav) .cookie-note-in { padding-bottom: .6rem; }
    /* O fim da página não fica atrás da faixa. */
    body:has(.cookie-note) { padding-bottom: calc(7.5rem + env(safe-area-inset-bottom)); }
    body:has(.mobile-nav):has(.cookie-note) { padding-bottom: calc(var(--tabbar-h) + 7.5rem + env(safe-area-inset-bottom)); }
}
@media (min-width: 768px) {
    .cookie-note { left: auto; right: 1.25rem; bottom: 1.25rem; width: 340px; border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
    .cookie-note-in { padding: .85rem; gap: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
    .cookie-note, .cookie-note.is-leaving { animation: none; }
}
@media print { .cookie-note { display: none !important; } }

/* Página "Privacidade e cookies" */
.privacy { max-width: 760px; }
.privacy h2 { font-size: 1.15rem; margin-top: 2rem; }
.privacy table { font-size: .9rem; }
.privacy .cookie-choice { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
/* No celular, cada linha vira um cartão (três colunas a 390 px não cabem). */
@media (max-width: 575.98px) {
    .privacy-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .privacy-table, .privacy-table tbody, .privacy-table tr, .privacy-table td { display: block; width: 100%; }
    .privacy-table tr { border: 1px solid var(--border); border-radius: var(--r-md); padding: .65rem .8rem; margin-bottom: .6rem; background: var(--surface); }
    .privacy-table td { border: 0; padding: .2rem 0; }
    .privacy-table td::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
}

/* ---------- WhatsApp (Configurações → WhatsApp, ficha, link da consulta) ----------
   Porte do dentista (barbearia e imobiliária). Celular primeiro: conexão e mensagens
   empilhadas; a partir de 992px, lado a lado. O QR fica num quadro branco nos
   dois temas (o celular lê melhor). */
.wa-grid { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 992px) { .wa-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.wa-number { display: flex; align-items: center; gap: .75rem; padding: .75rem; border-radius: var(--r-md); background: var(--bg-subtle); }
.wa-avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 1.25rem; background: #1f8f4e; color: #fff; }
.wa-avatar.off { background: var(--border); color: var(--text-muted); }
.wa-qr-box { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
@media (min-width: 576px) and (max-width: 991.98px) { .wa-qr-box { flex-direction: row; align-items: center; } }
.wa-qr { width: 240px; height: 240px; max-width: 100%; aspect-ratio: 1; padding: 10px; background: #fff; border-radius: 14px; border: 1px solid var(--border); image-rendering: pixelated; flex-shrink: 0; transition: opacity .2s ease; }
.wa-qr.is-fresh { animation: wa-fade .25s ease; }
.wa-qr-wait { display: grid; place-content: center; gap: .5rem; text-align: center; }
.wa-skel { display: block; width: 160px; height: 160px; }
.wa-steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; }
.wa-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wa-kpis .kpi { padding: .75rem .8rem; }
@media (max-width: 380px) { .wa-kpis .kpi-label { font-size: .6875rem; } }
.wa-consent { display: grid; gap: .4rem; padding: .75rem; border-radius: var(--r-md); border: 1px solid var(--border); }
.wa-bar { height: 6px; border-radius: 99px; background: var(--bg-subtle); overflow: hidden; }
.wa-bar span { display: block; height: 100%; border-radius: inherit; background: var(--ok); }
.wa-group { display: flex; align-items: center; gap: .4rem; margin: 1rem 0 0; font: 600 .8125rem/1.3 var(--font-sans); letter-spacing: .02em; text-transform: uppercase; color: var(--text-muted); }
.wa-msg { display: grid; gap: .5rem; padding: .85rem 0; border-top: 1px solid var(--border); }
.wa-group + .wa-msg, .wa-group + p + .wa-msg { border-top: 0; padding-top: .5rem; }
.wa-msg label[for^="on_"] { cursor: pointer; }
.wa-msg .form-switch .form-check-input { width: 2.6em; height: 1.4em; cursor: pointer; }
.wa-months { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.wa-months .form-control { width: 5rem; min-height: 40px; }
.wa-tpl summary, .wa-vars summary { cursor: pointer; color: var(--brand-text); min-height: 32px; display: inline-flex; align-items: center; }
.wa-tpl textarea { font-family: inherit; line-height: 1.5; }
.wa-tpl code, .wa-vars code { color: var(--brand-text); }
.wa-save { padding: .75rem 0 .25rem; background: linear-gradient(to bottom, transparent, var(--surface) 30%); }
/* No celular a barra de abas fica por cima do rodapé: o "Salvar" gruda logo acima dela. */
@media (max-width: 767.98px) { .wa-save { bottom: calc(var(--tabbar-h, 66px) + env(safe-area-inset-bottom)); } }
.wa-hist { display: grid; }
.wa-hist li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--border); min-height: 48px; }
.wa-hist li:first-child { border-top: 0; }
/* Ficha do paciente: o aceite e a saída das campanhas. */
.wa-patient { display: grid; gap: .6rem; }
.wa-patient .wa-state { display: flex; align-items: flex-start; gap: .6rem; }
.wa-patient .wa-state > i { font-size: 1.1rem; margin-top: .1rem; }
@keyframes wa-fade { from { opacity: .3; } to { opacity: 1; } }

/* Link da consulta (paciente): cartão estreito e o check desenhado quando acabou de confirmar. */
.consulta-card { max-width: 520px; }
.wa-check { display: block; width: 52px; height: 52px; margin: 0 auto .75rem; }
.wa-check svg { display: block; }
.wa-check circle { fill: var(--ok-bg); stroke: var(--ok); stroke-width: 2; }
.wa-check path { fill: none; stroke: var(--ok); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.wa-check.is-new path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: wa-draw .45s .1s ease-out forwards; }
@keyframes wa-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
    .wa-qr, .wa-qr.is-fresh { animation: none; transition: none; }
    .wa-check.is-new path { animation: none; stroke-dashoffset: 0; }
}

/* /admin/sistema, rotinas por estabelecimento: no desktop cabe no cartão sem rolar
   (colunas fixas, nome com o slug embaixo, erro quebrando a linha); no celular a
   table-cards já vira cartões. */
@media (min-width: 768px) {
    .table-rotinas { table-layout: fixed; width: 100%; }
    .table-rotinas th:first-child { width: 34%; }
    .table-rotinas th, .table-rotinas td { overflow-wrap: anywhere; padding-inline: .5rem; }
    .table-rotinas th { white-space: nowrap; }
    .table-rotinas .badge-soft { white-space: nowrap; }
}

/* Diário: resposta da nutricionista e "visto" (app do paciente, fase 6). */
.diary-reply { display: flex; gap: .5rem; align-items: flex-start; margin-top: .5rem; padding: .55rem .7rem;
    border-radius: 10px; background: var(--brand-soft); color: var(--text); }
.diary-reply > i { color: var(--brand-text); margin-top: .1rem; }
.diary-reply-form > summary { list-style: none; cursor: pointer; }
.diary-reply-form > summary::-webkit-details-marker { display: none; }
.diary-reply-form[open] { flex-basis: 100%; }
