/* =============================================================================
   SISTEMA VISUAL
   -----------------------------------------------------------------------------
   Um único arquivo, três telas: login, sistema da clínica e painel da
   plataforma. Tudo sai destes tokens — trocar a marca depois é mexer aqui,
   não em cada componente.

   Escolhas que valem explicar:
   · Barra lateral clara no tema claro. Barra escura contrasta bonito na
     captura de tela, mas o dia inteiro ao lado de conteúdo branco cansa.
   · Azul vivo como marca, turquesa como cor de apoio, coral para o painel
     da plataforma. Azul porque é o que a área de saúde usa e o que dá
     leveza; turquesa e coral existem para o que precisa se destacar sem
     brigar com a marca.
   · Duas fontes, ambas servidas do próprio site: Plus Jakarta Sans nos
     títulos, Inter no texto e nos números. Nada de depender de fonte
     instalada na máquina de quem abre — era isso que fazia o sistema
     parecer sem acabamento em uns computadores e não em outros.
   · Sombras em camadas e bordas de baixo contraste. Elevação vem da luz,
     não de contorno grosso.
   ========================================================================== */

/* ============ FONTES ============
   Arquivos ficam em assets/fonts. São variáveis: um arquivo cobre todos os
   pesos, então pedir 800 num título não custa download nenhum a mais.
   Plus Jakarta Sans e Inter, ambas com licença SIL Open Font License 1.1. */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/jakarta-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('fonts/jakarta-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter var';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                 U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter var';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
                 U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ============ TOKENS — tema claro (estado base, sem stamp) ============ */
:root {
  /* Superfícies — o fundo puxa levemente para o azul, o que faz o branco do
     cartão parecer mais branco sem precisar de borda escura */
  --ground: #F1F6FC;
  --surface: #FFFFFF;
  --surface-2: #F7FAFE;
  --surface-3: #EDF3FA;
  --line: #E0E9F4;
  --line-soft: #EDF2F9;

  /* Texto */
  --ink: #0C1A2B;
  --ink-2: #46596E;
  --ink-3: #7B8EA5;

  /* Marca */
  --brand: #1668E3;
  --brand-strong: #0F4CB0;
  --brand-soft: #E3EDFD;
  --brand-ink: #FFFFFF;
  /* Só para enfeite — gradiente, brilho, ilustração. Nunca atrás de texto
     pequeno: contraste dela com o branco não passa em leitura. */
  --brand-vivid: #3D9BFF;

  /* Turquesa de apoio: gráficos, ilustração, o que é positivo e não é "ok" */
  --mint: #0FA79B;
  --mint-soft: #D9F5F2;
  --mint-vivid: #2BD9C4;

  /* Coral: identidade do painel da plataforma e do que pede atenção */
  --accent: #DD5A2B;
  --accent-soft: #FDEAE0;
  --accent-vivid: #FF8A4C;

  /* Barra lateral: clara no tema claro, para a vista descansar */
  --rail: #FFFFFF;
  --rail-line: #E6EDF6;
  --rail-ink: #56697E;
  --rail-ink-strong: #0C1A2B;
  --rail-active: var(--brand-soft);
  --rail-active-ink: var(--brand-strong);

  /* Estados */
  --ok: #12795C;
  --ok-soft: #D8F2E8;
  --warn: #96660F;
  --warn-soft: #FCEFD8;
  --crit: #C33B2B;
  --crit-soft: #FCE5E1;
  --info: #1F62C4;
  --info-soft: #E1ECFC;

  /* Elevação em camadas: sombra rasa marca a borda, a funda dá a altura.
     Tingida de azul — sombra cinza sobre fundo azulado fica suja. */
  --shadow-xs: 0 1px 2px rgba(13, 38, 76, .05);
  --shadow-sm: 0 1px 2px rgba(13, 38, 76, .05), 0 2px 8px -3px rgba(13, 38, 76, .08);
  --shadow-md: 0 2px 4px rgba(13, 38, 76, .04), 0 10px 24px -10px rgba(13, 38, 76, .16);
  --shadow-lg: 0 4px 10px rgba(13, 38, 76, .05), 0 28px 60px -22px rgba(13, 38, 76, .28);
  --shadow-brand: 0 2px 6px rgba(22, 104, 227, .22), 0 12px 26px -12px rgba(22, 104, 227, .45);

  --ring: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent);

  /* Cantos mais generosos que a versão anterior: é o que separa, à primeira
     vista, um sistema atual de um de dez anos atrás */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 999px;

  --sans: "Inter var", Inter, "Segoe UI Variable Text", "Segoe UI", system-ui,
          -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Plus Jakarta Sans", "Inter var", Inter, "Segoe UI", system-ui,
             -apple-system, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

/* ============ TOKENS — tema escuro ============ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #080F1A;
    --surface: #111C2A;
    --surface-2: #172434;
    --surface-3: #1E2D40;
    --line: #263850;
    --line-soft: #1C2A3C;

    --ink: #E8EFF8;
    --ink-2: #AEC1D6;
    --ink-3: #7C8FA7;

    --brand: #59A2FF;
    --brand-strong: #8BC0FF;
    --brand-soft: #14294A;
    --brand-ink: #04162C;
    --brand-vivid: #6FB6FF;

    --mint: #3FD5C3;
    --mint-soft: #0D2F2C;
    --mint-vivid: #5AE6D3;

    --accent: #FF9061;
    --accent-soft: #37201A;
    --accent-vivid: #FFA97F;

    --rail: #0C1622;
    --rail-line: #1C2A3C;
    --rail-ink: #94A8C0;
    --rail-ink-strong: #EAF1F9;
    --rail-active: #16294A;
    --rail-active-ink: #8BC0FF;

    --ok: #4CC894;
    --ok-soft: #0D2E22;
    --warn: #DFAA4A;
    --warn-soft: #2F2610;
    --crit: #F0827A;
    --crit-soft: #341A1B;
    --info: #7FAEF0;
    --info-soft: #142441;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45), 0 2px 6px -2px rgba(0, 0, 0, .5);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, .4), 0 8px 20px -8px rgba(0, 0, 0, .6);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, .4), 0 24px 56px -20px rgba(0, 0, 0, .75);
    --shadow-brand: 0 2px 6px rgba(0, 0, 0, .5), 0 12px 26px -12px rgba(30, 90, 180, .7);
  }
}

/* Mesma paleta do escuro automático acima: o botão de tema não pode entregar
   um escuro diferente (esverdeado) do que o sistema operacional entrega. */
:root[data-theme="dark"] {
  --ground: #080F1A;
  --surface: #111C2A;
  --surface-2: #172434;
  --surface-3: #1E2D40;
  --line: #263850;
  --line-soft: #1C2A3C;

  --ink: #E8EFF8;
  --ink-2: #AEC1D6;
  --ink-3: #7C8FA7;

  --brand: #59A2FF;
  --brand-strong: #8BC0FF;
  --brand-soft: #14294A;
  --brand-ink: #04162C;
  --brand-vivid: #6FB6FF;

  --mint: #3FD5C3;
  --mint-soft: #0D2F2C;
  --mint-vivid: #5AE6D3;

  --accent: #FF9061;
  --accent-soft: #37201A;
  --accent-vivid: #FFA97F;

  --rail: #0C1622;
  --rail-line: #1C2A3C;
  --rail-ink: #94A8C0;
  --rail-ink-strong: #EAF1F9;
  --rail-active: #16294A;
  --rail-active-ink: #8BC0FF;

  --ok: #4CC894;
  --ok-soft: #0D2E22;
  --warn: #DFAA4A;
  --warn-soft: #2F2610;
  --crit: #F0827A;
  --crit-soft: #341A1B;
  --info: #7FAEF0;
  --info-soft: #142441;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45), 0 2px 6px -2px rgba(0, 0, 0, .5);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, .4), 0 8px 20px -8px rgba(0, 0, 0, .6);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, .4), 0 24px 56px -20px rgba(0, 0, 0, .75);
  --shadow-brand: 0 2px 6px rgba(0, 0, 0, .5), 0 12px 26px -12px rgba(30, 90, 180, .7);
}

/* ============ BASE ============ */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* cv05/ss01: "l" com pé e "a" de uma perna, mais fáceis de distinguir em
     nome de paciente. tnum: número que não dança quando o valor muda. */
  font-feature-settings: "cv05" 1, "ss01" 1;
}

