/* =====================================================================
   Visual da clínica — proposta "Arcada", aprovada pelo dono em 05/10/2026
   (.claude/skills/visual-moderno/propostas/dentista-aprovada.html).

   Clínico e preciso: fundo cor de esmalte, verde-jade como padrão da marca
   e o vermelho e o azul guardados para o que importa no dente — cárie e
   restauração. Bricolage Grotesque nos títulos (firme, 600), Instrument
   Sans no texto e JetBrains Mono nos números, no FDI e nos valores, com
   tabular-nums. A cor da marca vem da clínica (Brand::cssRoot); o jade é
   só o padrão, e nunca vira cor de condição do dente.

   Bootstrap continua por baixo: as telas usam as classes dele, e é aqui
   que elas ganham a cara nova. Base portada do psicólogo (mesmo esqueleto).
   ===================================================================== */

/* ---------- 1. Fontes locais (OFL; a CSP é font-src 'self') ---------- */
/* Bricolage em instância 500–700 com o eixo óptico fixo (38 KB em vez de
   77 KB): é ela que pinta o título da tela no 4G. */
@font-face {
    font-family: 'Bricolage Grotesque';
    src: url('../fonts/bricolage-grotesque-500-700.woff2') format('woff2');
    font-weight: 500 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Instrument Sans';
    src: url('../fonts/instrument-sans-var.woff2') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/jetbrains-mono-400-600.woff2') format('woff2');
    font-weight: 400 600;
    font-style: normal;
    font-display: swap;
}

