/* ---------- Fontes (arquivos em /fonts, licença SIL Open Font License) ----------
   Fontes variáveis, só o alfabeto latino (cobre o português) */
@font-face {
  font-family: 'Figtree'; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(/fonts/figtree.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: 'Bricolage Grotesque'; font-style: normal; font-weight: 200 800; font-stretch: 75% 100%; font-display: swap;
  src: url(/fonts/bricolage-grotesque.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;
}

/* =====================================================================
   VINDIX — gestão para clínicas multidisciplinares
   Identidade: cada disciplina tem sua cor. A marca da Vindix aparece na
   entrada e no rodapé; dentro do sistema, a cor de ação vem da logo da clínica.
   ===================================================================== */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  /* Marca Vindix */
  --vx-ameixa: #5b2a86;
  --vx-jade:   #10a37f;
  --vx-ceu:    #2f7de1;
  --vx-coral:  #f2634a;
  --vx-sol:    #f7b32b;

  /* Superfícies e tinta */
  --bg:          #f3f3f9;
  --surface:     #ffffff;
  --surface-2:   #f7f6fb;
  --surface-3:   #eeecf6;
  --ink:         #221a3d;
  --ink-2:       #575170;
  --ink-3:       #827c99;
  --line:        #e4e1ee;
  --line-strong: #cdc8de;

  /* Cor da clínica (definida pelo JS a partir da logo; padrão = ameixa) */
  --brand:      var(--brand-claro, #5b2a86);
  --brand-ink:  #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 11%, var(--surface));
  --brand-line: color-mix(in srgb, var(--brand) 30%, var(--surface));

  /* Estados da interface */
  --ok:      #0e8a4f;  --ok-soft:     #e3f5ec;
  --aviso:   #9a6200;  --aviso-soft:  #fdf1d6;
  --perigo:  #c2352f;  --perigo-soft: #fbe6e4;
  --info:    #2464c4;  --info-soft:   #e3eefc;

  /* Cor de cada seção do menu */
  --sec-semana:   #10a37f;
  --sec-agenda:   #2f7de1;
  --sec-consultas:#f2634a;
  --sec-resumo:   #7a3fbf;
  --sec-pessoas:  #e8a10f;
  --sec-esp:      #d6458b;
  --sec-usuarios: #5d6b86;
  --sec-espera:   #0e9aa7;
  --sec-financeiro:#0e8a4f;

  /* Gráficos (paleta validada: realizadas x canceladas) */
  --viz-1:    #2a78d6;
  --viz-2:    #d03b3b;
  --viz-grid: #e7e5ef;
  --viz-axis: #c9c4d8;
  --heat-0:   #eef0f7;
  --heat-1:   #b7d3f6;
  --heat-2:   #86b6ef;
  --heat-3:   #3987e5;
  --heat-4:   #1c5cab;
  --heat-5:   #0d366b;

  --font-ui:      "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;

  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --r-pill: 999px;

  --sombra-flutuante: 0 18px 50px -12px rgba(34, 26, 61, .28);
  --foco: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent);

  --sidebar: 268px;
  --rail: 76px;
  /* Curva de saída forte: começa rápido, a interface responde na hora */
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --t: 160ms var(--ease-out);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #110e1c; --surface: #1a1630; --surface-2: #201b39; --surface-3: #292343;
    --ink: #f1eef9; --ink-2: #bdb6d3; --ink-3: #8f88a8; --line: #2e2848; --line-strong: #40385f;
    --brand: var(--brand-escuro, #b48ae8); --brand-ink: #160f26;
    --ok: #4cc98a; --ok-soft: #12291f; --aviso: #f2c04d; --aviso-soft: #2c2410;
    --perigo: #f07a73; --perigo-soft: #2f1517; --info: #77aef5; --info-soft: #14233b;
    --viz-1: #3987e5; --viz-2: #e66767; --viz-grid: #2a2542; --viz-axis: #3d365a;
    --heat-0: #241f3b; --heat-1: #184f95; --heat-2: #1c5cab; --heat-3: #2a78d6; --heat-4: #5598e7; --heat-5: #9ec5f4;
    --sombra-flutuante: 0 18px 50px -12px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #110e1c; --surface: #1a1630; --surface-2: #201b39; --surface-3: #292343;
  --ink: #f1eef9; --ink-2: #bdb6d3; --ink-3: #8f88a8; --line: #2e2848; --line-strong: #40385f;
  --brand: var(--brand-escuro, #b48ae8); --brand-ink: #160f26;
  --ok: #4cc98a; --ok-soft: #12291f; --aviso: #f2c04d; --aviso-soft: #2c2410;
  --perigo: #f07a73; --perigo-soft: #2f1517; --info: #77aef5; --info-soft: #14233b;
  --viz-1: #3987e5; --viz-2: #e66767; --viz-grid: #2a2542; --viz-axis: #3d365a;
  --heat-0: #241f3b; --heat-1: #184f95; --heat-2: #1c5cab; --heat-3: #2a78d6; --heat-4: #5598e7; --heat-5: #9ec5f4;
  --sombra-flutuante: 0 18px 50px -12px rgba(0, 0, 0, .6);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); margin: 0; line-height: 1.15; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--foco); border-radius: var(--r-s); }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }
.icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.theme-icon--sun { display: none; }
:root[data-theme="dark"] .theme-icon--sun { display: block; }
:root[data-theme="dark"] .theme-icon--moon { display: none; }

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

/* ---------- Telas ---------- */
.screen { display: none; min-height: 100dvh; }
.screen--active { display: block; }