h1, h2, h3, h4 {
  text-wrap: balance;
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.02em;
}
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-underline-offset: 2px; }

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

::selection { background: var(--brand-soft); color: var(--brand-strong); }

/* Barras de rolagem discretas, para não roubarem a atenção do conteúdo */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--ink-3); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* ============ TIPOGRAFIA DE APOIO ============ */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.lede { color: var(--ink-2); font-size: 17px; }
.mute { color: var(--ink-3); }

/* =============================================================================
   TELA DE LOGIN — formulário à esquerda, vitrine à direita
   -----------------------------------------------------------------------------
   A ordem importa: quem já é cliente abre essa tela para entrar, e o olho
   ocidental começa pela esquerda. O formulário fica lá. A direita mostra o
   produto para quem chegou antes de comprar — e some por inteiro no celular,
   onde ninguém quer ler propaganda antes de trabalhar.

   A vitrine usa um recorte real do sistema, não desenho genérico: a mesma
   agenda, a mesma etiqueta de confirmado, o mesmo formato de dinheiro.
   ========================================================================== */
body.login-body {
  display: block;
  background: var(--surface);
}

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1.02fr;
}

/* --- lado do formulário --- */
.authmain {
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background: var(--surface);
}

.authform {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.authbrand { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.authbrand .glyph {
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  background: linear-gradient(145deg, var(--brand-vivid), var(--brand));
  box-shadow: var(--shadow-brand);
  display: grid; place-items: center;
  color: #FFFFFF;
}
.authbrand .glyph svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.authbrand .name {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
}

.authform > header { display: flex; flex-direction: column; gap: 7px; }
.authform h1 { font-size: 30px; font-weight: 800; letter-spacing: -.018em; }
.authform header p { color: var(--ink-2); font-size: 14.5px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 13px; font-weight: 620; color: var(--ink-2); }
.field .hintline { font-size: 12px; color: var(--ink-3); }

.input {
  width: 100%;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 14px;
  font-size: 15px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--ink-3); }
.input:hover { border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.input[aria-invalid="true"] { border-color: var(--crit); }

/* Campo com ícone dentro: dá a leitura do que se pede antes de ler o rótulo */
.inputgroup { position: relative; display: flex; align-items: center; }
.inputgroup .input { padding-left: 44px; }
.inputgroup > .icon {
  position: absolute;
  left: 14px;
  width: 18px; height: 18px;
  stroke: var(--ink-3); fill: none; stroke-width: 1.7;
  pointer-events: none;
  transition: stroke .15s;
}
.inputgroup:focus-within > .icon { stroke: var(--brand); }
.inputgroup:has(.reveal) .input { padding-right: 46px; }
.inputgroup .reveal {
  position: absolute;
  right: 5px;
  background: none; border: 0;
  padding: 8px;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  cursor: pointer;
  display: grid; place-items: center;
}
.inputgroup .reveal:hover { color: var(--brand); background: var(--brand-soft); }
.inputgroup .reveal svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }

.authform .btn.primary {
  padding: 14px;
  font-size: 15.5px;
  border-radius: var(--r-md);
}

.authrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.authrow a { font-size: 13px; font-weight: 600; text-decoration: none; }
.authrow a:hover { text-decoration: underline; }

/* Rodapé do formulário: o que é secundário fica visivelmente secundário */
.authfoot {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
}
.authfoot .sep { padding-top: 14px; max-width: 34ch; text-wrap: balance; }

/* Mensagem de erro do login */
.formerro {
  display: none;
  gap: 9px;
  align-items: flex-start;
  font-size: 13.5px;
  color: var(--crit);
  background: var(--crit-soft);
  border: 1px solid color-mix(in srgb, var(--crit) 25%, transparent);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.formerro.show { display: flex; }
.formerro svg { width: 17px; height: 17px; flex: none; margin-top: 2px; stroke: currentColor; fill: none; stroke-width: 2; }

.formaviso {
  font-size: 13px;
  color: var(--ink-2);
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  border-radius: var(--r-md);
  padding: 14px 16px;
  line-height: 1.55;
}
.formaviso b { color: var(--ink); font-weight: 700; }

/* Escolha de clínica, quando o usuário atende mais de uma */
.clinicpick { display: flex; flex-direction: column; gap: 9px; }
.clinicpick button {
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 15px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s, box-shadow .15s;
}
.clinicpick button:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: var(--shadow-sm);
}
.clinicpick button:active { transform: translateY(1px); }
.clinicpick .ini {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  background: linear-gradient(145deg, var(--brand-vivid), var(--brand));
  color: #FFFFFF;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none;
}
.clinicpick .txt { display: flex; flex-direction: column; min-width: 0; }
.clinicpick .txt b { font-size: 14.5px; font-weight: 650; }
.clinicpick .txt small { font-size: 12px; color: var(--ink-3); }

/* --- vitrine --- */
.authaside {
  position: relative;
  overflow: hidden;
  padding: clamp(36px, 5vh, 56px) clamp(38px, 4.2vw, 60px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(18px, 3.2vh, 32px);
  color: #F2F8FF;
  background:
    radial-gradient(75% 60% at 88% 8%, rgba(43, 217, 196, .85) 0%, transparent 58%),
    radial-gradient(70% 70% at 5% 95%, rgba(110, 91, 255, .7) 0%, transparent 62%),
    linear-gradient(155deg, #2A86FF 0%, #1668E3 42%, #0F3F96 100%);
}

/* Malha sutil: dá textura sem virar enfeite que disputa com o texto */
.authaside::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(120% 100% at 80% 0%, #000 15%, transparent 78%);
  pointer-events: none;
}

.authaside > * { position: relative; z-index: 1; }

.authpitch { display: flex; flex-direction: column; gap: 14px; max-width: 26ch; }
.authpitch h2 {
  font-family: var(--display);
  font-size: clamp(30px, 2.9vw, 42px);
  font-weight: 800;
  letter-spacing: -.022em;
  line-height: 1.12;
  color: #FFFFFF;
}
.authpitch p { color: rgba(240, 248, 255, .82); font-size: 16px; line-height: 1.5; }

/* Recorte do sistema: dois cartões que se sobrepõem, como na tela real */
.authmock { position: relative; margin: 4px 0 6px; max-width: 430px; }
.authmock .cardmock {
  background: rgba(255, 255, 255, .97);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 60px -24px rgba(6, 26, 62, .6), 0 2px 6px rgba(6, 26, 62, .18);
  padding: 16px 18px;
  color: var(--ink);
  transform: rotate(-1.2deg);
}
.authmock .mockhead {
  display: flex; align-items: baseline; gap: 8px;
  padding-bottom: 11px;
  margin-bottom: 6px;
  border-bottom: 1px solid #E6EDF6;
}
.authmock .mockhead b { font-family: var(--display); font-size: 14.5px; font-weight: 700; color: #0C1A2B; }
.authmock .mockhead span { margin-left: auto; font-size: 11.5px; color: #7B8EA5; }

.authmock .mockrow {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: #0C1A2B;
}
.authmock .mockrow + .mockrow { border-top: 1px solid #F0F4F9; }
.authmock .hora {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #7B8EA5;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.authmock .ini {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; color: #FFFFFF;
  background: var(--c, #1668E3);
  flex: none;
}
.authmock .quem { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.authmock .tag {
  margin-left: auto;
  font-size: 10.5px; font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--r-full);
  white-space: nowrap;
  flex: none;
}
.authmock .tag.ok { background: #D8F2E8; color: #12795C; }
.authmock .tag.wait { background: #FCEFD8; color: #96660F; }
.authmock .tag.new { background: #E3EDFD; color: #0F4CB0; }

/* Rodapé do cartão: além de ser verdade na tela real, é o espaço morto onde
   o cartão de faturamento pode se sobrepor sem cobrir nome de paciente. */
.authmock .mockfoot {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid #F0F4F9;
  font-size: 11.5px;
  color: #7B8EA5;
  min-height: 34px;
}

.authmock .kpimock {
  position: absolute;
  right: -18px; bottom: -34px;
  background: #FFFFFF;
  border-radius: var(--r-md);
  box-shadow: 0 20px 44px -18px rgba(6, 26, 62, .55);
  padding: 13px 16px;
  display: flex; flex-direction: column; gap: 2px;
  transform: rotate(2deg);
}
.authmock .kpimock .lbl {
  font-size: 10px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: #7B8EA5;
}
.authmock .kpimock .val {
  font-family: var(--display);
  font-size: 21px; font-weight: 800; letter-spacing: -.03em;
  color: #0C1A2B;
  font-variant-numeric: tabular-nums;
}
.authmock .kpimock .sobe {
  font-size: 11.5px; font-weight: 650; color: #12795C;
  display: flex; align-items: center; gap: 4px;
}
.authmock .kpimock .sobe svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.4; }

.authpoints {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: clamp(18px, 3vh, 26px) 0 0;
  padding: 0;
  list-style: none;
  max-width: 480px;
}
.authpoints li {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px;
  font-weight: 550;
  color: #FFFFFF;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--r-full);
  padding: 7px 13px 7px 9px;
  backdrop-filter: blur(4px);
}
.authpoints svg {
  width: 15px; height: 15px; flex: none;
  stroke: #7CF2DF; fill: none; stroke-width: 2.6;
}

.asidefoot {
  font-size: 12px;
  color: rgba(240, 248, 255, .62);
  line-height: 1.55;
  max-width: 46ch;
  border-top: 1px solid rgba(255, 255, 255, .16);
  padding-top: 16px;
}

/* Tela baixa (notebook de 768px de altura, projetor): o rodapé jurídico da
   vitrine é o primeiro a sair — ele repete o que já está do lado do formulário. */
@media (max-height: 880px) {
  .asidefoot { display: none; }
}

/* Abaixo de 1000px a vitrine some: sobra o formulário, com a marca no topo */
@media (max-width: 1000px) {
  .auth { grid-template-columns: 1fr; }
  .authaside { display: none; }
  .authmain { align-items: start; padding-top: 9vh; padding-bottom: 56px; }
  .authform h1 { font-size: 26px; }
}

/* =============================================================================
   SHELL DO SISTEMA
   ========================================================================== */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.rail {
  background: var(--rail);
  border-right: 1px solid var(--rail-line);
  color: var(--rail-ink);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brandmark { display: flex; align-items: center; gap: 10px; padding: 4px 8px 0; }
.brandmark .glyph {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  background: linear-gradient(145deg, var(--brand-vivid), var(--brand));
  display: grid; place-items: center;
  color: #FFFFFF;
  font-size: 16px; font-weight: 700;
  box-shadow: var(--shadow-brand);
}
.brandmark .glyph svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.brandmark .name {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--rail-ink-strong);
}

.navgroup { display: flex; flex-direction: column; gap: 1px; }
.navlabel {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 10px 6px;
}

.navitem {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  background: none;
  border: 0;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  text-align: left;
  font-size: 14px;
  color: var(--rail-ink);
  cursor: pointer;
  position: relative;
  transition: background .13s, color .13s;
}
.navitem:hover { background: var(--surface-3); color: var(--rail-ink-strong); }
.navitem[aria-current="true"] {
  background: var(--rail-active);
  color: var(--rail-active-ink);
  font-weight: 620;
}
/* Marca fina à esquerda: diz onde você está sem engordar o item */
.navitem[aria-current="true"]::before {
  content: "";
  position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 var(--r-full) var(--r-full) 0;
  background: var(--brand);
}
.navitem svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.65; }
.navitem .badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: var(--r-full);
  padding: 1px 7px;
}

.railfoot {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--rail-line);
  font-size: 12px;
  color: var(--ink-3);
}

.main { display: flex; flex-direction: column; min-width: 0; background: var(--ground); }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.unit {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 7px 11px;
  font-size: 13px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .13s, background .13s;
}
.unit:hover { border-color: var(--brand); background: var(--brand-soft); }
.unit b { font-weight: 620; }

.search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface-2);
  transition: border-color .13s, box-shadow .13s, background .13s;
}
.search::placeholder { color: var(--ink-3); }
.search:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: var(--ring);
}

.topactions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.avatar {
  width: 33px; height: 33px; border-radius: var(--r-full);
  background: linear-gradient(145deg, var(--brand-vivid), var(--brand));
  color: #FFFFFF;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  border: 0;
  box-shadow: var(--shadow-xs);
}

.canvas { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.screen[hidden] { display: none; }
.screen { display: flex; flex-direction: column; gap: 18px; }

.screenhead { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.screenhead h2 { font-size: 22px; letter-spacing: -.022em; }
.screenhead .sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.screenhead .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============ BOTÕES ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background .13s, border-color .13s, box-shadow .13s, transform .08s;
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--ink-3) 40%, var(--line)); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 650;
  box-shadow: var(--shadow-brand);
}
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }

.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }

.btn.danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 30%, var(--line)); }
.btn.danger:hover { background: var(--crit-soft); border-color: var(--crit); }

.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.block { width: 100%; }

/* ============ RECURSO AINDA NÃO LIBERADO ============
   Não é erro nem falta de permissão: é coisa que o suporte libera quando o
   cliente pede. Por isso não usa a cor de crítico — o tom é de convite. */
.trancado { display: flex; gap: 16px; align-items: flex-start; padding: 24px 22px; }
.trancado .cadeado {
  width: 46px; height: 46px; flex: none;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--brand);
  display: grid; place-items: center;
}
.trancado .cadeado svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.75; }
.trancado h3 { font-size: 16.5px; }
.trancado p { color: var(--ink-2); font-size: 13.5px; margin-top: 6px; max-width: 64ch; }
.trancado .acoes { margin-top: 15px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ CARTÕES ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card > header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 10px;
}
/* Título de cartão volta para a Inter: em 14px, dentro de uma tela cheia de
   dado, a fonte de título chama mais atenção do que o conteúdo merece. */
.card > header h3 { font-family: var(--sans); font-size: 14px; font-weight: 650; letter-spacing: -.012em; }
.card > header .meta { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.card .body { padding: 16px; }
.card > footer { padding: 12px 16px; border-top: 1px solid var(--line-soft); }

.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; align-items: start; }