/* ---------- 2. Tokens ---------- */
:root {
    --font-display: 'Bricolage Grotesque', 'Helvetica Neue', system-ui, sans-serif;
    --font-sans: 'Instrument Sans', 'Helvetica Neue', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

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

    --sidebar-w: 216px;
    --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 (fundo cor de esmalte) */
    --bg:            #f4f5f1;
    --bg-subtle:     #eaede7;
    --surface:       #ffffff;
    --surface-2:     #f9faf7;
    --surface-hover: #f0f2ed;
    --border:        #dfe3db;
    --border-strong: #c4cbc1;
    --text:          #16201b;
    --text-muted:    #53605a;
    /* "apagado" ainda passa 4,5:1 sobre o afundado — o da proposta (#76827c)
       ficava em 3,4:1 e não passa no AA em texto pequeno. */
    --text-faint:    #5f6b65;

    /* status: ok = verde, warn = âmbar, bad = o vermelho da cárie (atraso,
       falta e alerta clínico são o mesmo "atenção"); info é ardósia, nunca o
       azul da restauração. */
    --ok:   #1f7a4f;  --ok-bg:   #e2f2e8;
    --warn: #8f5d00;  --warn-bg: #fbf0d8;
    --bad:  #c62828;  --bad-bg:  #fbe6e4;
    --info: #45566b;  --info-bg: #e8ecf1;
    --neutral-bg: #eaede7;

    /* odontograma: esmalte, raiz, contorno e as cores clínicas (fixas, não
       seguem a marca da clínica) */
    --enamel: #fbfaf5; --root: #efe9da; --tooth-line: #b9bfb3;
    --car: #c62828; --car-soft: #fbe6e4;
    --res: #1d5fbf; --res-soft: #e4ecfa;
    --rr: #c25e00;  --sel: #a07d00; --fra: #7a4a2a; --mb: #ddd3b4;
    --imp: #5b4b9a;

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

    --shadow-xs: 0 1px 2px rgb(22 32 27 / .05);
    --shadow-sm: 0 1px 2px rgb(22 32 27 / .05), 0 6px 16px -10px rgb(22 32 27 / .18);
    --shadow-md: 0 1px 2px rgb(22 32 27 / .05), 0 12px 30px -16px rgb(22 32 27 / .24);
    --shadow-lg: 0 2px 6px rgb(22 32 27 / .06), 0 24px 48px -18px rgb(22 32 27 / .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:            #0e1311;
    --bg-subtle:     #111715;
    --surface:       #151c19;
    --surface-2:     #18201c;
    --surface-hover: #1c2521;
    --border:        #232e29;
    --border-strong: #34423b;
    --text:          #e7eeea;
    --text-muted:    #a2afa9;
    --text-faint:    #8a9791;

    --ok:   #6fd3a0;  --ok-bg:   #15302a;
    --warn: #e9b64f;  --warn-bg: #33270c;
    --bad:  #ff7f74;  --bad-bg:  #3b1714;
    --info: #a9b8cc;  --info-bg: #1d2530;
    --neutral-bg: #1c2521;

    --enamel: #26302b; --root: #1f2723; --tooth-line: #4a5751;
    --car: #ff7f74; --car-soft: #3b1714;
    --res: #86afff; --res-soft: #172640;
    --rr: #ffa553;  --sel: #e6c34d; --fra: #d6a07b; --mb: #8c846a;
    --imp: #b3a5f0;

    --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;
}

/* Grotesca firme no título da tela e nos destaques: o resto é texto, em Instrument Sans. */
h1, h2, .h1, .h2, .display {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.025em;
    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 quadrado de cantos suaves, como na proposta (a arcada dentro). */
.brand-mark {
    width: 32px; height: 32px;
    flex-shrink: 0;
    border-radius: 10px;
    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; }
.brand-text strong { display: block; font: 700 1.375rem/1 var(--font-display); letter-spacing: -.02em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.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: 600 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; color: var(--text); }
/* No celular o topo divide a linha com quatro botões: "Plano T2026-014" e
   "Gustavo Rocha Bianchi" saíam "Plano T2026-…" e "Gustavo Roc…". Letra um
   pouco menor e até duas linhas (a altura do topo comporta); só o que não cabe
   nem assim ganha reticências. */
@media (max-width: 767.98px) {
    .topbar-title {
        font-size: 1.0625rem; line-height: 1.12;
        white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
        overflow-wrap: anywhere;
    }
}
.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: 2.25rem; margin: 0; line-height: 1.05; }
.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: #16201b; }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: #fff; filter: brightness(1.08); }
[data-bs-theme="dark"] .btn-danger:hover { color: #16201b; }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
[data-bs-theme="dark"] .btn-success { color: #0e1311; }
.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: #0e1311; }
.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: #4a5751;
}
.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: 600 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: 600 1.6rem/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: #0a0e0c; }
.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(10 14 12 / .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: #8fe0b6; }
.toast-item.danger .ico  { color: #ffaaa2; }
.toast-item.warning .ico { color: #f1cd7c; }
.toast-item.info .ico    { color: #a8e6d2; }
[data-bs-theme="dark"] .toast-item.success .ico { color: #1f7a4f; }
[data-bs-theme="dark"] .toast-item.danger .ico  { color: #c62828; }
[data-bs-theme="dark"] .toast-item.warning .ico { color: #8f5d00; }
[data-bs-theme="dark"] .toast-item.info .ico    { color: #0b5a46; }
.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; }
/* A grade das cadeiras pede mais largura que a coluna lateral. A proporção mora aqui, não
   num style inline: inline vencia o @media e deixava a coluna lateral pela metade no celular. */
.today-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) 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: 600 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: 600 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: #0b3b2f; 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: #0b3b2f; }
.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::after { content: ""; flex: 0 0 var(--pt-folga, 0px); }
.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); }

/* Financeiro: a tabela das parcelas e o quadro "Recebido por forma de pagamento".
   Lado a lado, a tabela de seis colunas ficava com 2/3 da largura e quebrava descrição,
   paciente e valor em 3–4 linhas (a 1440 px e ainda a 1700). No computador o quadro sobe
   e vira uma faixa com as formas lado a lado; no celular ele fica depois da lista. */
.fin-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
.fin-grid > * { min-width: 0; }
.fin-methods { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) {
    .fin-side { order: -1; }
    .fin-methods { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem 1.5rem; }
}

/* ---------- 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(10 14 12 / .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) {
    /* + o aviso de cookies enquanto está à vista (cookies.css / cookies.js). */
    body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--ck-space, 0px)); }
    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: 600 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; font: 600 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: 600 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: 600 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; }
}
/* Num celular de 390 px as cinco abas passavam 40 px da largura: a faixa rolava
   e, com "Financeiro" ativa, a primeira aparecia como "umo". Um pouco menos de
   folga e elas cabem inteiras; abaixo disso (360 px) a faixa rola, parando no
   começo de uma aba (app.js, PtTabs). */
@media (max-width: 420px) {
    .pt-tabs { gap: 0; padding-inline: .3rem; }
    .pt-tabs button { padding: 0 .42rem; font-size: .78rem; letter-spacing: -.005em; }
}
@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: 600 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: 600 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: 600 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. Dentista — Hoje: a próxima consulta e as cadeiras lado a lado
   =================================================================== */
.next-card .mini { width: 52px; height: 52px; }
.alert-pill {
    display: inline-flex; align-items: center; gap: .35rem;
    margin-top: .35rem; padding: .2rem .65rem; border-radius: 99px;
    background: var(--car-soft); color: var(--car);
    font-size: .75rem; font-weight: 600; line-height: 1.4;
    animation: alertIn .3s var(--ease-out) both;
}
.alert-pill .ico { width: 13px; height: 13px; stroke-width: 2.2; vertical-align: 0; }
/* O alerta entra deslizando e fica: saúde não combina com pisca-pisca. */
@keyframes alertIn { from { opacity: 0; transform: translateX(-6px); } }

.chairs-wrap { overflow-x: auto; scrollbar-width: thin; }
/* Meia hora = 26px: uma linha de texto inteira com folga. Abaixo de ~38px o
   bloco mostra tudo numa linha só (ver o @container no .blk); a segunda linha
   aparece só quando cabe inteira, nunca cortada pela metade. */
.chairs {
    --hour: 52px;
    display: grid;
    grid-template-columns: 40px repeat(var(--cols, 2), minmax(120px, 1fr));
    column-gap: 8px;
    min-width: 0;
}
.chairs .ch { font: 600 .75rem/1.2 var(--font-sans); color: var(--text-muted); padding-bottom: .5rem; display: flex; align-items: center; gap: .4rem; min-width: 0; }
.chairs .ch i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; flex: none; }
.chairs .ch span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chairs .hours, .chairs .col { position: relative; height: calc(var(--hour) * var(--span, 10)); }
.chairs .hours span { position: absolute; left: 0; font: 500 .6875rem/1 var(--font-mono); color: var(--text-faint); transform: translateY(-50%); }
.chairs .col {
    background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px var(--hour));
    background-size: 100% var(--hour);
    border-radius: 4px;
}
.blk {
    --c: var(--brand);
    position: absolute; left: 0; right: 0;
    /* Acima das linhas da grade (fundo da coluna) e abaixo da linha do agora. */
    z-index: 1;
    /* O bloco mede a própria altura: é ela que decide se a 2ª linha cabe. */
    container-type: size;
    border-radius: 9px; padding: .25rem .55rem;
    font-size: .75rem; line-height: 1.2; overflow: hidden;
    white-space: nowrap; text-overflow: ellipsis;
    border-left: 3px solid var(--c);
    background: color-mix(in srgb, var(--c) 11%, var(--surface));
    color: var(--text);
    min-height: 22px;
    transition: box-shadow var(--fast) var(--ease), transform .12s var(--ease);
}
.blk:hover { box-shadow: var(--shadow-sm); color: var(--text); }
.blk:active { transform: scale(.985); }
.blk b { display: block; font-size: .78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk b time { font-family: var(--font-mono); font-weight: 500; margin-right: .25rem; }
.blk small { display: block; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .72rem; }
/* Realizada fica apagada sem transparência: com opacity a linha da grade
   aparecia através do bloco. */
.blk.done { background: color-mix(in srgb, var(--c) 5%, var(--surface)); border-left-color: color-mix(in srgb, var(--c) 45%, var(--surface)); color: var(--text-muted); }
.blk.done b time, .blk.done small { color: var(--text-faint); }
/* No escuro, a cor da cadeira (jade, ameixa: escuras) quase some na
   superfície escura — a realizada, misturada com a superfície, sumia de vez
   (contraste 1,46 com o fundo do bloco). Clareia as duas e mantém a ordem: a
   que vem forte, a realizada apagada, mas mostrando de qual cadeira é. */
[data-bs-theme="dark"] .blk { border-left-color: color-mix(in srgb, var(--c) 60%, #fff); }
[data-bs-theme="dark"] .blk.done { border-left-color: color-mix(in srgb, var(--c) 55%, var(--text-faint)); }
[data-bs-theme="dark"] .blk.miss { border-left-color: var(--text-faint); }
.blk.miss { background: var(--bg-subtle); border-left-color: var(--text-faint); }
.blk.miss b { text-decoration: line-through; text-decoration-color: var(--text-faint); }
.blk.now { box-shadow: 0 0 0 2px var(--brand); z-index: 2; }
/* Bloco curto (meia hora): as duas linhas viram uma, com reticências no fim.
   A consulta mede a caixa de conteúdo (sem o padding): duas linhas pedem ~29px,
   o que cabe a partir de 45 min. Mais curto ainda (15 min): a linha aperta. */
@container (max-height: 28.9px) {
    .blk b, .blk small { display: inline; }
    .blk small::before { content: " · "; }
}
@container (max-height: 14.5px) {
    .blk b, .blk small { line-height: 1.1; }
    .blk b { vertical-align: top; }
}
.nowline { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--car); z-index: 3; pointer-events: none; }
.nowline::before {
    content: attr(data-label);
    position: absolute; right: 100%; top: -8px; margin-right: 4px;
    font: 600 .625rem/1 var(--font-mono); color: var(--car);
    background: var(--surface); padding: 2px 3px; border-radius: 4px; white-space: nowrap;
}
/* A etiqueta só na primeira cadeira: a mesma linha que o leitor de tela lê
   (as das outras cadeiras são aria-hidden). Não dá para usar
   `.col:first-of-type`: o primeiro div de .chairs é a coluna das horas, e a
   regra nunca casava — a etiqueta não aparecia em lugar nenhum. */
.chairs .col .nowline::before { display: none; }
.chairs .col .nowline:not([aria-hidden])::before { display: block; }

/* ===================================================================
   34. Odontograma anatômico (Support\Odontogram)
   Silhueta por grupo com coroa e raiz, faces na vista oclusal, FDI com a
   mesial voltada para a linha média. Condição tem padrão além da cor.
   =================================================================== */
.odo-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.odo-page { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.odo-main { padding: 1.25rem 1.4rem; display: grid; gap: 1rem; align-content: start; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.odo-side { border-left: 1px solid var(--border); padding: 1.25rem 1.15rem; display: grid; gap: .9rem; align-content: start; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.odo-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.odo-tools .ms-auto { margin-left: auto; }

.archwrap { overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
.arch { min-width: 720px; display: grid; gap: 14px; padding-top: 6px; }
.arch[hidden] { display: none; }
.jaw { display: grid; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)) 14px repeat(var(--n, 8), minmax(0, 1fr)); align-items: end; gap: 2px; }
.jaw.low { align-items: start; }
.jaw .mid { align-self: stretch; justify-self: center; width: 0; border-left: 1px dashed var(--border-strong); }

.tooth {
    display: grid; justify-items: center; gap: 2px;
    padding: 4px 0; border: 0; border-radius: 10px;
    background: transparent; color: inherit;
    cursor: pointer; min-width: 0;
    transition: background var(--fast) var(--ease);
}
div.tooth { cursor: default; }
.tooth:hover { background: var(--surface-hover); }
div.tooth:hover { background: transparent; }
.tooth.sel { background: var(--brand-soft); }
.tooth:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.tooth .fdi { font: 600 .6875rem/1 var(--font-mono); color: var(--text-muted); padding: 2px 0; }
.tooth.sel .fdi { color: var(--brand-text); }
.tooth .sil { width: 40px; height: 72px; display: block; max-width: 100%; }
.tooth .occ { width: 44px; height: 44px; display: block; max-width: 100%; }

.occ .f { stroke: var(--tooth-line); stroke-width: 1.2; fill: var(--enamel); transition: fill .25s var(--ease); }
.sil .body { fill: var(--enamel); stroke: var(--tooth-line); stroke-width: 1.3; }
.sil .rootfill { fill: var(--root); }
.sil .cej { fill: none; stroke: var(--tooth-line); stroke-width: 1; stroke-dasharray: 2 2; }
.sil .canal { fill: none; stroke: var(--res); stroke-width: 2.4; stroke-linecap: round; }
.sil .canal.ind { stroke: var(--car); stroke-dasharray: 3 3; }
.sil .crownfill { fill: var(--res-soft); stroke: var(--res); stroke-width: 1.4; }
.sil .crownfill.dash { stroke-dasharray: 3 2; }
.sil .imp { fill: none; stroke: var(--imp); stroke-width: 1.6; stroke-linecap: round; }
.sil.ext .body { stroke: var(--car); stroke-dasharray: 3 2; }
.tooth.gone .sil, .tooth.gone .occ .f { opacity: .35; }

/* Condições: cor e padrão (daltonismo). Os nomes são os de Odontogram::CONDITIONS. */
.c-cariado            { fill: url(#pCar) !important; }
.c-restaurado         { fill: var(--res) !important; }
.c-restauracao_ruim   { fill: url(#pRr) !important; }
.c-selante            { fill: var(--sel) !important; }
.c-fratura            { fill: url(#pFra) !important; }
.c-mancha_branca      { fill: url(#pMb) !important; }
.ov { fill: none; stroke: var(--text-faint); stroke-width: 3; stroke-linecap: round; pointer-events: none; }
.ov.red { stroke: var(--car); }
.ov.blue { stroke: var(--res); }
.ov.violet { stroke: var(--imp); }
.ov.dash { stroke-dasharray: 3 3; }

.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; }
.legend svg { width: 16px; height: 16px; border-radius: 4px; flex: none; }
.legend rect { stroke: var(--tooth-line); stroke-width: 1; }

.diff { display: flex; flex-wrap: wrap; gap: .4rem; }
.pill.car { background: var(--car-soft); color: var(--car); }
.pill.res { background: var(--res-soft); color: var(--res); }
.detail { border: 1px solid var(--border); border-radius: var(--r-md); padding: .9rem; display: grid; gap: .4rem; background: var(--bg); }
.detail .t { font: 600 .8125rem/1.2 var(--font-mono); color: var(--brand-text); }
.detail b { font-size: .95rem; }
.detail p, .detail li { font-size: .8125rem; color: var(--text-muted); margin: 0; }
.detail ul { margin: 0; padding-left: 1rem; display: grid; gap: .15rem; }
.detail .btn { justify-self: start; margin-top: .25rem; }

.side-item { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .6rem 0; border-top: 1px solid var(--border); font-size: .8125rem; color: inherit; }
.side-item:first-of-type { border-top: 0; }
.side-item svg { width: 30px; height: 30px; }
.side-item small { display: block; color: var(--text-muted); font-size: .75rem; }

/* Pulso ao gravar a face; contorno nas faces que mudaram ao trocar de mapa. */
.pulse { animation: toothPulse .45s cubic-bezier(.3, 1.5, .5, 1); transform-origin: center; transform-box: fill-box; }
@keyframes toothPulse { 0% { transform: scale(.86); } 100% { transform: none; } }
.arch.flash .f.chg { stroke: var(--brand); stroke-width: 2.4; animation: chg 1s var(--ease) both; }
@keyframes chg { 0%, 70% { stroke-opacity: 1; } 100% { stroke-opacity: 0; } }

/* Quadrante por vez (celular): abas 18–11, 21–28, 31–38, 48–41 */
.qtabs { display: none; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 3px; border-radius: 12px; background: var(--bg-subtle); border: 1px solid var(--border); }
.qtabs button { border: 0; background: transparent; padding: 0; min-height: 44px; border-radius: 9px; font: 600 .78rem/1 var(--font-mono); color: var(--text-muted); }
.qtabs button[aria-pressed="true"] { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow-xs); }
.qlabel { display: none; font-size: .75rem; color: var(--text-muted); text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kchip { font-size: .75rem; padding: .25rem .65rem; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); }
.kchip b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }

/* Arco só de leitura (ficha, prontuário, impressão): encolhe até caber na
   largura, sem rolar de lado. Na ficha é uma miniatura que abre a tela cheia. */
.odo-fit .arch { min-width: 0; gap: 8px; padding: 0; }
.odo-fit .jaw { gap: 1px; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)) 6px repeat(var(--n, 8), minmax(0, 1fr)); }
.odo-fit .tooth { padding: 0; }
.odo-fit .tooth .occ { width: 100%; height: auto; aspect-ratio: 1; max-width: 34px; }
.odo-fit .tooth .sil { width: 100%; height: auto; max-width: 30px; aspect-ratio: 40 / 72; }
.odo-fit .tooth .fdi { font-size: .5625rem; }
.odo-mini { display: block; color: inherit; border-radius: var(--r-md); padding: .5rem; margin: -.5rem; }
.odo-mini:hover { background: var(--surface-2); color: inherit; }
.odo-mini .tooth .sil { display: none; }

/* Folha do dente: a face grande para tocar, as condições em grade */
.bigocc { width: 132px; height: 132px; justify-self: center; display: block; }
.bigocc .f { stroke-width: .9; cursor: pointer; }
.bigocc .f.pick { stroke: var(--brand); stroke-width: 2.2; }
.facehint { text-align: center; font-size: .78rem; color: var(--text-muted); margin: -.25rem 0 0; }
.facechips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.facechips label { min-height: 44px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 12px; font: 600 .875rem/1 var(--font-mono); color: var(--text-muted); cursor: pointer; user-select: none; }
.facechips input:checked + label, .facechips label.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.facechips input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 2px; }
.facechips.off { opacity: .4; pointer-events: none; }
.conds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.conds label {
    display: flex; align-items: center; gap: .55rem;
    min-height: 44px; padding: .45rem .65rem;
    border: 1px solid var(--border); border-radius: 12px;
    font-size: .8125rem; line-height: 1.2; text-align: left; cursor: pointer;
    transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.conds input:checked + label { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.conds input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 2px; }
.conds svg { width: 18px; height: 18px; flex: none; border-radius: 4px; }
.conds rect { stroke: var(--tooth-line); stroke-width: 1; }
.sheet .sec { font: 500 .6875rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin: .35rem 0 -.1rem; }
.sheet details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: .875rem; font-weight: 600; color: var(--brand-text); list-style: none; }
.sheet details > summary::-webkit-details-marker { display: none; }

/* ===================================================================
   35. Plano de tratamento: progresso, "Executar" no item e o selo
   =================================================================== */
.prog { display: grid; gap: .4rem; }
.prog .meter { height: 8px; }
.prog small { font-size: .8125rem; color: var(--text-muted); }
.prog small b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.plist { display: grid; gap: .6rem; grid-template-columns: minmax(0, 1fr); }
.pitem {
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: .8rem; align-items: center;
    padding: .8rem .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
}
.pitem.is-cancel { opacity: .55; }
.pitem .occ { width: 44px; height: 44px; }
.pitem .noth { width: 44px; height: 44px; border-radius: 10px; background: var(--bg-subtle); display: grid; place-items: center; color: var(--text-muted); }
.pitem b { display: block; font-size: .9rem; font-weight: 600; }
.pitem small { display: block; font-size: .75rem; color: var(--text-muted); }
.pitem .fdi-tag { font: 600 .78rem/1 var(--font-mono); color: var(--brand-text); }
.pitem .acts { display: flex; align-items: center; gap: .5rem; justify-content: flex-end; }
.pitem .v { font: 600 .875rem/1 var(--font-mono); white-space: nowrap; }
.pitem .exec { min-height: 40px; }
.stamp {
    position: absolute; right: .7rem; top: .6rem;
    font: 600 .6875rem/1 var(--font-mono); padding: .3rem .6rem; border-radius: 99px;
    background: var(--res-soft); color: var(--res);
    animation: stampIn .4s var(--spring) both;
}
@keyframes stampIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
/* Executado agora: a face sai do vermelho para o azul (cross-fade de 250ms). */
.pitem.just-done .occ .f.c-restaurado { animation: toRes .5s .15s var(--ease) both; }
@keyframes toRes { from { fill: var(--car); } to { fill: var(--res); } }
.pitem.just-done { animation: none; box-shadow: 0 0 0 2px var(--res-soft); }
.pitem .pill.stamp-in { animation: stampIn .4s .1s var(--spring) both; }

/* ===================================================================
   36. Orçamento público (/orcamento/{token})
   =================================================================== */
.quote { display: grid; gap: 1rem; max-width: 560px; margin-inline: auto; grid-template-columns: minmax(0, 1fr); }
.quote-head { display: flex; align-items: center; gap: .7rem; }
.quote-head b { display: block; font: 600 1.2rem/1.1 var(--font-display); letter-spacing: -.02em; }
.quote-head small { display: block; color: var(--text-muted); font-size: .78rem; margin-top: 2px; }
.qcard { border-radius: var(--r-lg); padding: 1.1rem; background: var(--surface); border: 1px solid var(--border); display: grid; gap: .55rem; min-width: 0; }
.qcard .ttl { font: 600 .6875rem/1 var(--font-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.qcard h1 { font-size: 1.6rem; margin: 0; line-height: 1.1; }
.qln { display: flex; justify-content: space-between; gap: .75rem; font-size: .875rem; padding: .35rem 0; border-top: 1px solid var(--border); }
.qln:first-of-type { border-top: 0; }
.qln span:last-child { font-family: var(--font-mono); white-space: nowrap; }
.qln small { display: block; color: var(--text-muted); font-family: var(--font-mono); font-size: .75rem; }
.qtotal { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--border-strong); padding-top: .6rem; }
.qtotal strong { font: 600 1.6rem/1 var(--font-mono); letter-spacing: -.02em; }
.qmeta { display: grid; gap: .2rem; font-size: .8125rem; color: var(--text-muted); }
.okmsg { display: grid; justify-items: center; gap: .5rem; text-align: center; padding: 1.1rem; }
.okmsg svg { width: 64px; height: 64px; }
.okmsg circle { fill: var(--brand-soft); stroke: var(--brand); stroke-width: 2.5; }
.okmsg path { fill: none; stroke: var(--brand); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.okmsg.anim circle { stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw .45s var(--ease-out) forwards; }
.okmsg.anim path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .4s .35s var(--ease-out) forwards; }
.okmsg b { font: 600 1.25rem/1.2 var(--font-display); }
.okmsg span { font-size: .875rem; color: var(--text-muted); max-width: 40ch; }
.okmsg.no circle { fill: var(--bg-subtle); stroke: var(--text-faint); }
.okmsg.no path { stroke: var(--text-faint); }
.note-lock { font-size: .78rem; color: var(--text-muted); display: flex; gap: .45rem; align-items: flex-start; margin: 0; }
.note-lock .ico { width: 14px; height: 14px; color: var(--brand-text); margin-top: 3px; vertical-align: 0; }
.quote-bar { display: grid; gap: .5rem; }
@media (max-width: 767.98px) {
    /* Aprovar ao alcance do polegar: a barra encosta embaixo da tela. */
    .quote-bar {
        position: sticky; bottom: 0; z-index: 5;
        margin: 0 -1.1rem -1.1rem; padding: .75rem 1.1rem calc(.85rem + env(safe-area-inset-bottom)); border-radius: 0 0 var(--r-lg) var(--r-lg);
        background: color-mix(in srgb, var(--bg) 88%, transparent);
        backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
        border-top: 1px solid var(--border);
    }
}

/* ===================================================================
   37. Demais peças do dentista
   =================================================================== */
/* Botão flutuante (Agendar, Novo paciente) acima da barra inferior */
.fab {
    display: none;
    position: fixed; right: 1rem; bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom));
    z-index: 1036; width: 56px; height: 56px; border-radius: 18px; border: 0;
    place-items: center;
    background: var(--brand); color: var(--brand-ink);
    box-shadow: var(--shadow-brand), var(--shadow-md);
    transition: transform var(--fast) var(--ease);
}
.fab .ico { width: 24px; height: 24px; stroke-width: 2; vertical-align: 0; }
.fab:hover { color: var(--brand-ink); }
.fab:active { transform: scale(.92); }
@media (max-width: 767.98px) { .fab { display: grid; } }

/* Imagens do paciente (radiografias, fotos clínicas) */
.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, rgba(0, 0, 0, .78)); }
@media (max-width: 575.98px) { .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Abas que rolam com a borda esmaecida: há mais do lado. */
.pt-tabs.fade-edge { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.pt-tabs.fade-edge.at-end { -webkit-mask-image: none; mask-image: none; }
/* Rolada: também há aba escondida à esquerda (borda curta, para a primeira
   aba à vista continuar legível). */
.pt-tabs.fade-edge.scrolled { -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 85%, transparent); mask-image: linear-gradient(90deg, transparent, #000 14px, #000 85%, transparent); }
.pt-tabs.fade-edge.scrolled.at-end { -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px); mask-image: linear-gradient(90deg, transparent, #000 14px); }

/* Faixa do suporte em tom escuro neutro, não tijolo (o vermelho é da cárie) */
.place-items-center { place-items: center; }

/* ---------- 38. Responsivo do dentista ---------- */
@media (max-width: 1199.98px) {
    .odo-page { grid-template-columns: minmax(0, 1fr); }
    .odo-side { border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 767.98px) {
    .odo-main { padding: 1rem .9rem; }
    .odo-side { padding: 1rem .9rem; }
    /* Um quadrante por vez: o arco vira uma grade 4 × 2 de dentes de 46 px+.
       Só no odontograma de marcar (.arch[data-q]); a miniatura e a impressão
       continuam com o arco inteiro, encolhido até caber. */
    .qtabs { display: grid; }
    .qlabel { display: block; }
    .archwrap { overflow: visible; }
    .arch[data-q] { min-width: 0; padding-top: 0; }
    .arch[data-q] .jaw { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; align-items: stretch; }
    .arch[data-q] .jaw .mid { display: none; }
    .arch[data-q="1"] .jaw.low, .arch[data-q="2"] .jaw.low,
    .arch[data-q="3"] .jaw.up, .arch[data-q="4"] .jaw.up,
    .arch[data-q="5"] .jaw.low, .arch[data-q="6"] .jaw.low,
    .arch[data-q="7"] .jaw.up, .arch[data-q="8"] .jaw.up { display: none; }
    .arch[data-q] .tooth { display: none; }
    .arch[data-q="1"] .tooth[data-q="1"], .arch[data-q="2"] .tooth[data-q="2"],
    .arch[data-q="3"] .tooth[data-q="3"], .arch[data-q="4"] .tooth[data-q="4"],
    .arch[data-q="5"] .tooth[data-q="5"], .arch[data-q="6"] .tooth[data-q="6"],
    .arch[data-q="7"] .tooth[data-q="7"], .arch[data-q="8"] .tooth[data-q="8"] {
        display: grid; align-content: center;
        background: var(--surface); border: 1px solid var(--border);
        border-radius: 14px; min-height: 84px; padding: 8px 0 6px;
        animation: fadeUp .3s var(--ease-out) both;
    }
    .arch[data-q] .tooth.sel { background: var(--brand-soft); border-color: var(--brand); }
    .arch[data-q] .tooth .sil { display: none; }
    .arch[data-q] .tooth .occ { width: 46px; height: 46px; }
    .arch[data-q] .jaw.low .tooth .fdi { order: 2; }
    .odo-fit .tooth .fdi { font-size: .5rem; }
    .odo-fit .tooth .sil { display: none; }

    .chairs { --hour: 40px; }
    .pitem { grid-template-columns: 40px minmax(0, 1fr); }
    .pitem .occ, .pitem .noth { width: 40px; height: 40px; }
    .pitem .acts { grid-column: 1 / -1; justify-content: space-between; }
    .pitem .acts form { flex: 1; max-width: 62%; margin-left: auto !important; }
    .pitem .exec { width: 100%; }
    .conds label { font-size: .78rem; }
}
@media (pointer: coarse) { .tooth { min-width: 0; } }
@media print {
    .odo-side, .qtabs, .qlabel, .odo-tools, .fab { display: none !important; }
    .archwrap { overflow: visible; }
    .arch { min-width: 0; }
    .arch[hidden] { display: none !important; }
}

/* Toque (dentista): alvos que a medição em 390 px achou abaixo de 44 px. */
@media (pointer: coarse), (max-width: 767.98px) {
    .topbar-brand { min-height: 44px; }
    .app-topbar .dropdown > .btn-ghost { min-width: 44px; justify-content: center; }
    .panel-head a { display: inline-flex; align-items: center; min-height: 44px; margin: -.6rem 0; }
    .pitem .exec { min-height: 44px; }
    .form-check-label { min-height: 44px; display: inline-flex; align-items: center; flex: 1; }
    .facechips label { min-width: 44px; }
    .btn-group > .btn { min-width: 44px; }
}
/* A folha recebe o foco ao abrir (showModal): sem contorno na borda dela. */
.sheet:focus, .sheet:focus-visible { outline: none; }
.sheet-head { padding-top: .35rem; }
.sheet-grab:focus, .sheet-grab:focus-visible { outline: none; } /* alça: só arrastar ou tocar; fora da ordem do Tab */

/* ---------- Meu plano: seletor Mensal | Anual ----------
   Links com cara de segmento: o ciclo escolhido é o que o servidor desenhou. */
.cycle-switch {
    display: inline-flex; gap: 4px; padding: 4px;
    background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 999px;
    max-width: 100%;
}
.cycle-opt {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 40px; padding: 0 16px; border-radius: 999px;
    font-weight: 600; font-size: .875rem; color: var(--text-muted); white-space: nowrap;
    transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.cycle-opt:hover { color: var(--text); text-decoration: none; }
.cycle-opt.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.cycle-opt:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.cycle-badge {
    font-size: .6875rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
    background: var(--ok-bg); color: var(--ok);
}
@media (prefers-reduced-motion: reduce) { .cycle-opt { transition: none; } }

/* ---------- Privacidade e cookies (/privacidade) ---------- */
.privacy { max-width: 46rem; margin-inline: auto; display: grid; gap: 1.75rem; }
.privacy-head h1 { font: 600 clamp(1.8rem, 6vw, 2.4rem)/1.1 var(--font-display); margin: .25rem 0 .6rem; }
.privacy-kicker { margin: 0; font-size: .8125rem; color: var(--text-muted); }
.privacy-lede { margin: 0; font-size: 1.05rem; color: var(--text-muted); }
.privacy-sec h2 { font-size: 1.15rem; font-weight: 650; margin-bottom: .6rem; }
.privacy-sec > p { margin-bottom: .75rem; }
.privacy-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.privacy-list > li { padding: 1rem; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.privacy-list p { margin-bottom: .4rem; }
.privacy-name { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.privacy-name code { font-size: .9rem; color: var(--text); word-break: break-word; }
.privacy-dl { margin: 0; display: grid; gap: .25rem; font-size: .875rem; }
.privacy-dl > div { display: grid; gap: 0 .75rem; }
.privacy-dl dt { font-weight: 600; color: var(--text-muted); }
.privacy-dl dd { margin: 0; }
.privacy-bullets { padding-left: 1.1rem; display: grid; gap: .6rem; }
.privacy-foot { font-size: .8125rem; margin: 0; }
.app-footer .footer-links a, .footer-privacy { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 576px) { .privacy-dl > div { grid-template-columns: 8.5rem 1fr; } }

/* ---------- WhatsApp (Configurações → WhatsApp, ficha, link da consulta) ----------
   Porte da barbearia e da 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; }
}