/* ---------- Marca Vindix ---------- */
.vx-logo { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.vx-logo__mark { width: 44px; height: 44px; flex-shrink: 0; }
.vx-logo__word {
  font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1; letter-spacing: -.045em;
  font-variation-settings: "wdth" 85;
}
.vx-logo--hero .vx-logo__mark { width: 64px; height: 64px; }
.vx-logo--hero .vx-logo__word { font-size: 46px; }
.vx-logo--small { gap: 7px; }
.vx-logo--small .vx-logo__mark { width: 24px; height: 24px; }
.vx-logo--small .vx-logo__word { font-size: 17px; }

/* ---------- Login ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); min-height: 100dvh; }
.login__arte {
  position: relative; overflow: hidden;
  background: var(--vx-ameixa);
  color: #fff;
  padding: clamp(28px, 5vw, 64px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.login__arte .vx-logo { color: #fff; }
.login__mosaico { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.login__mosaico { opacity: .9; }
.login__frase { position: relative; max-width: 540px; }
.login__frase h1 {
  color: #fff; font-size: clamp(30px, 3.6vw, 48px); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; text-wrap: balance;
}
.login__frase p { margin-top: 14px; color: rgba(255, 255, 255, .82); font-size: 16px; max-width: 42ch; }
.login__recursos { position: relative; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 620px; }
.login__recursos li {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-m);
  background: rgba(34, 14, 56, .38); border: 1px solid rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.login__recursos .icon { width: 20px; height: 20px; margin-top: 1px; color: #fff; opacity: .9; }
.login__recursos span { display: grid; gap: 2px; font-size: 13px; line-height: 1.35; color: rgba(255, 255, 255, .78); }
.login__recursos strong { font-size: 14px; font-weight: 700; color: #fff; }
.login__form-area { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); position: relative; }
.login__card { width: 100%; max-width: 380px; }
.login__card h2 { font-size: 28px; font-weight: 700; }
.login__card > p { color: var(--ink-2); margin: 6px 0 26px; }
.login__tema { position: absolute; top: 16px; right: 16px; }
.login__esqueci { display: block; margin: 18px auto 0; padding: 6px 10px; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--brand); cursor: pointer; border-radius: var(--r-s); }
.login__esqueci:hover { text-decoration: underline; }
.login__recursos-cel { display: none; }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login__arte { min-height: 240px; padding: 24px; gap: 28px; }
  .vx-logo--hero .vx-logo__mark { width: 48px; height: 48px; }
  .vx-logo--hero .vx-logo__word { font-size: 36px; }
  .login__frase h1 { font-size: 30px; }
  .login__recursos { display: none; }
}

/* ---------- Formulários ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--col-2 { grid-column: span 2; }
@media (max-width: 520px) { .field--col-2 { grid-column: auto; } }
.field__label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field__hint { font-size: 13px; color: var(--ink-3); }
.field__error { display: none; font-size: 13px; color: var(--perigo); }
.field.has-error .field__error { display: block; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--perigo); }

.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: var(--r-s);
  transition: border-color var(--t), box-shadow var(--t);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
@media (max-width: 760px) { .input, .select, .textarea, .search__input { font-size: 16px; } }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--foco); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--ink-2); cursor: not-allowed; }
.input[readonly] { background: var(--surface-2); }
.input-group { position: relative; }
.input-group .input { padding-right: 46px; }
.input-group .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* Caixa de seleção própria: mesma borda, raio e cor de marca do resto dos campos */
.check input {
  appearance: none; -webkit-appearance: none; flex-shrink: 0; margin: 0; cursor: pointer;
  width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--line-strong); background: var(--surface) center / 14px 14px no-repeat;
  transition: background-color 140ms ease, border-color 140ms ease, transform 120ms ease-out;
}
.check input[type="radio"] { border-radius: 50%; }
.check:hover input:not(:disabled) { border-color: var(--brand); }
.check input:active:not(:disabled) { transform: scale(.92); }
.check input:checked {
  background-color: var(--brand); border-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E");
}
.check input[type="radio"]:checked { background-image: none; box-shadow: inset 0 0 0 4px var(--surface); }
.check input:focus-visible { box-shadow: var(--foco); outline: none; }
.check input:disabled { cursor: not-allowed; background-color: var(--surface-2); }
.check input:checked:disabled { background-color: var(--brand-line); border-color: var(--brand-line); }
.check:has(input:disabled) { cursor: not-allowed; }

/* Barras de rolagem finas, no tom da interface (claro e escuro) */
html { scrollbar-color: var(--line-strong) transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--ink-3); }
::-webkit-scrollbar-corner { background: transparent; }