/* ============ INDICADORES ============ */
.kpi { padding: 15px 16px; display: flex; flex-direction: column; gap: 5px; }
.kpi .label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.kpi .value {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.032em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi .delta {
  font-size: 12.5px;
  display: flex; align-items: center; gap: 5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.delta.up { color: var(--ok); }
.delta.down { color: var(--crit); }
.kpi svg { margin-top: 4px; }

/* ============ ETIQUETAS ============ */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 620;
  padding: 3px 9px;
  border-radius: var(--r-full);
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.crit { background: var(--crit-soft); color: var(--crit); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.mute { background: var(--surface-3); color: var(--ink-3); }
.pill.brand { background: var(--brand-soft); color: var(--brand-strong); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.plain::before { display: none; }

/* ============ TABELAS ============ */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 650;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}
td { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroller { overflow-x: auto; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }

/* ============ ESTADOS DE CARREGAMENTO E VAZIO ============ */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 44px 24px;
  text-align: center;
  color: var(--ink-3);
}
.empty svg { width: 34px; height: 34px; stroke: currentColor; fill: none; stroke-width: 1.4; opacity: .55; }
.empty b { color: var(--ink-2); font-size: 14.5px; font-weight: 600; }
.empty p { font-size: 13px; max-width: 42ch; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: brilho 1.3s linear infinite;
  border-radius: var(--r-xs);
  color: transparent !important;
}
@keyframes brilho { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.loadingline { height: 14px; margin: 5px 0; }

/* ============ AGENDA ============ */
.agenda { display: grid; grid-template-columns: 64px repeat(var(--cols, 4), minmax(0, 1fr)); }
.agenda .colhead {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.agenda .colhead .who { font-size: 13px; font-weight: 640; }
.agenda .colhead .spec { font-size: 11.5px; color: var(--ink-3); }
.agenda .corner { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.slots { display: grid; grid-auto-rows: 46px; }
.hourcol .h {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  padding: 4px 8px;
  text-align: right;
  border-bottom: 1px dashed var(--line-soft);
}
.lane { border-left: 1px solid var(--line-soft); position: relative; }
.lane .slotline { border-bottom: 1px dashed var(--line-soft); }

.appt {
  position: absolute; left: 4px; right: 4px;
  border-radius: var(--r-sm);
  padding: 6px 9px 6px 11px;
  font-size: 12px; line-height: 1.3;
  background: var(--surface-3);
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform .1s, box-shadow .13s;
}
.appt:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); z-index: 2; }
.appt::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--ink-3); }
.appt b { font-weight: 640; display: block; }
.appt span { color: var(--ink-3); font-size: 11px; }
.appt.s-conf { background: var(--ok-soft); border-color: transparent; }
.appt.s-conf::before { background: var(--ok); }
.appt.s-wait { background: var(--info-soft); border-color: transparent; }
.appt.s-wait::before { background: var(--info); }
.appt.s-hold { background: var(--warn-soft); border-color: transparent; }
.appt.s-hold::before { background: var(--warn); }
.appt.s-miss { background: var(--crit-soft); border-color: transparent; }
.appt.s-miss::before { background: var(--crit); }
.appt.s-free {
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface-3) 6px 12px);
  border: 1px dashed var(--line);
  color: var(--ink-3);
  box-shadow: none;
}
.appt.s-free::before { background: transparent; }
.appt.mini { font-size: 11px; padding: 4px 6px 4px 8px; }
.appt.mini span { display: none; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink-2); padding: 11px 16px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 6px; }

.agendafiltro {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  flex-wrap: wrap;
}
.agendafiltro[hidden] { display: none; }
.agendafiltro select, .modal .field select, .filtropac, select.input {
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 7px 11px;
  cursor: pointer;
}
.agendafiltro select:focus, .filtropac:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

/* ============ PRONTUÁRIO ============ */
.patienthead { display: flex; align-items: center; gap: 14px; padding: 15px 16px; flex-wrap: wrap; }
.patienthead .pic {
  width: 48px; height: 48px; border-radius: var(--r-full);
  background: var(--brand-soft); color: var(--brand-strong);
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
  border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
}
.patienthead .who h3 { font-size: 18px; }
.patienthead .who .meta { font-size: 12.5px; color: var(--ink-3); }
.patienthead .stats { margin-left: auto; display: flex; gap: 24px; }
.patienthead .stats div { text-align: right; }
.patienthead .stats .k { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.patienthead .stats .v { font-size: 15.5px; font-weight: 640; font-variant-numeric: tabular-nums; }
.patienthead .voltar { flex: none; }

.tabs {
  display: flex; gap: 2px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  overflow-x: auto;
}
.tab {
  border: 0; background: none;
  padding: 11px 13px;
  font-size: 13.5px;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color .13s, border-color .13s;
}
.tab:hover { color: var(--ink-2); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); font-weight: 620; }
.tabpanel { display: flex; flex-direction: column; gap: 14px; }
.tabpanel[hidden] { display: none; }

.odonto { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.arch { display: flex; flex-direction: column; gap: 5px; align-items: center; }
.archrow { display: flex; gap: 3px; }
.quadgap { width: 14px; }
.tooth { cursor: pointer; }
.tooth .num { font-family: var(--mono); font-size: 8px; fill: var(--ink-3); }
.tooth rect.face { fill: var(--surface-2); stroke: var(--line); stroke-width: .8; }
.tooth:hover rect.face { stroke: var(--brand); }
.tooth.sel rect.face { stroke: var(--brand); stroke-width: 1.8; }
.tooth rect.f-carie { fill: var(--crit); }
.tooth rect.f-rest { fill: var(--info); }
.tooth rect.f-plan { fill: var(--warn); }
.tooth.absent rect.face { fill: var(--surface-3); stroke-dasharray: 2 2; }
.tooth.absent .x { stroke: var(--ink-3); stroke-width: 1.2; }

.toothinfo { display: flex; flex-direction: column; gap: 10px; }
.kv {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13.5px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
}
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--ink-3); }
.kv .v { font-weight: 620; text-align: right; }

.timeline { display: flex; flex-direction: column; }
.tl {
  display: grid; grid-template-columns: 80px 1fr; gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.tl:last-child { border-bottom: 0; }
.tl .when { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.tl .what b { font-size: 13.5px; font-weight: 640; }
.tl .what p { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.tl .what .by { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }

.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background-image: radial-gradient(circle at 50% 40%, var(--surface-2), var(--surface-3));
  display: flex; align-items: flex-end;
  padding: 8px;
  font-size: 11px;
  color: var(--ink-3);
  cursor: pointer;
  transition: border-color .13s, transform .1s;
}
.thumb:hover { border-color: var(--brand); transform: translateY(-1px); }
.thumb figcaption {
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-3);
}
/* Com a imagem carregada, a legenda passa a ficar sobre ela — daí o degradê,
   senão texto claro sobre radiografia clara não se lê. */
.thumb.comimagem {
  background-size: cover;
  background-position: center;
  border-color: transparent;
}
.thumb.comimagem figcaption {
  color: #FFFFFF;
  width: 100%;
  padding: 14px 8px 6px;
  margin: -8px;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  background: linear-gradient(transparent, rgba(6, 16, 32, .82));
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.thumb.arquivo { background-image: none; background: var(--brand-soft); }
.thumb.arquivo figcaption { color: var(--brand-strong); font-weight: 600; }
.thumb.falhou { opacity: .5; }

/* ============ ORÇAMENTO ============ */
.doc { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
.totals { display: flex; flex-direction: column; gap: 9px; padding: 16px; }
.totals .row { display: flex; justify-content: space-between; font-size: 13.5px; }
.totals .row.big {
  font-size: 20px; font-weight: 700;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.payopts { display: flex; flex-direction: column; gap: 8px; }
.payopt {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  display: flex; align-items: center; gap: 11px;
  font-size: 13.5px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color .13s, background .13s;
}
.payopt:hover { border-color: var(--brand); }
.payopt.sel { border-color: var(--brand); background: var(--brand-soft); }
.payopt .dot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.payopt.sel .dot { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 2px var(--surface); }
.payopt .r { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 620; }

/* ============ FINANCEIRO ============ */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 156px; padding: 16px; }
/* O teto de largura evita a barra solitária esticar pela tela inteira quando
   há um único ponto no gráfico. */
.bars .b {
  flex: 1 1 0;
  max-width: 54px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 5px;
  height: 100%;
}
.bars .b .stack { display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; height: 100%; }
.bars .b .in { background: var(--brand); border-radius: 4px 4px 0 0; }
.bars .b .out { background: var(--surface-3); border: 1px solid var(--line); border-radius: 0 0 4px 4px; }
.bars .b .lbl { font-family: var(--mono); font-size: 10px; color: var(--ink-3); text-align: center; }

.ruler { display: flex; flex-direction: column; padding: 4px 0; }
.step { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; padding: 11px 16px; }
.step .node {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  background: var(--brand-soft); color: var(--brand-strong);
  position: relative;
}
.step:not(:last-child) .node::after {
  content: "";
  position: absolute; top: 26px; left: 50%;
  width: 1px; height: 22px;
  background: var(--line);
  transform: translateX(-50%);
}
.step .t { font-size: 13.5px; }
.step .t small { display: block; color: var(--ink-3); font-size: 11.5px; }

/* ============ CRM ============ */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.col {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 11px;
  display: flex; flex-direction: column; gap: 8px;
}
.col > h4 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  display: flex; justify-content: space-between;
  font-weight: 650;
}
.lead {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 11px;
  display: flex; flex-direction: column; gap: 5px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color .13s, transform .1s, box-shadow .13s;
}
.lead:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.lead b { font-size: 13px; font-weight: 640; }
.lead .src { font-size: 11.5px; color: var(--ink-3); }
.lead .val { font-size: 12.5px; font-variant-numeric: tabular-nums; font-weight: 640; color: var(--brand); }

/* ============ AGENTE / CONVERSAS ============ */
.chat {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px;
  background: var(--surface-2);
  min-height: 340px;
}
.msg { max-width: 78%; padding: 9px 13px; border-radius: 16px; font-size: 13.5px; line-height: 1.45; }
.msg.them { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 5px; align-self: flex-start; }
.msg.us { background: var(--brand-soft); color: var(--ink); border-top-right-radius: 5px; align-self: flex-end; }
.msg .time { display: block; font-family: var(--mono); font-size: 10px; color: var(--ink-3); margin-top: 4px; }
.msg .sysnote { display: block; margin-top: 6px; font-size: 11.5px; color: var(--brand); font-weight: 640; }
.msg.nota {
  align-self: center;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px; font-weight: 620;
  border-radius: var(--r-full);
  padding: 5px 13px;
  max-width: 90%;
  text-align: center;
}

.autolist { display: flex; flex-direction: column; }
.auto {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}
.auto:last-child { border-bottom: 0; }
.auto .t b { display: block; font-size: 13.5px; font-weight: 620; }
.auto .t small { color: var(--ink-3); font-size: 11.5px; }

.switch {
  margin-left: auto;
  width: 36px; height: 20px;
  border-radius: var(--r-full);
  background: var(--line);
  position: relative;
  flex: none;
  cursor: pointer;
  transition: background .15s;
}
.switch::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--surface);
  top: 2px; left: 2px;
  transition: left .15s;
  box-shadow: var(--shadow-xs);
}
.switch.on { background: var(--brand); }
.switch.on::after { left: 18px; }