.alerta {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-s);
  background: var(--perigo-soft); color: var(--perigo); font-size: 14px; font-weight: 500;
}
.login__card .alerta {
  margin-bottom: 18px; padding: 12px 14px 12px 12px; border-radius: var(--r-s);
  background: var(--brand-soft); color: var(--ink); font-weight: 550;
  box-shadow: inset 3px 0 0 #f2634a;
  animation: aviso-entra 180ms var(--ease-out);
}
.login__card .alerta .icon { color: #f2634a; flex-shrink: 0; margin-top: 1px; }
@keyframes aviso-entra { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .login__card .alerta { animation: none; } }
.nota {
  padding: 12px 14px; border-radius: var(--r-s); background: var(--brand-soft);
  border-left: 3px solid var(--brand); color: var(--ink); font-size: 14px;
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--r-pill);
  font-weight: 650; font-size: 14px; white-space: nowrap; cursor: pointer;
  border: 1.5px solid transparent; transition: background var(--t), border-color var(--t), color var(--t), transform var(--t);
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--brand); color: var(--brand-ink); }
.btn--primary:hover { background: color-mix(in srgb, var(--brand) 86%, var(--ink)); }
.btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn--secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn--ghost { background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn--block { width: 100%; min-height: 46px; font-size: 15px; }
.btn[aria-busy="true"] { opacity: .7; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: girar .7s linear infinite;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--google-on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0;
  border: 0; border-radius: var(--r-s); background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background var(--t), color var(--t), transform var(--t);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn--danger:hover { background: var(--perigo-soft); color: var(--perigo); }
.icon-btn[aria-busy="true"] { opacity: .5; pointer-events: none; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Estrutura do app ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); z-index: 40;
}
.cliente {
  display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
}
.cliente__logo {
  width: 48px; height: 48px; flex-shrink: 0; border-radius: 12px; overflow: hidden;
  display: grid; place-items: center;
}
.cliente__logo:has(.cliente__inicial) { background: var(--brand-soft); }
.cliente__logo img { width: 100%; height: 100%; object-fit: contain; }
.cliente__inicial { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--brand); }
.cliente__nome { font-family: var(--font-display); font-weight: 700; font-size: 17px; line-height: 1.15; }
.cliente__sub { font-size: 12.5px; color: var(--ink-3); }
.cliente__texto { min-width: 0; }
.cliente__nome, .cliente__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__fechar { display: none; margin-left: auto; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 18px; }
.nav__group { display: flex; flex-direction: column; gap: 2px; }
.nav__group-title { font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding: 0 10px 6px; }
.nav__item {
  --cor: var(--ink-3);
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 7px 10px;
  border: 0; border-radius: var(--r-m); background: transparent; color: var(--ink-2);
  font-weight: 600; font-size: 14.5px; text-align: left; cursor: pointer;
  transition: background var(--t), color var(--t);
}
.nav__icone {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--cor); transition: background var(--t), color var(--t);
}
.nav__item:hover { background: var(--surface-2); color: var(--ink); }
.nav__item--active { background: var(--surface-2); color: var(--ink); }
.nav__item--active .nav__icone { background: var(--cor); color: #fff; }
.nav__rotulo { flex: 1; min-width: 0; }
.nav__badge {
  min-width: 22px; padding: 1px 7px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700;
  background: var(--surface-3); color: var(--ink-2); text-align: center;
}
.nav__item[data-page="semana"],         .tabbar__item[data-page="semana"]        { --cor: var(--sec-semana); }
.nav__item[data-page="agenda"],         .tabbar__item[data-page="agenda"]        { --cor: var(--sec-agenda); }
.nav__item[data-page="consultas"],      .tabbar__item[data-page="consultas"]     { --cor: var(--sec-consultas); }
.nav__item[data-page="resumo"],         .tabbar__item[data-page="resumo"]        { --cor: var(--sec-resumo); }
.nav__item[data-page="pessoas"],        .tabbar__item[data-page="pessoas"]       { --cor: var(--sec-pessoas); }
.nav__item[data-page="especialidades"], .tabbar__item[data-page="especialidades"]{ --cor: var(--sec-esp); }
.nav__item[data-page="usuarios"],       .tabbar__item[data-page="usuarios"]      { --cor: var(--sec-usuarios); }
.nav__item[data-page="espera"],         .tabbar__item[data-page="espera"]        { --cor: var(--sec-espera); }
.nav__item[data-page="financeiro"],     .tabbar__item[data-page="financeiro"]    { --cor: var(--sec-financeiro); }

.sidebar__rodape { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.usuario { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 14px;
}
.usuario__texto { flex: 1; min-width: 0; }
.usuario__nome { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario__papel { font-size: 12.5px; color: var(--ink-3); }
.sidebar__plataforma { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-3); font-size: 12px; }
.sidebar__plataforma .vx-logo { color: var(--ink-2); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 12px clamp(16px, 3vw, 32px); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
}
.topbar__menu { display: none; }
.topbar__titulo { font-family: var(--font-display); font-weight: 700; font-size: 17px; flex: 1; min-width: 0; }
.topbar__acoes { display: flex; align-items: center; gap: 6px; }
.topbar__cliente { display: none; }

.content { padding: 8px clamp(16px, 3vw, 32px) 48px; max-width: 1400px; width: 100%; }

.backdrop {
  position: fixed; inset: 0; background: rgba(17, 12, 30, .45); z-index: 35;
  opacity: 0; pointer-events: none; transition: opacity var(--t);
}
.backdrop.is-open { opacity: 1; pointer-events: auto; }

/* Barra inferior (celular) */
.tabbar { display: none; }

/* Tablet: menu vira trilho de ícones */
@media (max-width: 1180px) and (min-width: 761px) {
  .app { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .cliente { padding: 14px; justify-content: center; }
  .cliente__texto, .nav__group-title, .nav__rotulo, .nav__badge,
  .usuario__texto, .sidebar__plataforma .vx-logo__word, .sidebar__plataforma > span:first-child { display: none; }
  .nav { padding: 12px 10px; }
  .nav__item { justify-content: center; padding: 6px; }
  .usuario { flex-direction: column; }
  .sidebar__plataforma { justify-content: center; }
}

/* Celular: menu lateral em gaveta + barra inferior */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); transform: translateX(-102%);
    transition: transform var(--t); box-shadow: var(--sombra-flutuante);
  }
  .sidebar.is-open { transform: none; }
  .sidebar__fechar { display: inline-grid; }
  .topbar__menu { display: inline-grid; }
  .topbar { padding: 10px 14px; background: var(--surface); border-bottom-color: var(--line); }
  .topbar__cliente { display: block; width: 32px; height: 32px; border-radius: 9px; overflow: hidden; background: #fff; border: 1px solid var(--line); flex-shrink: 0; }
  .topbar__cliente img, .topbar__cliente svg { width: 100%; height: 100%; object-fit: contain; display: block; }
  .topbar .only-desktop { display: none; }
  .content { padding: 14px 14px calc(92px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabbar__item {
    --cor: var(--ink-3);
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
    border: 0; background: transparent; color: var(--ink-3); font-size: 11.5px; font-weight: 600; cursor: pointer; border-radius: var(--r-s);
  }
  .tabbar__item .nav__icone { width: 30px; height: 30px; border-radius: 9px; }
  .tabbar__item--active { color: var(--ink); }
  .tabbar__item--active .nav__icone { background: var(--cor); color: #fff; }
}

/* ---------- Cabeçalho de página ---------- */
.page { display: none; }
.page--active { display: block; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 20px; }
.page-head__title { font-size: clamp(26px, 3.2vw, 36px); font-weight: 750; letter-spacing: -.03em; }
.page-head__desc { color: var(--ink-2); margin-top: 6px; max-width: 62ch; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .page-head { margin-top: 0; }
  .page-head__actions { width: 100%; }
  .page-head__actions .btn--primary { flex: 1; }
  .only-desktop { display: none; }
}

/* ---------- Painéis, filtros e abas ---------- */
.painel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.painel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 18px 0; }
.painel__titulo { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.painel__sub { color: var(--ink-3); font-size: 13.5px; margin-top: 2px; }
.painel__corpo { padding: 16px 18px 18px; }

.filtros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.filtros .field { min-width: 150px; flex: 0 1 190px; }
.filtros__fim { margin-left: auto; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface-3); margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  border: 0; background: transparent; padding: 7px 16px; border-radius: var(--r-pill);
  font-weight: 650; font-size: 14px; color: var(--ink-2); cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab--active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(34, 26, 61, .12); }

.search { position: relative; display: flex; align-items: center; }
.search .icon { position: absolute; left: 12px; color: var(--ink-3); pointer-events: none; }
.search__input {
  width: min(320px, 100%); min-height: 40px; padding: 8px 14px 8px 38px;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface);
}
.search__input:focus { outline: none; border-color: var(--brand); box-shadow: var(--foco); }

/* ---------- Tabelas (viram cartões no celular) ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.table-wrap__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line);
}
.table-wrap__title { display: flex; align-items: baseline; gap: 10px; font-weight: 700; }
.table-wrap__count { color: var(--ink-3); font-weight: 500; font-size: 14px; }
.table-wrap__tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th {
  text-align: left; font-weight: 600; font-size: 13px; color: var(--ink-3);
  padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.td-date { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.td-actions { text-align: right; white-space: nowrap; }
.td-actions .icon-btn { width: 34px; height: 34px; }
.mais-acoes { display: inline-block; vertical-align: middle; }
.mais-acoes [data-mais][aria-expanded="true"] { background: var(--surface-3); color: var(--ink); }
.mais-acoes__menu {
  position: fixed; z-index: 60; min-width: 220px; padding: 6px; display: grid; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
  box-shadow: 0 12px 32px rgba(34, 26, 61, .16), 0 2px 6px rgba(34, 26, 61, .08);
  transform-origin: top right; animation: menu-entra 140ms cubic-bezier(.23, 1, .32, 1);
}
.mais-acoes__menu[data-lado="cima"] { transform-origin: bottom right; }
@keyframes menu-entra { from { opacity: 0; transform: scale(.96); } }
.td-actions .mais-acoes__menu .icon-btn {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  width: 100%; height: auto; min-height: 38px; padding: 8px 10px; font-size: 14px; font-weight: 550; text-align: left; white-space: nowrap;
}
.mais-acoes__menu .icon-btn::after { content: attr(title); }
.mais-acoes__menu .icon-btn--danger { color: var(--perigo); }
@media (prefers-reduced-motion: reduce) { .mais-acoes__menu { animation: none; } }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .table-wrap { background: transparent; border: 0; overflow: visible; }
  .table-wrap__head { padding: 0 0 12px; border: 0; }
  .table-wrap__tools, .search, .search__input { width: 100%; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m);
    padding: 10px 14px; margin-bottom: 10px;
  }
  .tbl tbody tr:hover { background: var(--surface); }
  .tbl td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl td::before { content: attr(data-label); color: var(--ink-3); font-size: 13px; text-align: left; flex-shrink: 0; }
  .tbl td:first-child { font-size: 16px; text-align: left; }
  .tbl td:first-child::before { display: none; }
  .tbl td.td-actions { justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
  .tbl td.td-actions::before { display: none; }
}

/* ---------- Selos ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 650; background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.badge .icon { width: 12px; height: 12px; }
.badge--success { background: var(--ok-soft); color: var(--ok); }
.badge--warning { background: var(--aviso-soft); color: var(--aviso); }
.badge--danger  { background: var(--perigo-soft); color: var(--perigo); }
.badge--info    { background: var(--info-soft); color: var(--info); }
.badge--accent  { background: var(--brand-soft); color: var(--brand); }
.badge--esp { background: color-mix(in srgb, var(--esp, var(--brand)) 14%, var(--surface)); color: var(--ink); }
.badge--esp::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--esp, var(--brand)); }
.cor-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }

/* ---------- Estados vazios, erro e carregamento ---------- */
.state { text-align: center; padding: 44px 20px; color: var(--ink-2); }
.state__icon {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.state__icon .icon { width: 24px; height: 24px; }
.state h4 { font-size: 18px; margin-bottom: 4px; }
.state--error .state__icon { background: var(--perigo-soft); color: var(--perigo); }
.state--compact { padding: 22px 12px; }
.skeleton-rows { padding: 8px 18px; }
.sk-row { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.sk-bar { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: brilho 1.2s linear infinite; }
@keyframes brilho { to { background-position: -200% 0; } }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--brand); animation: girar .8s linear infinite; }

/* ---------- Modais (folha inferior no celular) ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: none; }
.modal.is-open { display: grid; place-items: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(17, 12, 30, .5); }
.modal__panel {
  position: relative; width: min(560px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-l); box-shadow: var(--sombra-flutuante); animation: abrir 200ms var(--ease-out);
}
.modal__panel--wide { width: min(820px, 100%); }
@keyframes abrir { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 8px; }
.modal__eyebrow { display: none; }
.modal__title { font-size: 22px; font-weight: 700; }
.modal__body { padding: 8px 22px 22px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.modal__foot--fixo {
  position: sticky; bottom: -22px; margin: 18px -22px -22px; padding: 14px 22px 22px;
  background: var(--surface); box-shadow: 0 -1px 0 var(--line); align-items: center;
}
.modal__foot-nota { margin-right: auto; font-size: 13px; color: var(--ink-2); }
.modal__foot-nota::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--aviso); margin-right: 7px; vertical-align: 1px; }
.modal-tabs {
  display: flex; gap: 2px; margin-bottom: 18px; box-shadow: inset 0 -1px 0 var(--line);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.modal-tabs::-webkit-scrollbar { display: none; }
.modal-tab {
  border: 0; background: transparent; padding: 10px 14px; font-weight: 650; font-size: 14px; color: var(--ink-3);
  border-bottom: 2.5px solid transparent; cursor: pointer; white-space: nowrap;
}
.modal-tab[hidden] { display: none; }
.modal-tab:hover { color: var(--ink); }
.modal-tab--active { color: var(--ink); border-bottom-color: var(--brand); }
.modal-tab-panel { display: none; }
.modal-tab-panel--active { display: block; }
.modal-section { margin-bottom: 20px; }
.modal-section__title { font-weight: 700; margin-bottom: 8px; }
@media (max-width: 760px) {
  .modal.is-open { place-items: end center; padding: 0; }
  .modal__panel, .modal__panel--wide { width: 100%; max-height: 92dvh; border-radius: var(--r-l) var(--r-l) 0 0; animation-name: subir; }
  .modal__body { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .modal__foot .btn { flex: 1; }
  .modal__foot--fixo { flex-wrap: wrap; bottom: calc(-22px - env(safe-area-inset-bottom)); padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .modal__foot-nota { flex-basis: 100%; }
}
@keyframes subir { from { transform: translateY(100%); } to { transform: none; } }

/* Modal obrigatório (troca de senha): sem fechar pelo X ou Cancelar */
.modal[data-bloqueado] .modal__head [data-modal-close],
.modal[data-bloqueado] .modal__foot [data-modal-close] { display: none; }

/* ---------- Avisos (toasts) ---------- */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 80; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 12px 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--info);
  border-radius: var(--r-m); box-shadow: var(--sombra-flutuante); animation: abrir 180ms ease-out;
}
.toast--success { border-left-color: var(--ok); }
.toast--error   { border-left-color: var(--perigo); }
.toast--warning { border-left-color: var(--aviso); }
.toast__icon { color: var(--ink-2); padding-top: 1px; }
.toast--success .toast__icon { color: var(--ok); }
.toast--error .toast__icon { color: var(--perigo); }
.toast--warning .toast__icon { color: var(--aviso); }
.toast__body { flex: 1; min-width: 0; }
.toast__title { font-weight: 700; font-size: 14px; }
.toast__msg { font-size: 13.5px; color: var(--ink-2); }
.toast__close { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; padding: 2px; }
.toast--closing { opacity: 0; transform: translateX(10px); transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out); }
@media (max-width: 760px) { .toasts { top: auto; bottom: calc(84px + env(safe-area-inset-bottom)); right: 12px; left: 12px; width: auto; } }