.chatlayout { display: grid; grid-template-columns: 272px 1fr; min-height: 460px; }
.conversas { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.conversasbusca { padding: 10px; border-bottom: 1px solid var(--line-soft); }
.conversasbusca input {
  width: 100%;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 11px;
}
.conversasbusca input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.conversalista { overflow-y: auto; max-height: 460px; }
.conversa {
  width: 100%;
  display: grid; grid-template-columns: 34px 1fr; gap: 10px;
  align-items: start;
  padding: 12px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-left: 3px solid transparent;
  background: none;
  text-align: left;
  cursor: pointer;
}
.conversa:hover { background: var(--surface-2); }
.conversa[aria-selected="true"] { background: var(--surface-2); border-left-color: var(--brand); }
.conversa .ini {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-strong);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.conversa .txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conversa .linha1 { display: flex; align-items: baseline; gap: 6px; }
.conversa .nome { font-size: 13.5px; font-weight: 640; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversa .hora { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); flex: none; }
.conversa .previa {
  font-size: 12px; color: var(--ink-3);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.conversa .naolidas {
  align-self: flex-start;
  background: var(--brand); color: var(--brand-ink);
  border-radius: var(--r-full);
  font-size: 10px; font-weight: 700;
  padding: 1px 7px;
}

.conversapainel { display: flex; flex-direction: column; min-width: 0; }
.conversahead { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.conversahead .quem { display: flex; flex-direction: column; min-width: 0; }
.conversahead .quem b { font-size: 14px; font-weight: 640; }
.conversahead .quem small { font-size: 11.5px; color: var(--ink-3); }
.conversahead .pill { margin-left: auto; }
.conversapainel .chat { flex: 1; max-height: 380px; overflow-y: auto; }
.chatbarra { display: flex; gap: 8px; padding: 11px 12px; border-top: 1px solid var(--line-soft); background: var(--surface); }
.chatbarra input {
  flex: 1;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  padding: 10px 15px;
}
.chatbarra input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

/* ============ METAS ============ */
.goal { display: flex; flex-direction: column; gap: 7px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); }
.goal:last-child { border-bottom: 0; }
.goal .top { display: flex; justify-content: space-between; font-size: 13.5px; }
.goal .top b { font-variant-numeric: tabular-nums; font-weight: 640; }
.track { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.track i { display: block; height: 100%; border-radius: var(--r-full); background: var(--brand); transition: width .3s ease-out; }
.track i.warn { background: var(--warn); }
.track i.crit { background: var(--crit); }

/* ============ BUSCA, SELETORES E MENUS ============ */
.unitwrap, .searchwrap { position: relative; }
.searchwrap { flex: 1; max-width: 400px; }

.dropdown {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  min-width: 240px;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex; flex-direction: column; gap: 1px;
  max-height: 360px;
  overflow-y: auto;
}
.dropdown[hidden] { display: none; }
.dropdown.wide { min-width: 100%; }
.dropdown.right { left: auto; right: 0; }
.dropdown button {
  display: flex; flex-direction: column; gap: 1px;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: 13.5px;
  cursor: pointer;
}
.dropdown button:hover { background: var(--surface-3); }
.dropdown button small { color: var(--ink-3); font-size: 11.5px; }
.dropdown .empty { padding: 14px 10px; font-size: 13px; }
.dropdown hr { border: 0; border-top: 1px solid var(--line-soft); margin: 5px 0; }

/* ============ MODAL ============ */
.modalbg {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: color-mix(in srgb, #05100E 62%, transparent);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fundoentra .14s ease-out;
}
.modalbg[hidden] { display: none; }
@keyframes fundoentra { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  animation: modalentra .17s cubic-bezier(.2, .8, .3, 1);
  overflow: hidden;
}
@keyframes modalentra { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

.modal > header { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line-soft); }
.modal > header h3 { font-size: 16px; font-weight: 640; }
.modalx {
  margin-left: auto;
  background: none; border: 0;
  font-size: 15px;
  color: var(--ink-3);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  line-height: 1;
}
.modalx:hover { background: var(--surface-3); color: var(--ink); }
.modalbody { padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; font-size: 14px; }
.modal > footer { padding: 14px 18px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal .field { display: flex; flex-direction: column; gap: 6px; }
.modal .field label { font-size: 12.5px; font-weight: 620; color: var(--ink-2); }
.modal .field input,
.modal .field select,
.modal .field textarea {
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 14px;
}
.modal .field input:focus,
.modal .field select:focus,
.modal .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.modal .field textarea { min-height: 88px; resize: vertical; }
.modal .fieldrow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .aviso {
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 13px;
}
.modal.grande { max-width: 940px; }
.modal.grande .modalbody { padding: 0; }
.modal.grande .modalbody table { font-size: 13px; }
.modal.grande .modalbody .aviso { margin: 16px; }

.opcoes { display: flex; flex-direction: column; gap: 6px; }
.periodoop {
  display: flex; align-items: center; gap: 9px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color .13s, background .13s;
}
.periodoop:hover { border-color: var(--brand); background: var(--brand-soft); }

/* ============ AVISOS FLUTUANTES ============ */
.toasts {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 9px;
  align-items: flex-end;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 12px 15px;
  font-size: 13.5px;
  max-width: 350px;
  animation: toastin .18s cubic-bezier(.2, .8, .3, 1);
}
.toast.demo { border-left-color: var(--warn); }
.toast.erro { border-left-color: var(--crit); }
.toast.ok { border-left-color: var(--ok); }
.toast b { display: block; margin-bottom: 2px; font-weight: 640; }
.toast small { color: var(--ink-3); font-size: 12px; }
@keyframes toastin { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* ============ LISTA DE PACIENTES ============ */
.filtropac { min-width: 250px; }
.alfabeto { display: flex; flex-wrap: wrap; gap: 4px; }
.alfabeto button {
  min-width: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-xs);
  padding: 4px 8px;
  font-size: 12.5px;
  font-family: var(--mono);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.alfabeto button:hover { background: var(--surface-3); }
.alfabeto button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 700; }
.alfabeto button:disabled { opacity: .32; cursor: default; }
.pacnome { display: flex; align-items: center; gap: 10px; }
.pacnome .ini {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-strong);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; flex: none;
}
.pacnome b { font-weight: 620; }

/* =============================================================================
   PAINEL DA PLATAFORMA
   -----------------------------------------------------------------------------
   Visualmente parente do sistema da clínica, mas com sinal próprio: a barra
   superior ganha uma faixa de destaque para nunca haver dúvida sobre onde
   se está. Quem administra vê dados de vários clientes ao mesmo tempo.
   ========================================================================== */
.adminbadge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: var(--r-full);
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 650;
}

.app.admin .rail { --rail-active: var(--accent-soft); --rail-active-ink: var(--accent); }
.app.admin .navitem[aria-current="true"]::before { background: var(--accent); }
/* O painel da plataforma usa a marca em coral: quem tem os dois acessos
   percebe num relance em qual dos dois sistemas está. */
.app.admin .brandmark .glyph {
  background: linear-gradient(145deg, var(--accent-vivid), var(--accent));
  box-shadow: 0 2px 6px rgba(221, 90, 43, .22), 0 12px 26px -12px rgba(221, 90, 43, .45);
}
.app.admin .avatar { background: linear-gradient(145deg, var(--accent-vivid), var(--accent)); }

/* Faixa de alerta enquanto um acesso de suporte está aberto */
.supportbar {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 20px;
  background: var(--warn-soft);
  color: var(--warn);
  border-bottom: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  font-size: 13px;
  font-weight: 600;
}
.supportbar[hidden] { display: none; }
.supportbar .btn { margin-left: auto; }

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 15px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat .k { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 26px; font-weight: 660; letter-spacing: -.028em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--ink-3); }
.stat.destaque { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); background: linear-gradient(180deg, var(--brand-soft), var(--surface) 70%); }

/* Barra de filtros acima de tabelas longas */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}
.toolbar .search { max-width: 300px; }
.toolbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-full);
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { border-color: var(--brand); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 620; }