/* ---------- Histórico ---------- */
.hist-list { display: flex; flex-direction: column; gap: 10px; }
.hist-card { border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.hist-card__header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--surface-2); font-size: 13.5px; }
.hist-card__campo { font-weight: 700; font-size: 14px; color: var(--brand); }
.hist-card__date { color: var(--ink-2); font-variant-numeric: tabular-nums; margin-left: auto; }
.hist-card__usr { color: var(--ink-3); }
.hist-card__valores { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; padding: 12px 14px; }
.hist-card__valor { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hist-card__label { font-size: 12.5px; color: var(--ink-3); }
.hist-valor-ant, .hist-valor-nov { padding: 6px 10px; border-radius: var(--r-s); font-size: 14px; word-break: break-word; white-space: pre-wrap; }
.hist-valor-ant { background: var(--perigo-soft); color: var(--perigo); text-decoration: line-through; text-decoration-thickness: 1px; }
.hist-valor-nov { background: var(--ok-soft); color: var(--ok); }
.hist-card__blob { margin: 0; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; font: 14px/1.6 var(--font-ui); color: var(--ink-2); }
.hist-card--delete .hist-card__header { background: var(--perigo-soft); }
.hist-card--insert .hist-card__header { background: var(--ok-soft); }
@media (max-width: 520px) { .hist-card__valores { grid-template-columns: 1fr; } .hist-card__valores > .icon { display: none; } }

/* ---------- Vínculos e permissões ---------- */
.relacao-list { display: flex; flex-direction: column; gap: 8px; }
.relacao-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 10px 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2);
}
.relacao-item__label { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.perm-tag {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 8px 10px 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2);
}
.perm-tag__name { font-weight: 650; font-size: 14px; }
.perm-tag__tipo { font-size: 12.5px; color: var(--ink-3); }

/* ---------- Semana (agenda por profissional) ---------- */
.semana-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.semana-nav { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); }
.semana-periodo { font-family: var(--font-display); font-weight: 700; font-size: 17px; padding: 0 8px; min-width: 16ch; text-align: center; }
.semana-barra .select { width: auto; min-width: 220px; border-radius: var(--r-pill); }
.semana-legenda { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 14px; }

.grade { --hora-h: 56px; display: grid; grid-template-columns: 56px repeat(var(--dias, 7), minmax(120px, 1fr)); overflow: auto; max-height: calc(100dvh - 250px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
@media (min-width: 761px) {
  body:has(.page--active[data-page="semana"]) .main { height: 100dvh; overflow: hidden; }
  body:has(.page--active[data-page="semana"]) .content { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 20px; }
  .page--active[data-page="semana"] { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .page--active[data-page="semana"] .grade { flex: 1; min-height: 280px; max-height: none; }
}
.grade__canto { position: sticky; left: 0; top: 0; background: var(--surface); z-index: 3; border-bottom: 1px solid var(--line); }
.grade__dia {
  position: sticky; top: 0; z-index: 2; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line);
  background: var(--surface); display: flex; align-items: baseline; gap: 6px;
}
.grade__dia strong { font-family: var(--font-display); font-size: 20px; font-weight: 750; }
.grade__dia span { color: var(--ink-3); font-size: 13px; }
.grade__dia--hoje strong { color: var(--brand-ink); background: var(--brand); border-radius: 10px; padding: 0 7px; }
.grade__horas { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.grade__hora { height: var(--hora-h); padding: 2px 8px 0 0; text-align: right; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.grade__coluna {
  position: relative; border-left: 1px solid var(--line);
  background-image: linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% var(--hora-h);
}
.grade__coluna--hoje { background-color: color-mix(in srgb, var(--brand) 5%, var(--surface)); }
.grade__agora { position: absolute; left: 0; right: 0; height: 2px; background: var(--perigo); z-index: 2; }
.grade__agora::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--perigo); }

.bloco {
  --esp: var(--brand);
  position: absolute; z-index: 1; overflow: hidden; text-align: left; cursor: pointer;
  border: 0; border-left: 4px solid var(--esp); border-radius: 8px; padding: 4px 6px 4px 8px;
  background: color-mix(in srgb, var(--esp) 16%, var(--surface)); color: var(--ink);
  font-size: 12.5px; line-height: 1.25; transition: box-shadow var(--t);
}
.bloco:hover, .bloco:focus-visible { box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--esp) 70%, transparent); z-index: 4; }
.bloco__hora { font-weight: 700; font-variant-numeric: tabular-nums; }
.bloco__estado .icon { width: 12px; height: 12px; vertical-align: -1px; stroke-width: 3; }
.bloco__pac { font-weight: 650; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bloco__sub { color: var(--ink-2); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bloco--REALIZADO { background: color-mix(in srgb, var(--esp) 30%, var(--surface)); }
.bloco--CANCELADO {
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface-3) 6px 12px);
  border-left-color: var(--ink-3); color: var(--ink-3);
}
.bloco--CANCELADO .bloco__pac { text-decoration: line-through; }
.bloco__estado { font-weight: 700; }
.bloco--REALIZADO .bloco__estado { color: var(--ok); }