/* Linha de auditoria: monoespaçada para os campos técnicos alinharem */
.acao { font-family: var(--mono); font-size: 12px; color: var(--ink); }
/* O tipo de ator fica embaixo do nome, não colado nele */
.quem { display: flex; flex-direction: column; gap: 1px; }
.quem small { font-size: 11.5px; color: var(--ink-3); }
.impersonado { color: var(--accent); font-weight: 620; font-size: 11.5px; }

.jsonbox {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-2);
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
}

/* Ficha lateral da clínica */
.detailgrid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
.deflist { display: flex; flex-direction: column; }
.deflist .kv { padding: 9px 16px; }

/* ============ SEÇÕES DE APOIO ============ */
.section { display: flex; flex-direction: column; gap: 16px; }
.section > h2 { font-size: 24px; letter-spacing: -.02em; }
.section > .sublede { color: var(--ink-2); max-width: 70ch; }
.maptable { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.maptable table td:first-child { font-weight: 620; width: 25%; }
.maptable table td:nth-child(2) { color: var(--ink-2); }
.notecards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-xs);
}
.note h4 { font-size: 14px; font-weight: 640; }
.note p, .note li { font-size: 13.5px; color: var(--ink-2); }
.note ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.about { display: flex; flex-direction: column; gap: 26px; }
.about .section > h2 { font-size: 20px; }
footer.pagefoot { color: var(--ink-3); font-size: 13px; border-top: 1px solid var(--line); padding-top: 18px; }

/* =============================================================================
   MODO DEMONSTRAÇÃO
   -----------------------------------------------------------------------------
   A faixa fica no topo de tudo e não sai. Alguém precisa poder olhar a tela de
   relance e saber que aquilo não é o sistema de verdade.
   ========================================================================== */
.demobar {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 20px;
  background: var(--accent-soft);
  color: var(--accent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  font-size: 13px;
  position: relative;
  z-index: 60;
}
.demobar b { font-weight: 680; }
.demobar .btn { margin-left: auto; }

/* A altura da faixa sai do espaço da área rolável, senão o rodapé some. */
body.com-demobar.app-body .app { height: calc(100vh - 41px); min-height: 0; }
body.com-demobar.app-body .rail { height: calc(100vh - 41px); }

@media (max-width: 820px) {
  .demobar { font-size: 12px; padding: 8px 14px; }
  body.com-demobar.app-body .app,
  body.com-demobar.app-body .rail { height: auto; }
}

/* ============ AJUSTES DE TELA CHEIA ============ */
body.app-body { overflow: hidden; }
body.app-body .app { min-height: 100vh; height: 100vh; }
body.app-body .main { overflow: hidden; }
body.app-body .canvas { overflow-y: auto; flex: 1; }
body.app-body .rail { height: 100vh; overflow-y: auto; }

/* ============ ITENS CLICÁVEIS ============ */
.thumb, .auto .pill { cursor: pointer; }
tbody tr.clicavel { cursor: pointer; }

/* ============ RESPONSIVO ============ */
@media (max-width: 1180px) {
  .detailgrid { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .doc { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notecards { grid-template-columns: 1fr; }
  .thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .chatlayout { grid-template-columns: 1fr; }
  .conversas { border-right: 0; border-bottom: 1px solid var(--line); }
  .conversalista { max-height: 220px; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  body.app-body { overflow: auto; }
  body.app-body .app { height: auto; }
  body.app-body .rail { height: auto; }
  .rail {
    flex-direction: row;
    overflow-x: auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--rail-line);
    position: sticky; top: 0; z-index: 40;
  }
  .rail .navgroup { flex-direction: row; gap: 4px; }
  .navlabel, .railfoot { display: none; }
  .navitem { white-space: nowrap; }
  .navitem[aria-current="true"]::before { display: none; }
  .g4, .g3, .g2 { grid-template-columns: 1fr; }
  .agenda { min-width: 660px; }
  .agendawrap { overflow-x: auto; }
  .topbar { flex-wrap: wrap; }
  .searchwrap { order: 3; max-width: none; flex-basis: 100%; }
  .patienthead .stats { width: 100%; margin-left: 0; justify-content: space-between; gap: 12px; }
  .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============ IMPRESSÃO ============ */
@media print {
  .rail, .topbar, .toasts, .toolbar, .btn { display: none !important; }
  body, .main, .canvas { background: #FFFFFF; }
  .card { box-shadow: none; border-color: #CCCCCC; break-inside: avoid; }
}

/* O atributo hidden tem especificidade baixíssima: qualquer regra com display
   (como .btn { display: inline-flex }) o ignora e o elemento reaparece. Esta
   regra faz hidden valer sempre — foi assim que "Configurar servidor" vazou
   para a tela do cliente mesmo estando marcado como escondido. */
[hidden] { display: none !important; }

/* ==========================================================================
   Tesouraria: filtros, dias da conta corrente, gráfico de saldo e sinais de
   entrada e saída. Usa os mesmos tokens do resto, então acompanha o tema.
   ========================================================================== */

.filtros {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px;
}
.filtros label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.filtros input, .filtros select {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 10px;
}
.filtros input[type="search"] { min-width: 200px; }

/* ---- valores com sinal ---- */
.positivo { color: var(--ok); }
.negativo { color: var(--crit); }
td .positivo, td .negativo { font-variant-numeric: tabular-nums; }

/* ---- conta corrente: um cartão por dia, que abre ---- */
.diacaixa header.diahead {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  cursor: pointer; user-select: none;
}
.diacaixa header.diahead:hover { background: var(--surface-2); }
.diacaixa .diadata b { font-size: 14px; }
.diacaixa .diadata small { display: block; font-size: 11.5px; color: var(--ink-3); }
.diacaixa .diatotais { display: flex; gap: 18px; font-variant-numeric: tabular-nums; font-size: 13px; }
.diacaixa .diatotais .entrou { color: var(--ok); }
.diacaixa .diatotais .saiu { color: var(--crit); }

/* ---- alternador receita / despesa ---- */
.segmentado {
  display: flex; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); overflow: hidden; margin-bottom: 14px;
}
.segmentado button {
  flex: 1; border: 0; background: none; font: inherit; font-size: 13px;
  color: var(--ink-3); padding: 9px 12px; cursor: pointer;
}
.segmentado button.ativo { background: var(--brand); color: var(--brand-ink); font-weight: 600; }

/* ---- gráfico de saldo projetado ---- */
.grafico { padding: 14px 16px; }
.grafico svg { width: 100%; height: 170px; overflow: visible; }
.grafico .linha { fill: none; stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; }
.grafico .zero { stroke: var(--line); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.grafico .eixo {
  display: flex; justify-content: space-between; font-size: 11.5px;
  color: var(--ink-3); margin-top: 6px; font-family: var(--mono);
}

/* ---- aviso de caixa negativo ---- */
.card.aviso-crit {
  padding: 14px 16px; border-color: var(--crit);
  background: color-mix(in srgb, var(--crit) 8%, var(--surface));
}
.card.aviso-crit b { color: var(--crit); }
.card.aviso-crit p { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

/* ---- grade de 3 colunas ---- */
.grid.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

@media (max-width: 900px) {
  .grid.g3 { grid-template-columns: 1fr; }
  .diacaixa .diatotais { flex-direction: column; gap: 2px; text-align: right; }
}

/* ==========================================================================
   Odontograma: ferradura, vista frontal e o alternador entre elas.
   A cor diz a situação; o traço, o formato do dente.
   ========================================================================== */

.odajuda { font-size: 12.5px; color: var(--ink-3); padding: 0 16px 4px; line-height: 1.5; }

.odvistas {
  display: inline-flex; gap: 2px; margin: 4px 16px 10px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 3px;
}
.odvistas button {
  border: 1px solid transparent; background: none; font: inherit; font-size: 12.5px;
  color: var(--ink-3); padding: 6px 14px; border-radius: 5px; cursor: pointer;
}
.odvistas button:hover { color: var(--ink); }
.odvistas button[aria-selected="true"] {
  background: var(--surface); color: var(--ink); font-weight: 600;
  border-color: var(--line); box-shadow: var(--shadow-sm);
}

.oddesenho { padding: 4px 12px 8px; }
.odsvg { width: 100%; height: auto; display: block; }
.odsvg .meio { stroke: var(--line-soft); stroke-dasharray: 4 5; stroke-width: 1; }
.odsvg .lado {
  font-family: var(--mono); font-size: 9px; letter-spacing: .14em;
  fill: var(--ink-3); text-transform: uppercase;
}
.odsvg .ladosub { font-size: 8px; fill: var(--ink-3); opacity: .75; }
.odsvg .num {
  font-family: var(--mono); font-size: 9px; fill: var(--ink-3);
  text-anchor: middle; dominant-baseline: middle;
}

/* ---- o dente ---- */
.odsvg .dente { cursor: pointer; }
.odsvg .dente .coroa {
  fill: var(--surface); stroke: var(--ink-2); stroke-width: 1.1;
  stroke-linejoin: round; vector-effect: non-scaling-stroke;
}
.odsvg .dente .sulco {
  stroke: var(--ink-3); stroke-width: .7; opacity: .5; fill: none;
  vector-effect: non-scaling-stroke;
}
.odsvg .dente:hover .coroa { stroke: var(--brand); stroke-width: 1.8; }
.odsvg .dente:focus-visible { outline: none; }
.odsvg .dente:focus-visible .coroa { stroke: var(--brand); stroke-width: 2; }
.odsvg .dente.sel .coroa { stroke: var(--brand); stroke-width: 2.2; }
.odsvg .dente.sel .num { fill: var(--brand); font-weight: 700; }

/* ---- situação ---- */
.odsvg .dente.tratado .coroa  { fill: color-mix(in srgb, var(--ok) 26%, var(--surface));   stroke: var(--ok); }
.odsvg .dente.pendente .coroa { fill: color-mix(in srgb, var(--warn) 30%, var(--surface)); stroke: var(--warn); }
.odsvg .dente.atencao .coroa  { fill: color-mix(in srgb, var(--crit) 26%, var(--surface)); stroke: var(--crit); }
.odsvg .dente.ausente .coroa  { fill: var(--surface-3); stroke: var(--ink-3); stroke-dasharray: 3 2; opacity: .7; }
.odsvg .dente .x {
  stroke: var(--ink-3); stroke-width: 1.6; fill: none; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* ---- separador da vista combinada ---- */
.odseparador {
  display: flex; align-items: center; gap: 12px;
  margin: 6px 8px 10px; color: var(--ink-3);
}
.odseparador::before, .odseparador::after {
  content: ""; flex: 1; height: 1px; background: var(--line-soft);
}
.odseparador span { font-family: var(--mono); font-size: 9px; letter-spacing: .16em; }

/* ---- legenda ---- */
.odlegenda {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;
  padding: 10px 16px 14px; font-size: 12px; color: var(--ink-2);
}
.odlegenda span { display: inline-flex; align-items: center; gap: 6px; }
.odlegenda i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.odlegenda i.tratado  { background: var(--ok); }
.odlegenda i.pendente { background: var(--warn); }
.odlegenda i.atencao  { background: var(--crit); }
.odlegenda i.ausente  { background: var(--surface-3); border: 1px solid var(--ink-3); }

/* Linha de alerta do painel da plataforma: o que precisa de olho agora. */
.avisolinha {
  padding: 12px 16px; font-size: 13.5px; border-left: 3px solid var(--line);
  margin-bottom: 10px;
}
.avisolinha.ok   { border-left-color: var(--ok); color: var(--ink-2); }
.avisolinha.warn { border-left-color: var(--warn); }
.avisolinha.crit { border-left-color: var(--crit); color: var(--crit); font-weight: 600; }

/* ============ ASSISTENTE DE IA ============ */
/* O cartão do chat ocupa a altura útil da tela: conversa rola, formulário fica. */
.chatcard { display: flex; flex-direction: column; min-height: 420px; height: calc(100vh - 220px); }

.chatlog {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}

.chatmsg {
  max-width: 72%; padding: 10px 14px; font-size: 14px; line-height: 1.5;
  border-radius: var(--r-md); white-space: pre-line; overflow-wrap: break-word;
}
.chatmsg.minha {
  align-self: flex-end; background: var(--brand); color: var(--brand-ink);
  border-bottom-right-radius: var(--r-xs);
}
.chatmsg.dela {
  align-self: flex-start; background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line-soft); border-bottom-left-radius: var(--r-xs);
}
.chatmsg.digitando { color: var(--ink-3); letter-spacing: 2px; }

.chatvazio { margin: auto; text-align: center; max-width: 420px; color: var(--ink-2); }
.chatvazio b { display: block; font-size: 16px; color: var(--ink); margin-bottom: 6px; }
.chatvazio p { font-size: 13.5px; margin: 0; }

.chatform {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 14px 16px; border-top: 1px solid var(--line-soft);
}
.chatform textarea {
  flex: 1; resize: none; min-height: 42px; max-height: 140px;
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 12px;
}
.chatform textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

.chatnota {
  padding: 8px 16px 12px; font-size: 12px; color: var(--ink-3); text-align: center;
}

/* Resumo IA na abertura da ficha do paciente */
.resumoia { margin-bottom: 18px; border-left: 3px solid var(--brand); }
.resumoia .resumoiatexto { font-size: 13.5px; line-height: 1.65; }