.dia-lista { display: none; }
.dias-chips { display: none; }
@media (max-width: 760px) {
  .grade { display: none; }
  .semana-barra .select { width: 100%; }
  .semana-nav { width: 100%; justify-content: space-between; }
  .dias-chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 12px; }
  .dia-chip {
    border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-m); padding: 6px 0; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--ink-3);
  }
  .dia-chip strong { font-family: var(--font-display); font-size: 17px; color: var(--ink); }
  .dia-chip--ativo { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
  .dia-chip--ativo strong { color: var(--brand-ink); }
  .dia-chip__pontos { height: 6px; display: flex; gap: 2px; }
  .dia-chip__pontos i { width: 5px; height: 5px; border-radius: 50%; background: var(--esp, var(--ink-3)); }
  .dia-lista { display: flex; flex-direction: column; gap: 8px; }
  .dia-lista .bloco { position: static; width: 100%; padding: 10px 12px; font-size: 14px; }
}

/* Detalhe de um agendamento */
.detalhe { display: flex; flex-direction: column; gap: 10px; }
.detalhe__linha { display: flex; gap: 10px; align-items: center; color: var(--ink-2); }
.detalhe__linha strong { color: var(--ink); }
.detalhe__acoes { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line); margin-top: 6px; }

/* ---------- Resumo ---------- */
.periodos { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface-3); }
.periodo-btn { border: 0; background: transparent; padding: 7px 14px; border-radius: var(--r-pill); font-weight: 650; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.periodo-btn--ativo { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(34, 26, 61, .12); }

.kpis {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); margin-bottom: 16px; overflow: hidden;
}
.kpi { padding: 16px 18px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi__rotulo { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.kpi__valor { font-family: var(--font-display); font-size: 32px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; margin-top: 4px; }
.kpi__nota { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.kpi__delta--sobe { color: var(--ok); font-weight: 650; }
.kpi__delta--desce { color: var(--perigo); font-weight: 650; }
.kpi--destaque { background: var(--brand-soft); }
.kpi--destaque .kpi__valor { color: var(--brand); }
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpi:nth-child(4) { border-left: 0; } .kpi:nth-child(n+4) { border-top: 1px solid var(--line); } }
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi, .kpi:nth-child(4) { border-left: 0; border-top: 1px solid var(--line); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi:nth-child(even) { border-left: 1px solid var(--line); }
  .kpi__valor { font-size: 26px; }
}

.pendencia {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px;
  border-radius: var(--r-m); background: var(--aviso-soft); color: var(--ink);
}
.pendencia > .icon { color: var(--aviso); }
.pendencia p { flex: 1; min-width: 200px; }

.resumo-grade { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
.resumo-grade .painel--largo { grid-column: 1 / -1; }
@media (max-width: 1000px) { .resumo-grade { grid-template-columns: minmax(0, 1fr); } }

.viz { width: 100%; height: auto; display: block; overflow: visible; }
.viz text { font-family: var(--font-ui); font-size: 12px; fill: var(--ink-3); }
.viz .viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz .viz-base { stroke: var(--viz-axis); stroke-width: 1; }
.viz-legenda { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.viz-legenda span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legenda i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.viz-tip {
  position: fixed; z-index: 90; pointer-events: none; padding: 8px 12px; border-radius: var(--r-s);
  background: var(--ink); color: var(--surface); font-size: 13px; line-height: 1.4; box-shadow: var(--sombra-flutuante);
  max-width: 240px;
}
.viz-tabela { margin-top: 12px; font-size: 13.5px; }
.viz-tabela summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.viz-tabela .tbl { margin-top: 8px; font-size: 13.5px; }
@media (max-width: 760px) { .viz-tabela .tbl tr { margin-bottom: 6px; } }

/* Colunas empilhadas por semana (marcas finas, cantos arredondados só na ponta, 2px entre segmentos) */
.colunas { position: relative; height: 230px; padding: 0 0 26px 34px; }
.colunas__grade { position: absolute; inset: 0 0 26px 34px; }
.colunas__linha { position: absolute; left: 0; right: 0; border-top: 1px solid var(--viz-grid); }
.colunas__linha:first-child { border-top-color: var(--viz-axis); }
.colunas__linha span { position: absolute; right: calc(100% + 8px); top: -9px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.colunas__barras { position: relative; height: 100%; display: flex; align-items: stretch; gap: clamp(3px, 1vw, 10px); }
.coluna { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; position: relative; outline: none; }
.coluna__pilha { flex: 1; width: min(100%, 36px); display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.seg { display: block; width: 100%; min-height: 2px; }
.seg--1 { background: var(--viz-1); }
.seg--2 { background: var(--viz-2); }
.coluna__pilha .seg:first-child { border-radius: 4px 4px 0 0; }
.coluna:hover .coluna__pilha, .coluna:focus-visible .coluna__pilha { filter: brightness(1.08); }
.coluna:focus-visible { box-shadow: none; }
.coluna:focus-visible .coluna__pilha { box-shadow: var(--foco); border-radius: 4px; }
.coluna__rot { position: absolute; bottom: -24px; font-size: 12px; color: var(--ink-3); white-space: nowrap; }

.barras-h { display: flex; flex-direction: column; gap: 12px; }
.barra-h { display: grid; grid-template-columns: minmax(110px, 36%) 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.barra-h__nome { display: flex; align-items: center; gap: 8px; min-width: 0; }
.barra-h__nome span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-h__trilho { height: 14px; background: var(--surface-3); border-radius: 0 4px 4px 0; position: relative; }
.barra-h__valor { position: absolute; inset: 0 auto 0 0; background: var(--viz-1); border-radius: 0 4px 4px 0; }
.barra-h__num { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 4ch; text-align: right; }
.barra-h__extra { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 500; }

.prof-barra { display: grid; grid-template-columns: 96px 3ch; align-items: center; gap: 10px; justify-content: end; }
.prof-barra strong { text-align: right; }
.prof-barra__trilho { width: 96px; height: 8px; background: var(--surface-3); border-radius: 0 4px 4px 0; }
.tbl--prof { table-layout: fixed; }
.tbl--prof th:first-child, .tbl--prof td:first-child { width: 34%; }
.tbl--prof td:first-child div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prof-barra__valor { height: 100%; background: var(--viz-1); border-radius: 0 4px 4px 0; }

.heat { display: grid; grid-template-columns: 42px repeat(var(--colunas), minmax(18px, 1fr)); gap: 3px; font-size: 12px; color: var(--ink-3); overflow-x: auto; }
.heat__rot { display: flex; align-items: center; }
.heat__hora { text-align: center; font-variant-numeric: tabular-nums; }
.heat__cel { aspect-ratio: 1.4; border-radius: 4px; background: var(--heat-0); min-height: 16px; }
.heat__escala { display: flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--ink-3); }
.heat__escala i { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Evolução do paciente ---------- */
.escala { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.escala__opcao { position: relative; }
.escala__opcao input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.escala__opcao span {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; min-height: 58px; justify-content: center;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-m); text-align: center; font-size: 12.5px; color: var(--ink-2);
  transition: border-color var(--t), background var(--t), color var(--t);
}
.escala__opcao strong { font-family: var(--font-display); font-size: 18px; color: var(--ink); }
.escala__opcao input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--ink); }
.escala__opcao input:focus-visible + span { box-shadow: var(--foco); }
.escala__limpar { justify-self: start; }
@media (max-width: 520px) { .escala__opcao span { font-size: 11px; min-height: 52px; } }

.evo-barra { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.evo-barra .field { flex: 1 1 160px; }
.evo-resumo { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 12px; font-size: 14px; color: var(--ink-2); }
.evo-resumo strong { color: var(--ink); font-size: 18px; font-family: var(--font-display); }
.evo-grafico { position: relative; }
.evo-grafico svg { width: 100%; height: 240px; display: block; overflow: visible; }
.evo-grafico .linha-grade { stroke: var(--viz-grid); }
.evo-grafico .linha-base { stroke: var(--viz-axis); }
.evo-grafico .serie { stroke: var(--viz-1); stroke-width: 2; fill: none; }
.evo-grafico .ponto { fill: var(--viz-1); stroke: var(--surface); stroke-width: 2; }
.evo-grafico .alvo { fill: transparent; cursor: default; }
.evo-grafico .alvo:hover + .ponto, .evo-grafico .alvo:focus + .ponto { r: 6; }
.evo-grafico text { font: 12px var(--font-ui); fill: var(--ink-3); }

/* Visão do profissional (usuário vinculado a um cadastro de profissional) */
.so-meu { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.so-meu::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }

/* Toque: sem efeito de hover "grudado" depois do toque */
@media (hover: none) {
  .btn--secondary:hover { border-color: var(--line-strong); color: var(--ink); }
  .btn--ghost:hover, .icon-btn:hover, .nav__item:hover { background: transparent; }
  .tbl tbody tr:hover { background: transparent; }
}

/* ---------- Listas paginadas ---------- */
.lista-mais { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 14px; }
.input--busca { min-height: 38px; padding-top: 7px; padding-bottom: 7px; font-size: 14px; }
/* Paciente: busca e lista lado a lado (uma linha só) */
.campo-paciente__controles { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.campo-paciente__controles .input--busca { min-height: 44px; font-size: inherit; }
@media (max-width: 560px) { .campo-paciente__controles { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .lista-mais { border-top: 0; padding: 6px 0 4px; } .lista-mais .btn { width: 100%; } }

/* =====================================================================
   CELULAR: uma coluna, ação principal no polegar, nada de espaço perdido
   ===================================================================== */
@media (max-width: 760px) {
  /* Topo: logo da clínica sem quadro, título em uma linha (a página não repete o título) */
  .topbar { gap: 8px; }
  .topbar__cliente { background: transparent; border: 0; border-radius: 0; width: 30px; height: 30px; }
  .topbar__titulo { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar__acoes { gap: 2px; }
  .topbar__acoes .btn { min-height: 38px; width: 38px; padding: 0; border-radius: 50%; }
  .page-head { margin: 0 0 12px; gap: 8px; }
  .page-head > div:first-child { display: none; }
  .page-head__actions { width: 100%; gap: 6px; }
  .page-head__actions .only-desktop { display: inline; }
  .page-head__actions .btn:not(.btn--primary) { min-height: 36px; padding: 6px 14px 6px 12px; font-size: 13.5px; }

  /* Ação principal (Agendar, Cadastrar...): botão flutuante acima da barra inferior */
  .page-head__actions .btn--primary, .cal-barra .cal-agendar {
    position: fixed; z-index: 25; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom));
    flex: none; min-height: 52px; padding: 0 22px 0 18px; font-size: 15px;
    box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--brand) 70%, transparent), 0 2px 6px rgba(17, 12, 30, .18);
  }
  .page-head__actions .btn--primary .icon, .cal-barra .cal-agendar .icon { width: 20px; height: 20px; }
  .content { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }

  /* Filtros em grade de duas colunas; seleções na largura toda */
  .filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .filtros .field { min-width: 0; }
  .filtros .field:has(select), .filtros .periodos { grid-column: 1 / -1; }
  .periodos { display: grid; grid-template-columns: repeat(4, 1fr); border-radius: var(--r-m); }
  .periodo-btn { padding: 8px 4px; border-radius: 10px; font-size: 13px; }

  /* Abas em uma linha só, rolando de lado */
  .tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1 0 auto; white-space: nowrap; padding: 8px 14px; }

  /* Lista: busca e botão de atualizar na mesma linha */
  .table-wrap__head { gap: 8px; }
  .table-wrap__tools { flex-wrap: nowrap; }
  .table-wrap__tools .search { flex: 1; min-width: 0; }
  .tbl tr { padding: 12px 14px; }

  /* Avisos mais enxutos */
  .pendencia { padding: 12px 14px; gap: 10px; font-size: 14px; align-items: flex-start; }
  .pendencia p { min-width: 0; flex: 1 1 calc(100% - 34px); }
  .pendencia .btn { margin-left: 30px; min-height: 36px; }

  /* Semana (tela inicial): controles compactos para os atendimentos aparecerem logo */
  .semana-barra { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 10px; }
  .semana-nav { width: auto; }
  .semana-periodo { min-width: 0; font-size: 16px; padding: 0 4px; }
  #btn-semana-hoje { min-height: 46px; }
  .semana-barra .select { grid-column: 1; min-width: 0; }
  .semana-barra .check { font-size: 13px; white-space: nowrap; }
  .semana-legenda { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px 10px; padding: 0 14px; }
  .semana-legenda::-webkit-scrollbar { display: none; }
  .semana-legenda > * { flex-shrink: 0; }
  .dias-chips { gap: 5px; position: sticky; top: 58px; z-index: 5; background: var(--bg); padding: 6px 0; margin: 0 0 6px; }
  .dia-chip { padding: 7px 0 6px; min-height: 56px; }
  .dia-lista .bloco { border-radius: var(--r-m); padding: 12px 14px; }

  /* Login: cabeçalho curto, formulário logo na primeira tela */
  .login { position: relative; grid-template-rows: auto 1fr; }
  .login__arte { min-height: 0; padding: 22px 20px 26px; gap: 22px; justify-content: flex-start; }
  .login__mosaico { opacity: .35; }
  .vx-logo--hero .vx-logo__mark { width: 40px; height: 40px; }
  .vx-logo--hero .vx-logo__word { font-size: 30px; }
  .login__frase h1 { font-size: 26px; }
  .login__frase p { display: none; }
  .login__form-area { position: static; place-items: start center; padding: 28px 20px 32px; }
  .login__tema { top: 18px; right: 14px; color: #fff; }
  .login__card h2 { font-size: 24px; }
  .login__card > p { margin-bottom: 20px; }
  .login__form-area { align-content: start; gap: 28px; }
  .login__mosaico { opacity: .22; }
  .login__recursos-cel {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; max-width: 380px;
    list-style: none; margin: 0; padding: 18px 0 0; border-top: 1px solid var(--line);
  }
  .login__recursos-cel li {
    display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: var(--r-m);
    background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--ink-2); line-height: 1.25;
  }
  .login__recursos-cel .icon { width: 17px; height: 17px; color: var(--brand); }

  /* Modais (folha inferior): campos com respiro igual, escala de evolução legível */
  .modal__head { padding: 16px 18px 4px; }
  .modal__body { padding-left: 18px; padding-right: 18px; }
  .modal__foot--fixo { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
  .form-row { grid-template-columns: 1fr; gap: 16px; }
  .escala { gap: 4px; }
  .escala__opcao span { padding: 8px 2px; }
  .perm-grupo__itens { gap: 10px 16px; }
  .perm-grupo .check { min-height: 32px; }
}
@media (max-width: 380px) {
  .topbar__acoes #btn-theme-top { display: none; }
}

/* ---------- Agendamento repetido ---------- */
.repetir { display: flex; flex-direction: column; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2); }
.serie-icone { color: var(--ink-3); vertical-align: -2px; margin-left: 4px; }
.segmentado { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface-3); }
.segmentado label { position: relative; cursor: pointer; }
.segmentado input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.segmentado span { display: block; padding: 7px 14px; border-radius: var(--r-pill); font-weight: 650; font-size: 14px; color: var(--ink-2); }
.segmentado input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(34, 26, 61, .12); }
.segmentado input:focus-visible + span { box-shadow: var(--foco); }

/* ---------- Escolha entre opções ---------- */
.escolha__opcoes { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.escolha__opcoes .btn { width: 100%; }

/* ---------- Faltas ---------- */
.bloco--FALTOU { background: color-mix(in srgb, var(--aviso) 14%, var(--surface)); border-left-color: var(--aviso); }
.bloco--FALTOU .bloco__pac { text-decoration: line-through; text-decoration-color: var(--aviso); }
.pendencia__nomes { display: block; margin-top: 4px; color: var(--ink-2); font-size: 13.5px; }

/* ---------- Metas (plano terapêutico) ---------- */
#c-metas { display: flex; flex-direction: column; gap: 8px; }
.meta-linha { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-m); }
.meta-linha__texto { flex: 1 1 200px; font-weight: 550; }
.metas-sessao { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.nota-meta { display: inline-flex; gap: 4px; }
.nota-meta label { position: relative; }
.nota-meta input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.nota-meta span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line-strong); font-weight: 700; color: var(--ink-2); }
.nota-meta input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.nota-meta input:focus-visible + span { box-shadow: var(--foco); }
.evo-metas { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.evo-metas__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.meta-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-m); }
.meta-item__texto { flex: 1; min-width: 0; }
.meta-item__texto small { display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.meta-item--fechada { background: var(--surface-2); }
.meta-item--fechada .meta-item__texto > span { color: var(--ink-2); }
.meta-nova { display: grid; grid-template-columns: minmax(0, 210px) minmax(0, 1fr) auto; gap: 8px; align-items: end; }

/* ---------- Financeiro ---------- */
.valor-aberto { color: var(--perigo); font-weight: 700; }
.valor-credito { color: var(--ok); font-weight: 700; }
.fin-resumo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.fin-resumo__item { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-m); }
.fin-resumo__item span { display: block; color: var(--ink-3); font-size: 13px; }
.fin-resumo__item strong { font-family: var(--font-display); font-size: 22px; font-variant-numeric: tabular-nums; }
.fin-acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.fin-secao { margin-top: 18px; }
.fin-secao h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.modal-paciente { font-weight: 650; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-s); }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .meta-nova { grid-template-columns: 1fr; }
  .fin-resumo { grid-template-columns: 1fr; }
  .tbl tfoot { display: block; }
  .tbl tfoot tr { background: var(--surface-2); }
}

/* ---------- Impressão ---------- */
@media print {
  .sidebar, .topbar, .tabbar, .page-head__actions, .table-wrap__tools, .backdrop, .modal, .toasts { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}

/* Visão do profissional: o back já devolve só os dados dele, então o filtro por profissional some */
body[data-escopo="profissional"] #semana-terapeuta,
body[data-escopo="profissional"] .field:has(#resumo-terapeuta),
body[data-escopo="profissional"] .tab[data-filter="sem-vinculo"] { display: none; }

/* ---------- Vínculos e permissões guardados até salvar ---------- */
.relacao-item--novo { border-style: dashed; border-color: var(--brand-line); background: var(--brand-soft); }
.relacao-item__tag { font-size: 12px; font-weight: 650; color: var(--brand); margin-left: 4px; }
.tab__num { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: var(--aviso-soft); color: var(--aviso); font-size: 12px; }
.tab__num:empty { display: none; }

.perm-grupos { display: grid; gap: 10px; }
.perm-grupo { border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; }
.perm-grupo__titulo { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; margin-bottom: 8px; }
.perm-grupo__titulo .check { font-weight: 600; font-size: 13px; }
.perm-grupo__itens { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.perm-grupo .check input:disabled + span { color: var(--ink-3); }
.perm-grupo--especiais { display: grid; gap: 2px; padding-bottom: 8px; }
.perm-grupo--especiais .perm-grupo__titulo { margin-bottom: 4px; }
.perm-especial { display: grid; gap: 2px; padding: 8px 10px; margin: 0 -10px; border-radius: var(--r-s); }
.perm-especial .check { font-weight: 650; color: var(--ink); }
.perm-especial__desc { font-size: 13px; color: var(--ink-3); padding-left: 30px; }
.perm-especial--total:has(input:checked) { background: var(--brand-soft); }

.tbl tr.linha-inativa td { color: var(--ink-3); }
.tbl tr.linha-inativa td:first-child .usuario-linha > span:last-child { text-decoration: line-through; text-decoration-color: var(--ink-3); }

/* Rodapé fixo (Salvar) só nas abas que editam algo */
#modal-pessoa:has(.modal-tab--active[data-tab="evolucao-pessoa"]) #pessoa-foot,
#modal-pessoa:has(.modal-tab--active[data-tab="historico-pessoa"]) #pessoa-foot { display: none; }
#modal-usuario:has(.modal-tab--active[data-tab="usr-historico"]) #usuario-foot { display: none; }

/* ---------- Calendário (dia, semana e mês) ---------- */
.cal-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; }
.cal-barra .semana-periodo { min-width: 13ch; font-size: 16px; }
.cal-modos { flex-wrap: nowrap; }
.cal-modos span { padding: 6px 12px; }
.cal-filtros { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.cal-filtros .select { width: 190px; min-width: 0; border-radius: var(--r-pill); min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
.cal-filtros .check { font-size: 13.5px; white-space: nowrap; }
.cal-hoje { min-height: 40px; }
.cal-agendar { min-height: 40px; }
.semana-legenda:not(:empty) { margin: 10px 0 0; }
.grade__dia { font: inherit; color: inherit; text-align: left; cursor: pointer; border-top: 0; border-right: 0; }
.grade__dia:hover strong { color: var(--brand); }
.grade__dia--hoje:hover strong { color: var(--brand-ink); }
.grade__vazio { grid-column: 1 / -1; }
.grade--dia { grid-template-columns: 56px minmax(0, 1fr); }
.grade--dia .bloco { padding: 6px 10px 6px 12px; font-size: 13.5px; }
.grade--dia .bloco__pac { display: inline; margin-left: 6px; }
.grade--dia .bloco__sub { margin-top: 1px; }
.page[data-page="semana"][data-modo="mes"] .grade { display: none; }

.mes { flex: 1; min-height: 0; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.mes__grade { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(112px, 1fr); min-height: 100%; }
.mes__semana {
  position: sticky; top: 0; z-index: 1; padding: 8px 10px; background: var(--surface);
  border-bottom: 1px solid var(--line); color: var(--ink-3); font-size: 12.5px; font-weight: 650;
}
.mes__grade > .mes__semana { grid-row: 1; height: auto; }
.mes__grade { grid-template-rows: auto; }
.mes__dia { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 6px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mes__dia:nth-child(7n + 1) { border-left: 0; }
.mes__dia--fora { background: var(--surface-2); }
.mes__dia--fora .mes__num { color: var(--ink-3); }
.mes__num {
  align-self: flex-start; min-width: 28px; height: 28px; padding: 0 6px; border: 0; border-radius: 9px; background: transparent;
  font: inherit; font-family: var(--font-display); font-weight: 750; font-size: 15px; color: var(--ink); cursor: pointer;
}
.mes__num:hover { background: var(--surface-3); }
.mes__dia--hoje .mes__num { background: var(--brand); color: var(--brand-ink); }
.mes__itens { display: grid; gap: 2px; min-width: 0; }
.mes__item {
  --esp: var(--brand); display: block; width: 100%; min-width: 0; text-align: left; cursor: pointer;
  border: 0; border-left: 3px solid var(--esp); border-radius: 5px; padding: 2px 6px;
  background: color-mix(in srgb, var(--esp) 14%, var(--surface)); color: var(--ink);
  font: inherit; font-size: 12px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mes__item b { font-variant-numeric: tabular-nums; font-weight: 700; }
.mes__item:hover { background: color-mix(in srgb, var(--esp) 26%, var(--surface)); }
.mes__item--CANCELADO { text-decoration: line-through; color: var(--ink-3); border-left-color: var(--ink-3); background: var(--surface-2); }
.mes__mais { border: 0; background: none; padding: 1px 6px; text-align: left; font: inherit; font-size: 12px; font-weight: 650; color: var(--brand); cursor: pointer; }
.mes__mais:hover { text-decoration: underline; }
.mes__pontos { display: none; }

@media (min-width: 761px) {
  .page--active[data-page="semana"] .mes { display: block; }
  .page--active[data-page="semana"] .mes[hidden] { display: none; }
}

@media (max-width: 760px) {
  .cal-barra { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 10px; }
  .cal-barra .semana-nav { width: auto; }
  .cal-barra .semana-periodo { min-width: 0; font-size: 15.5px; padding: 0 2px; }
  .cal-hoje { min-height: 46px; }
  .cal-modos { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); }
  .cal-modos span { text-align: center; padding: 8px 0; }
  .cal-filtros { grid-column: 1 / -1; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .cal-filtros .select { min-width: 0; width: 100%; min-height: 44px; }
  .page[data-page="semana"]:not([data-modo="semana"]) .dias-chips { display: none; }
  /* Mês no celular: só o número e pontinhos; a lista do dia tocado aparece abaixo */
  .mes { overflow: visible; margin-bottom: 12px; }
  .mes__grade { grid-auto-rows: 52px; min-height: 0; }
  .mes__semana { position: static; padding: 6px 0; text-align: center; font-size: 11.5px; }
  .mes__dia { align-items: center; justify-content: center; gap: 2px; padding: 4px 0; cursor: pointer; }
  .mes__itens { display: none; }
  .mes__num { align-self: center; pointer-events: none; }
  .mes__dia--ativo { background: var(--brand-soft); }
  .mes__dia--ativo .mes__num { color: var(--brand); }
  .mes__dia--hoje.mes__dia--ativo .mes__num { color: var(--brand-ink); }
  .mes__pontos { display: flex; gap: 2px; height: 5px; }
  .mes__pontos i { width: 5px; height: 5px; border-radius: 50%; background: var(--esp, var(--ink-3)); }
  .semana-legenda { display: none; }
}

/* ---------- Foto de perfil ---------- */
.avatar--botao { border: 0; padding: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 14px; overflow: hidden; transition: box-shadow var(--t), transform var(--t); }
.avatar--botao:hover { box-shadow: 0 0 0 3px var(--brand-line); }
.avatar--botao:active { transform: scale(.95); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.avatar--foto { background: var(--surface-3); }
.avatar--grande { width: 120px; height: 120px; font-size: 40px; overflow: hidden; }
.foto-perfil { display: grid; justify-items: center; gap: 14px; text-align: center; padding-bottom: 22px; }
.foto-perfil .field__hint { max-width: 34ch; }
.foto-perfil__acoes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.foto-perfil__acoes label.btn { cursor: pointer; }
.foto-perfil__acoes:has(input:focus-visible) label.btn { box-shadow: var(--foco); }
#modal-foto .modal__panel { max-width: 420px; }

/* Foto na lista e no cadastro dos usuários */
.usuario-linha { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar--p { width: 32px; height: 32px; font-size: 12px; overflow: hidden; }
.linha-inativa .avatar--p { opacity: .55; }
.modal__titulo-foto { display: flex; align-items: center; gap: 12px; min-width: 0; }
.modal__titulo-foto .avatar--p { width: 40px; height: 40px; font-size: 14px; }

/* ---------- Rolagem no celular ---------- */
/* A página não "estica" além do fim (o efeito elástico arrastava junto a barra de baixo) */
html, body { overscroll-behavior-y: none; }
/* Com menu ou modal aberto, a página de trás fica parada (a posição é guardada e devolvida pelo JS) */
html.rolagem-travada body { position: fixed; left: 0; right: 0; overflow: hidden; }
/* Áreas que rolam sozinhas não passam a rolagem para a página quando chegam ao fim */
/* Só nas que rolam para baixo: nas que rolam para o lado, "contain" também prendia a roda do mouse */
.modal__body, .mes, .grade, .mais-acoes__menu { overscroll-behavior: contain; }
.table-scroll, .tabs, .modal-tabs, .semana-legenda, .heat, .dias-chips { overscroll-behavior-x: contain; overscroll-behavior-y: auto; }
.backdrop, .modal__backdrop { touch-action: none; }
/* Toque sem atraso de duplo toque em botões e itens clicáveis */
button, a, label, .btn, .icon-btn, .tabbar__item, .nav__item, .dia-chip, .mes__dia, .bloco { touch-action: manipulation; }
.tabbar { touch-action: none; }
@media (max-width: 760px) {
  /* Menu lateral igual ao desktop: só os itens rolam; a clínica no topo e o usuário embaixo ficam fixos */
  .sidebar { overflow: hidden; }
  .cliente, .sidebar__rodape { flex-shrink: 0; }
  .sidebar .nav { min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .sidebar__rodape { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal { overscroll-behavior: contain; }
  .modal__panel { overscroll-behavior: contain; }
}

/* ---------- Menu retraído no desktop (só os ícones; no tablet ele já fica assim) ---------- */
.topbar__retrair { display: none; }
@media (min-width: 1181px) {
  .topbar__retrair { display: inline-grid; margin-left: -8px; }
  html[data-menu="retraido"] .app { grid-template-columns: var(--rail) minmax(0, 1fr); }
  html[data-menu="retraido"] .cliente { padding: 14px; justify-content: center; }
  html[data-menu="retraido"] .cliente__texto,
  html[data-menu="retraido"] .nav__group-title,
  html[data-menu="retraido"] .nav__rotulo,
  html[data-menu="retraido"] .nav__badge,
  html[data-menu="retraido"] .usuario__texto,
  html[data-menu="retraido"] .sidebar__plataforma .vx-logo__word,
  html[data-menu="retraido"] .sidebar__plataforma > span:first-child { display: none; }
  html[data-menu="retraido"] .nav { padding: 12px 10px; scrollbar-width: none; }
  html[data-menu="retraido"] .nav::-webkit-scrollbar { display: none; }
  html[data-menu="retraido"] .nav__item { justify-content: center; padding: 6px; }
  html[data-menu="retraido"] .usuario { flex-direction: column; }
  html[data-menu="retraido"] .sidebar__plataforma { justify-content: center; }
}
