/* spa.css — Sistema Virtualize */

/* ============================================================
   Tokens
   ============================================================ */
:root {
  /* Accent — Secretária */
  --navy:           #1B2B4B;
  --navy-light:     rgba(27,43,75,0.08);
  --navy-hover:     rgba(27,43,75,0.12);

  /* Accent — Médico */
  --teal:           #1A3A2A;
  --teal-light:     rgba(26,58,42,0.08);
  --teal-hover:     rgba(26,58,42,0.12);

  /* Superfícies */
  --bg:             #FFFFFF;
  --bg-card:        #FFFFFF;
  --shell-fill:     rgba(249,248,247,0.70);
  --shell-fill-strong: rgba(251,250,249,0.86);
  --shell-line:     rgba(124,120,116,0.08);
  --shell-ink:      #4C4F69;
  --shell-muted:    #6E7590;
  --shell-faint:    #9AA0B7;
  --card-line:      rgba(27,43,75,0.06);

  /* Conteúdo — home premium calma */
  --home-atmo-top:        #F7F8FC;
  --home-atmo-bottom:     #F3F5FA;
  --home-atmo-glow-a:     rgba(92,110,181,0.08);
  --home-atmo-glow-b:     rgba(186,194,229,0.22);
  --home-surface:         rgba(255,255,255,0.96);
  --home-surface-strong:  #FFFFFF;
  --home-line:            rgba(118,129,166,0.16);
  --home-line-soft:       rgba(118,129,166,0.11);
  --home-line-faint:      rgba(118,129,166,0.07);
  --home-hover:           rgba(83,99,155,0.045);
  --home-text-strong:     #1E2435;
  --home-text:            #31384A;
  --home-text-muted:      #717B92;
  --home-text-soft:       #98A2B6;
  --home-accent-soft:     rgba(82,102,235,0.10);
  --home-accent-border:   rgba(82,102,235,0.18);
  --home-shadow-card:     0 0 2px rgba(175,178,206,0.56), 0 1px 4px rgba(4,4,52,0.10);
  --home-shadow-card-hover: 0 0 2px rgba(175,178,206,0.62), 0 16px 34px rgba(21,26,56,0.08);

  /* Glass — camada de controles apenas */
  --glass-sidebar:  rgba(243,246,250,0.76);
  --glass-topbar:   rgba(248,248,249,0.82);
  --glass-modal:    rgba(255,255,255,0.88);
  --glass-login:    rgba(255,255,255,0.10);
  --sidebar-glass-top:    rgba(234,240,249,0.94);
  --sidebar-glass-bottom: rgba(240,239,248,0.68);
  --sidebar-glass-core:   rgba(229,232,239,0.14);
  --sidebar-item-hover:   rgba(216,224,235,0.48);
  --sidebar-item-active:  rgba(209,218,231,0.60);
  --sidebar-item-border:  rgba(126,138,164,0.11);
  --blur-sm:        blur(12px);
  --blur-md:        blur(20px);
  --blur-lg:        blur(40px);

  /* Texto */
  --text:           #111827;
  --text-ink:       #2F3140;
  --text-cool:      #7F8193;
  --text-muted:     #6B7280;
  --text-xmuted:    #9CA3AF;

  /* Tints suaves */
  --surface-tint:         rgba(132,126,120,0.03);
  --surface-tint-hover:   rgba(132,126,120,0.045);
  --surface-tint-border:  rgba(132,126,120,0.07);
  --chrome-soft:          rgba(248,247,246,0.76);
  --chrome-soft-hover:    rgba(245,244,242,0.88);
  --chrome-soft-active:   rgba(240,238,236,0.92);
  --chrome-soft-border:   rgba(132,126,120,0.07);
  --patient-status-lead:        #7E6AB7;
  --patient-status-lead-bg:     rgba(126,106,183,0.12);
  --patient-status-lead-border: rgba(126,106,183,0.18);
  --patient-status-active:        #5B8471;
  --patient-status-active-bg:     rgba(91,132,113,0.12);
  --patient-status-active-border: rgba(91,132,113,0.18);
  --patient-status-inactive:        #8A90A3;
  --patient-status-inactive-bg:     rgba(138,144,163,0.12);
  --patient-status-inactive-border: rgba(138,144,163,0.16);

  /* Pendências — cores semânticas */
  --pend-cobranca:    #9a6c2d;
  --pend-cobranca-bg: rgba(196,139,79,0.12);
  --pend-nf:          var(--text-cool);
  --pend-nf-bg:       rgba(79,84,110,0.08);
  --pend-retorno:     #b5606d;
  --pend-retorno-bg:  rgba(209,106,106,0.10);
  --pend-falta:       #b5606d;
  --pend-falta-bg:    rgba(209,106,106,0.10);

  /* Bordas */
  --border:         #D8DCE3;               /* cards, modais — sólida */
  --border-solid:   #D8DCE3;               /* tabelas, separadores, inputs */
  --border-soft:    #E8EBF0;
  --border-glass:   rgba(255,255,255,0.60);

  /* Inputs */
  --bg-input:       rgba(0,0,0,0.045);

  /* Sombras */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
  --shadow-shell: 0 1px 2px rgba(52,44,36,0.025), 0 10px 24px rgba(52,44,36,0.04);
  --shadow-card-soft: 0 1px 2px rgba(52,44,36,0.03), 0 12px 32px rgba(52,44,36,0.045);
  --shadow-card-hover: 0 1px 2px rgba(52,44,36,0.03), 0 16px 34px rgba(52,44,36,0.07);

  /* Tipografia */
  --font:           -apple-system, "SF Pro Text", BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display:   -apple-system, "SF Pro Display", BlinkMacSystemFont, "Segoe UI", sans-serif;
  --size-xs:        11px;
  --size-sm:        13px;
  --size-base:      15px;
  --size-md:        17px;
  --size-lg:        20px;
  --size-xl:        22px;
  --size-2xl:       28px;
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* Espaçamento */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;

  /* Radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-pill: 999px;

  /* Status */
  --s-agendada:      #7B8FD4;
  --s-agendada-sel:  #BBC7FC;
  --s-agendada-bg:   rgba(187,199,252,0.35);
  --s-confirmada:    #4DA88A;
  --s-confirmada-sel:#B3E0D7;
  --s-confirmada-bg: rgba(179,224,215,0.35);
  --s-atendida:      #5AAACE;
  --s-atendida-sel:  #C8E8F8;
  --s-atendida-bg:   rgba(200,232,248,0.35);
  --s-falta:         #E07070;
  --s-falta-sel:     #FFCBCB;
  --s-falta-bg:      rgba(255,203,203,0.35);
  --s-cancelada:     #B87AA4;
  --s-cancelada-sel: #ECD5E3;
  --s-cancelada-bg:  rgba(236,213,227,0.35);
  /* ── Agenda Pessoal — paleta pastel exclusiva (5 categorias) ── */
  --pag-cat1:       #8B9DD4;  /* lilás suave    — Pessoal  */
  --pag-cat1-bg:    #EEF0FC;
  --pag-cat1-sel:   #C5CBEF;
  --pag-cat2:       #6BBFA4;  /* verde-menta    — Trabalho */
  --pag-cat2-bg:    #E6F5F1;
  --pag-cat2-sel:   #AADDD2;
  --pag-cat3:       #E8A87C;  /* pêssego        — Saúde    */
  --pag-cat3-bg:    #FDF0E8;
  --pag-cat3-sel:   #F4CCAB;
  --pag-cat4:       #79BCCC;  /* azul-céu       — Família  */
  --pag-cat4-bg:    #E8F5F9;
  --pag-cat4-sel:   #B3DDE8;
  --pag-cat5:       #C49ABF;  /* lavanda-rosa   — Outros   */
  --pag-cat5-bg:    #F5EDF4;
  --pag-cat5-sel:   #DFC3DA;

  --s-pendente:        #E07070;
  --s-pendente-bg:     rgba(255,203,203,0.35);
  --s-pendente-border: rgba(224,112,112,0.22);
  --s-paga:            #4DA88A;
  --s-paga-bg:         rgba(179,224,215,0.35);
  --s-paga-border:     rgba(77,168,138,0.22);
  --s-vencida:         #E07070;
  --s-vencida-bg:      rgba(255,203,203,0.35);
  --s-vencida-border:  rgba(224,112,112,0.22);
  --s-cancelada-border: rgba(184,122,164,0.22);
  --s-atendida-border:  rgba(90,170,206,0.18);

  /* Layout */
  --sidebar-w:       220px;
  --sidebar-w-mini:  64px;
  --topbar-h:        56px;
}

/* ============================================================
   Reset & base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: var(--size-base);
  font-weight: var(--weight-regular);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
img { max-width: 100%; }
ul, ol { list-style: none; }

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

/* ============================================================
   Utilitários
   ============================================================ */
.hidden  { display: none !important; }
.text-muted  { color: var(--text-muted); font-size: var(--size-sm); }
.text-xmuted { color: var(--text-xmuted); font-size: var(--size-xs); }

/* ============================================================
   Tela de Login
   ============================================================ */
.login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(180,170,220,0.30) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(160,165,215,0.24) 0%, transparent 55%),
    #F2F3F7;
  padding: var(--space-4);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(235,236,242,0.55);
  backdrop-filter: blur(40px) saturate(1.6);
  -webkit-backdrop-filter: blur(40px) saturate(1.6);
  border: 1px solid rgba(255,255,255,0.70);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  animation: fadeInDown 280ms ease-out both;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

.login-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 16px rgba(27,42,74,0.25));
}

.login-wordmark {
  font-family: -apple-system, "SF Pro Text", BlinkMacSystemFont, sans-serif;
  font-size: var(--size-md);
  font-weight: var(--weight-medium);
  letter-spacing: 0.02em;
  color: var(--text-muted);
  line-height: 1;
}

.login-welcome {
  font-family: -apple-system, "SF Pro Display", BlinkMacSystemFont, sans-serif;
  font-size: var(--size-2xl);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
  margin-top: var(--space-3);
}

.login-card .field {
  margin-bottom: var(--space-4);
}

.login-card label {
  display: block;
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
  margin-bottom: var(--space-2);
}

.login-card input {
  width: 100%;
  height: 42px;
  padding: 0 var(--space-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--size-base);
  transition: border-color 150ms, box-shadow 150ms;
}

.login-card input::placeholder { color: var(--text-xmuted); }
.login-card input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--navy-light);
}

.input-icon-right { position: relative; }
.input-icon-right input { padding-right: 40px; }
.input-icon-right .btn-icon {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.input-icon-right .btn-icon:hover { color: var(--text); }

.login-error {
  font-size: var(--size-sm);
  color: #DC2626;
  margin-bottom: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: rgba(220,38,38,0.06);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(220,38,38,0.15);
}

.btn-full { width: 100%; }

.login-forgot {
  display: block;
  text-align: center;
  margin-top: var(--space-4);
  font-size: var(--size-sm);
  color: var(--text-muted);
  transition: color 150ms;
}
.login-forgot:hover { color: var(--navy); }

/* ============================================================
   App shell
   ============================================================ */
.app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width 220ms ease, transform 250ms ease;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    1px 0 0 rgba(121,129,157,0.08),
    16px 0 26px -30px rgba(104,116,144,0.18);
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(148% 68% at -14% 2%, rgba(136,178,228,0.13) 0%, transparent 40%),
    radial-gradient(128% 84% at 20% 112%, rgba(198,182,236,0.12) 0%, transparent 52%),
    linear-gradient(168deg, rgba(176,198,232,0.04) 0%, rgba(176,198,232,0.015) 32%, transparent 56%),
    linear-gradient(180deg, rgba(255,255,255,0.11) 0%, rgba(255,255,255,0.02) 24%, transparent 44%),
    linear-gradient(180deg, var(--sidebar-glass-top) 0%, var(--sidebar-glass-bottom) 100%),
    var(--sidebar-glass-core);
  backdrop-filter: blur(26px) saturate(118%) brightness(0.995);
  -webkit-backdrop-filter: blur(26px) saturate(118%) brightness(0.995);
  border-right: 1px solid rgba(255,255,255,0.32);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.24);
  pointer-events: none;
  z-index: 0;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: rgba(121,129,157,0.10);
  pointer-events: none;
  z-index: 0;
}

/* Mini sidebar (colapsada) */
.sidebar-collapsed {
  width: var(--sidebar-w-mini);
}

/* Fix: Safari não anima width corretamente em elementos com backdrop-filter — remove o filtro durante a transição */
.sidebar-transitioning {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sidebar-transitioning::before {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Fix: no Safari, camadas com backdrop-filter podem "engolir" clique de filhos */
.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar-collapsed .sidebar-logo-text,
.sidebar-collapsed .sidebar-item span,
.sidebar-collapsed .sidebar-logout-label {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 0;
  gap: 0;
}

.sidebar-collapsed .sidebar-nav {
  padding: var(--space-3) 0;
  align-items: stretch;
  gap: var(--space-2);
}

.sidebar-collapsed .sidebar-item {
  justify-content: center;
  padding: 0;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border-radius: 14px;
  gap: 0;
}

.sidebar-collapsed .sidebar-footer {
  align-items: stretch;
  padding: var(--space-3) 0;
}

.sidebar-collapsed .sidebar-logout {
  justify-content: center;
  padding: 0;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border-radius: 14px;
  gap: 0;
}

.sidebar-collapsed .sidebar-nav-divider {
  width: 24px;
  margin: var(--space-2) auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--topbar-h);
  padding: 0 14px;
  color: var(--shell-ink);
  border-bottom: 1px solid rgba(124,140,168,0.10);
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: block;
  color: var(--navy);
}

.sidebar-item svg,
.sidebar-logout-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.sidebar-collapsed .sidebar-brand-icon {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  transform: none;
}

.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: var(--weight-semibold);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--shell-ink);
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px var(--space-3);
  border-radius: var(--radius-md);
  color: var(--shell-muted);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: var(--weight-medium);
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  transition: background 140ms, color 140ms, border-color 140ms, box-shadow 140ms;
}

.sidebar-item:hover {
  background: rgba(216,224,235,0.28);
  border-color: rgba(111,124,151,0.06);
  color: var(--shell-ink);
}

.sidebar-item-active {
  background: rgba(209,218,231,0.36) !important;
  border-color: rgba(126,138,164,0.09);
  color: var(--shell-ink) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28);
  font-weight: var(--weight-medium);
}

.sidebar-footer {
  padding: var(--space-3);
  border-top: 1px solid rgba(124,140,168,0.10);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-nav-divider {
  height: 1px;
  background: rgba(124,140,168,0.08);
  margin: var(--space-2) var(--space-3);
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px var(--space-3);
  border-radius: var(--radius-md);
  color: var(--shell-muted);
  font-size: var(--size-base);
  font-weight: var(--weight-medium);
  background: transparent;
  border: none;
  width: 100%;
  border: 1px solid transparent;
  transition: background 140ms, color 140ms, border-color 140ms;
}
.sidebar-logout:hover { background: rgba(216,224,235,0.28); border-color: rgba(111,124,151,0.06); color: var(--shell-ink); }

/* ============================================================
   Main wrapper
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: margin-left 220ms ease;
}

.sidebar.sidebar-collapsed ~ .main-wrapper {
  margin-left: var(--sidebar-w-mini);
}

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6) 0 var(--space-4);
  z-index: 100;
  flex-shrink: 0;
  gap: var(--space-5);
  isolation: isolate;
}

.topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(18px) saturate(100%);
  -webkit-backdrop-filter: blur(18px) saturate(100%);
  border-bottom: 1px solid rgba(121,129,157,0.08);
  box-shadow: 0 1px 0 rgba(255,255,255,0.44);
  pointer-events: none;
  z-index: 0;
}

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

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding-left: 0;
}

.page-title { display: none; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-datetime {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 32px;
  padding: 0 10px;
  background: rgba(255,255,255,0.46);
  border: 1px solid rgba(121,129,157,0.10);
  border-radius: var(--radius-pill);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.60);
  font-size: 12px;
  color: var(--shell-muted);
  white-space: nowrap;
}

/* Versão esquerda — sem pill, texto simples ao lado do hamburger */
.topbar-datetime-left {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  gap: 10px;
}

.topbar-datetime-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--shell-faint);
}

.topbar-date {
  color: var(--shell-muted);
  font-size: 13px;
  font-weight: var(--weight-regular);
  letter-spacing: 0;
}

.topbar-separator {
  width: 4px;
  height: 4px;
  background: #AEB7C7;
  border-radius: 50%;
  flex-shrink: 0;
}

.topbar-clock-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
}

.flip-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  width: auto;
  height: auto;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  font-size: 14px;
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--shell-ink);
  line-height: 1;
}

.flip-sep {
  font-size: 14px;
  font-weight: var(--weight-medium);
  color: var(--shell-faint);
  line-height: 1;
  margin: 0;
}

.hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--shell-faint);
  cursor: pointer;
  padding: 0;
  transition: color 140ms ease, background 140ms ease;
}
.hamburger:hover {
  color: var(--shell-ink);
  background: rgba(27,43,75,0.06);
}

/* Filtro de médico — dropdown estilizado com busca inline */
.mf-root {
  position: relative;
  width: 224px;
}
.mf-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  max-height: 36px;
  overflow: hidden;
  width: 100%;
  padding: 0 9px 0 10px;
  background: var(--chrome-soft);
  border: 1px solid var(--chrome-soft-border);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
  cursor: pointer;
  transition: border-color 150ms, background 150ms, box-shadow 150ms;
  box-sizing: border-box;
}
.mf-trigger:hover {
  background: var(--chrome-soft-hover);
  border-color: rgba(132,144,169,0.12);
}
.mf-trigger:focus-within {
  background: rgba(245,247,250,0.88);
  border-color: rgba(136,128,120,0.12);
  box-shadow: 0 0 0 3px rgba(196,188,180,0.05), inset 0 1px 0 rgba(255,255,255,0.72);
}
.mf-input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  font-size: 13px;
  color: var(--shell-ink);
  outline: none !important;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  min-width: 0;
  height: 22px;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 22px;
  display: block;
}
.mf-input:focus {
  cursor: text;
  outline: none !important;
  box-shadow: none !important;
  border-color: transparent !important;
}
.mf-input::placeholder { color: var(--shell-muted); }
.mf-clear {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  background: rgba(0,0,0,0.07);
  border-radius: 50%;
  color: var(--shell-muted);
  cursor: pointer;
  padding: 0;
  transition: background 150ms, color 150ms;
}
.mf-clear:hover {
  background: rgba(0,0,0,0.13);
  color: var(--text);
}
.mf-chevron {
  flex-shrink: 0;
  color: var(--shell-faint);
  transition: transform 200ms;
  pointer-events: none;
}
.mf-root.mf-open .mf-chevron { transform: rotate(180deg); }
.mf-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: rgba(249,250,252,0.92);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border: 1px solid rgba(132,144,169,0.10);
  border-radius: 14px;
  box-shadow: var(--shadow-card-soft);
  z-index: 200;
  max-height: 220px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-1) 0;
}
.mf-item {
  padding: var(--space-2) var(--space-3);
  font-size: var(--size-sm);
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  box-sizing: border-box;
}
.mf-item:hover { background: rgba(238,241,246,0.66); }
.mf-item-active { color: var(--navy); font-weight: var(--weight-semibold); }
.mf-empty { padding: var(--space-2) var(--space-3); font-size: var(--size-sm); color: var(--text-muted); }

/* ============================================================
   Notificações
   ============================================================ */
.notif-wrap { position: relative; }

.topbar .btn-icon,
.topbar .mf-root,
.notif-wrap,
.sidebar .sidebar-item,
.sidebar .sidebar-logout {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: var(--s-cancelada);
  border-radius: var(--radius-pill);
  border: 2px solid rgba(255,255,255,0.94);
  font-size: 9px; font-weight: 700;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

.notif-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  max-height: 340px;
  background: rgba(255,255,255,0.97);
  border: 1px solid rgba(27,43,75,0.08);
  border-radius: 18px;
  box-shadow: var(--shadow-card-soft);
  z-index: 300;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeInDown 180ms ease-out both;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(255,255,255,0.97);
}
.notif-header-label {
  font-size: var(--size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}
.notif-header-clear {
  font-size: var(--size-xs);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.notif-header-clear:hover { color: var(--navy); background: var(--bg); }

.notif-list {
  overflow-y: auto;
  flex: 1;
}

.notif-wrap .btn-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255,255,255,0.60);
  border: 1px solid var(--shell-line);
  color: #778397;
}

.notif-wrap .btn-icon:hover {
  background: rgba(255,255,255,0.84);
  border-color: rgba(27,43,75,0.12);
  color: var(--navy);
}

.notif-loading, .notif-empty {
  padding: var(--space-4);
  font-size: var(--size-sm);
  color: var(--text-muted);
  text-align: center;
}

.notif-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: var(--space-2) var(--space-3);
  align-items: start;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  transition: background 120ms;
  cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }

.notif-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
  color: var(--text-muted);
}
.notif-icon--cobranca_consulta,
.notif-icon--cobranca_falta  { color: var(--orange, #c2785a); }
.notif-icon--relatorio_enviado { color: var(--navy, #2d3a5a); }
.notif-icon--bloqueio_agenda   { color: var(--violet, #7a69ae); }

.notif-item-body { display: flex; flex-direction: column; gap: var(--space-1); }
.notif-content { font-size: var(--size-sm); line-height: 1.45; }
.notif-time    { font-size: var(--size-xs); color: var(--text-xmuted); }

/* ============================================================
   View
   ============================================================ */
.view-header {
  padding: 24px 56px 10px;
  flex-shrink: 0;
}

.view-header-greeting {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: var(--weight-medium);
  color: var(--home-text-strong);
  letter-spacing: -0.03em;
  margin: 0;
}

.view-header-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: var(--weight-medium);
  color: var(--home-text-strong);
  letter-spacing: -0.02em;
  margin: 0;
}

.view {
  flex: 1;
  overflow-y: auto;
  padding: 20px 64px 32px;
}

.view--home {
  padding: 8px 56px 48px;
  background: #FFFFFF;
}

.view--agenda {
  padding: 12px 56px 24px;
}


.view-content {
  width: 100%;
}

/* ============================================================
   Botões
   ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-4);
  background: var(--navy);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--size-sm);
  font-weight: var(--weight-semibold);
  transition: opacity 150ms;
}
.btn-primary:hover   { opacity: 0.90; }
.btn-primary:active  { opacity: 0.82; }
.btn-primary:disabled { opacity: 0.50; cursor: not-allowed; }


.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-4);
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  transition: background 150ms, border-color 150ms;
}
.btn-secondary:hover { background: var(--bg); border-color: var(--text-xmuted); }

.btn-danger-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 var(--space-4);
  background: transparent;
  color: var(--error, #dc2626);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: opacity 150ms;
  font-family: var(--font);
}
.btn-danger-ghost:hover { opacity: 0.75; }

.btn-destructive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 36px;
  padding: 0 var(--space-4);
  background: transparent;
  color: #DC2626;
  border: 1px solid #DC2626;
  border-radius: var(--radius-md);
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  transition: background 150ms;
}
.btn-destructive:hover { background: rgba(220,38,38,0.06); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-muted);
  transition: background 140ms, color 140ms;
}
.btn-icon:hover { background: var(--navy-light); color: var(--navy); }

/* ============================================================
   Campos de formulário
   ============================================================ */
.field { display: flex; flex-direction: column; gap: var(--space-1); }

.field label {
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="url"],
select,
textarea {
  height: 38px;
  padding: 0 var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: var(--size-base);
  transition: border-color 150ms, box-shadow 150ms;
  width: 100%;
}

textarea {
  height: auto;
  padding: var(--space-2) var(--space-3);
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--navy-light);
}

input::placeholder, textarea::placeholder { color: var(--text-xmuted); }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 0.5px solid rgba(0,0,0,0.06);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-5);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--size-base);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}

/* ============================================================
   Tabelas
   ============================================================ */
.table-wrap  { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--size-sm);
}

thead th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-solid);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border-solid);
  transition: background 120ms;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(17,24,39,0.04); }
tbody tr:active { background: rgba(17,24,39,0.07); }

tbody td {
  padding: 11px var(--space-3);
  vertical-align: middle;
}

/* ============================================================
   Badges de status
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.status-badge-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: var(--size-xs);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
}

.status-badge-sm--interactive {
  cursor: pointer;
  user-select: none;
  transition: filter 140ms;
}

.badge-pendente   { background: var(--s-pendente-bg);   color: var(--s-pendente); }
.badge-paga       { background: var(--s-paga-bg);       color: var(--s-paga); }
.badge-vencida    { background: var(--s-vencida-bg);    color: var(--s-vencida); }

/* Status badges do financeiro (fin-s-*) */
.fin-s-pendente  { background: var(--s-pendente-bg);   color: var(--s-pendente);   border-color: var(--s-pendente-border); }
.fin-s-paga      { background: var(--s-paga-bg);       color: var(--s-paga);       border-color: var(--s-paga-border); }
.fin-s-cancelada { background: var(--s-cancelada-bg);  color: var(--s-cancelada);  border-color: var(--s-cancelada-border); }

/* ============================================================
   Avatar
   ============================================================ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-pill);
  background: var(--navy-light);
  color: var(--navy);
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  flex-shrink: 0;
}

/* ============================================================
   Modais
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: var(--space-4);
  opacity: 0;
  transition: opacity 200ms ease-out;
}

.modal-overlay.modal-visible { opacity: 1; }

.modal-overlay.modal-visible .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal {
  background: var(--glass-modal);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 0.5px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: clip;
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  transition: transform 260ms cubic-bezier(0.34,1.56,0.64,1), opacity 200ms ease-out;
}

.modal-sm { max-width: 400px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 760px; }

.modal-hide {
  animation: fadeOut 180ms ease-in both;
}

@keyframes modal-in {
  from { transform: translateY(20px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-stack { z-index: 410; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) 0;
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--size-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
}
.modal-body--overflow-visible {
  overflow: visible;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  overflow: visible;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) var(--space-5);
  border-top: 1px solid rgba(27,43,75,0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,0.36));
  flex-shrink: 0;
}

/* Footer com ação destrutiva à esquerda + botões à direita */
.modal-footer-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
  gap: var(--space-3);
}

.modal-footer-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  color: var(--text-muted);
  font-size: var(--size-xs);
  line-height: 1.45;
}

.modal-footer-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-left: auto;
  flex-wrap: wrap;
}

.modal-footer-compact {
  justify-content: flex-end;
}

.modal-footer-primary {
  min-width: 124px;
}

.modal-footer-primary.btn-primary,
.modal-footer-primary.btn-destructive {
  height: 40px;
  padding: 0 16px;
  border-radius: 14px;
}

.modal-footer-dismiss {
  min-width: 100px;
}

.action-pop {
  position: absolute;
  top: calc(100% + 4px);
  z-index: 100;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-1);
  display: none;
  min-width: 180px;
  width: max-content;
}
.action-pop.ag-pop-open { display: block; }

.action-pop-right {
  right: 0;
}

.action-pop-left {
  left: 0;
}

.action-pop-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--size-sm);
  cursor: pointer;
  transition: background 100ms, color 100ms;
  color: var(--text);
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
  box-sizing: border-box;
  white-space: nowrap;
}

.action-pop-item:hover {
  background: var(--navy-light);
}

.action-pop-item-danger {
  color: var(--s-cancelada);
}
.action-pop-item-danger:hover {
  background: var(--s-cancelada-bg);
}
.action-pop-item-warning {
  color: var(--s-falta);
}
.action-pop-item-warning:hover {
  background: var(--s-falta-bg);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.modal-form .form-section-title {
  margin-bottom: var(--space-2);
  margin-top: var(--space-3);
}
.modal-form .form-section-title:first-child {
  margin-top: 0;
}

.modal-form .field,
.modal-form .form-grid,
.modal-form .form-grid-2 {
  gap: var(--space-3);
}

.modal-form .field label {
  color: var(--text-cool);
}

.modal-form textarea {
  min-height: 96px;
}

.modal-confirm-desc {
  color: var(--text-muted);
  font-size: var(--size-base);
  line-height: 1.5;
}

/* ============================================================
   Toasts
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 500;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--text);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  max-width: 360px;
  pointer-events: all;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease-out, transform 220ms ease-out;
}

.toast-visible { opacity: 1; transform: translateY(0); }
.toast-hide    { opacity: 0; transform: translateY(8px); transition: opacity 180ms ease-in, transform 180ms ease-in; }

.toast-success { background: var(--navy); }
.toast-error   { background: #7F1D1D; }
.toast-warning { background: #78350F; }

.toast-msg  { flex: 1; }
.toast-icon { flex-shrink: 0; }

.toast-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.60);
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 140ms;
}
.toast-close:hover { color: #FFFFFF; }

.toast-undo-btn {
  flex-shrink: 0;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #FFFFFF;
  font-size: var(--size-sm);
  font-weight: var(--weight-semibold);
  padding: 3px var(--space-2);
  border-radius: var(--radius-sm);
  transition: background 140ms;
}
.toast-undo-btn:hover { background: rgba(255,255,255,0.25); }

/* ============================================================
   Paginação
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-4) 0;
  justify-content: center;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  transition: background 140ms, color 140ms, border-color 140ms;
}
.page-btn:hover:not([disabled]) { background: var(--navy-light); color: var(--navy); }
.page-btn-active { background: var(--navy) !important; color: #FFFFFF !important; border-color: var(--navy); }
.page-btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.page-ellipsis { color: var(--text-xmuted); padding: 0 var(--space-1); font-size: var(--size-sm); }

/* ============================================================
   Skeleton loading
   ============================================================ */
.skeleton-wrap { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-2); }

.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, rgba(229,231,235,0.5) 50%, var(--border) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.4s infinite;
}
.skeleton-title { height: 24px; width: 40%; }
.skeleton-row   { height: 40px; width: 100%; }
.skeleton-row.short { width: 70%; }

/* ============================================================
   Spinner
   ============================================================ */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.30);
  border-top-color: #FFFFFF;
  border-radius: var(--radius-pill);
  animation: spin 0.7s linear infinite;
}

/* ============================================================
   Estado vazio
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-10);
  color: var(--text-muted);
  text-align: center;
}

.empty-state p { font-size: var(--size-base); line-height: 1.5; }

/* ============================================================
   Sidebar mobile overlay
   ============================================================ */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  z-index: 190;
  display: none; /* oculto no desktop */
}

/* ============================================================
   Animações
   ============================================================ */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Widget Tarefas (home) ─────────────────────────────── */

/* View bar — label clicável "Hoje ›" */
.hw-view-bar {
  padding: 14px 22px 6px;
}
.hw-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px 4px 2px;
  border-radius: 8px;
  color: var(--home-text-muted);
  font-size: 13px;
  font-weight: var(--weight-medium);
  transition: background 120ms, color 120ms;
  line-height: 1;
}
.hw-view-btn:hover {
  background: var(--home-hover);
  color: var(--home-text-strong);
}
/* Chevron — o último SVG filho roda 90° quando aberto */
.hw-view-btn > svg:last-child {
  transition: transform 180ms cubic-bezier(0.4,0,0.2,1);
}
.hw-view-btn--open > svg:last-child {
  transform: rotate(90deg);
}
.hw-view-icon {
  display: flex;
  align-items: center;
  color: var(--home-text-soft);
}

/* Itens */
.hw-task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 22px;
  cursor: pointer;
  transition: background 100ms;
}
.hw-task:hover { background: var(--home-hover); }
.hw-task--done { opacity: 0.4; transition: opacity 400ms; pointer-events: none; }
.hw-task--done .hw-task-title { text-decoration: line-through; }

.hw-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(113,123,155,0.28);
  background: transparent;
  cursor: pointer;
  padding: 0;
  color: transparent;
  transition: border-color 140ms, background 140ms, color 140ms;
}
.hw-check:hover {
  border-color: #1A7A4A;
  color: #1A7A4A;
}

.hw-task-title {
  flex: 1;
  font-size: 14px;
  color: var(--home-text);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hw-task-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.hw-flag { color: #F59E0B; display: flex; align-items: center; }
.hw-due {
  font-size: 12px;
  color: var(--home-text-soft);
  white-space: nowrap;
}
.hw-due--overdue { color: #E03131; }

/* Empty */
.hw-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-10);
  color: var(--text-muted);
  font-size: var(--size-base);
  text-align: center;
}

/* Botão + no header do card de tarefas */
.hw-header-add-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(113,123,155,0.08);
  color: var(--home-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 140ms, color 140ms;
  flex-shrink: 0;
}
.hw-header-add-btn:hover {
  background: var(--navy-light, rgba(27,43,75,0.08));
  color: var(--navy, #1B2B4B);
}

/* Dot colorido de lista */
.hw-list-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.hw-list-dot-wrap { display: flex; align-items: center; }

/* Popover de view/lista */
.hw-view-pop,
.hw-qa-pop {
  min-width: 180px;
  background: var(--bg, #fff);
  border: 1px solid rgba(113,123,155,0.14);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(30,36,64,0.13);
  padding: 4px;
  z-index: 1400;
}
.hw-view-pop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  color: var(--home-text);
  cursor: pointer;
  text-align: left;
  transition: background 100ms;
}
.hw-view-pop-item:hover { background: var(--home-hover); }
.hw-view-pop-item--active {
  background: var(--home-accent-soft);
  color: var(--home-text-strong);
  font-weight: var(--weight-medium);
}
.hw-view-pop-icon {
  display: flex;
  align-items: center;
  color: var(--home-text-soft);
  flex-shrink: 0;
  width: 16px;
}

/* ── Quick Add Sheet ─────────────────────────────────────── */
.hw-qa-sheet {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.hw-qa-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,14,30,0.28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.hw-qa-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--bg, #fff);
  border-radius: 20px 20px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 32px rgba(30,36,64,0.14);
  animation: hw-qa-slide-up 220ms cubic-bezier(0.34,1.2,0.64,1) both;
}
@keyframes hw-qa-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.hw-qa-input-wrap { padding: 20px 22px 10px; }
.hw-qa-input {
  width: 100%;
  font-size: 17px;
  font-family: var(--font);
  color: var(--home-text-strong);
  background: none;
  border: none;
  outline: none;
  box-sizing: border-box;
  line-height: 1.5;
}
.hw-qa-input::placeholder { color: var(--home-text-soft); font-weight: 400; }

.hw-qa-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 18px;
  border-top: 1px solid var(--home-line-faint);
}

.hw-qa-cancel,
.hw-qa-confirm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 140ms, color 140ms, opacity 140ms;
}
.hw-qa-cancel {
  background: rgba(113,123,155,0.1);
  color: var(--home-text-muted);
}
.hw-qa-cancel:hover { background: rgba(113,123,155,0.18); }
.hw-qa-confirm {
  margin-left: auto;
  background: var(--navy, #1B2B4B);
  color: #fff;
}
.hw-qa-confirm:disabled { opacity: 0.3; cursor: default; }
.hw-qa-confirm:not(:disabled):hover { background: #253d6b; }
.hw-qa-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid rgba(113,123,155,0.18);
  background: rgba(113,123,155,0.05);
  font-size: 12px;
  color: var(--home-text-muted);
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
  white-space: nowrap;
}
.hw-qa-tool:hover {
  background: rgba(113,123,155,0.1);
  border-color: rgba(113,123,155,0.28);
  color: var(--home-text-strong);
}
.hw-qa-tool--icon-only {
  padding: 5px 8px;
}
.hw-qa-tool--flag {
  color: var(--home-text-soft);
}
.hw-qa-tool--flag-on { color: #F59E0B; border-color: #F59E0B; background: rgba(245,158,11,0.08); }
.hw-qa-tool-label { line-height: 1; }

/* Quick Add Evento — inputs inline de data/hora */
.hw-qae-inline-input {
  height: 30px !important;
  font-size: 12px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(27,43,75,0.12) !important;
  background: rgba(27,43,75,0.04) !important;
  color: var(--text);
  box-shadow: none !important;
  flex-shrink: 0;
  width: auto !important;
  cursor: pointer;
}
.hw-qae-inline-input[type="date"] { min-width: 130px; }
.hw-qae-inline-input[type="time"] { min-width: 80px; }
.hw-qae-inline-input:focus { border-color: var(--navy) !important; outline: none; }

/* Quick Add Evento — pills de categoria */
.hw-qae-cats {
  display: flex;
  gap: 6px;
  padding: 0 22px 12px;
  flex-wrap: wrap;
}
.hw-qae-cat-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--cat-color);
  color: var(--cat-color);
  background: transparent;
  cursor: pointer;
  transition: background 120ms, color 120ms;
  line-height: 1;
}
.hw-qae-cat-pill--active {
  background: var(--cat-color);
  color: #fff;
}
.hw-qae-datetime-label {
  font-size: 12px;
  color: var(--home-text-muted);
  margin-left: 2px;
}

/* ============================================================
   Pacientes
   ============================================================ */
.view--pacientes {
  background: #FFFFFF;
}

.pac-wrap {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding-bottom: 40px;
}

.ws-toolbar,
.fin-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.ws-toolbar-row,
.pac-toolbar,
.fin-toolbar-top,
.fin-toolbar-bottom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.ws-toolbar-actions,
.pac-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ws-filter-row,
.pac-filters {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.pac-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.ws-search-wrap,
.pac-search-wrap {
  position: relative;
  flex: 1 1 360px;
  max-width: 540px;
  min-width: 240px;
}

.ws-search-icon,
.pac-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.ws-search,
.pac-search {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 42px;
  background: #FFFFFF;
  border: 1px solid rgba(112,115,147,0.12);
  border-radius: 16px;
  font-size: 14px;
  color: var(--text-ink);
  box-shadow: 0 0 2px rgba(175,178,206,0.28), 0 4px 14px rgba(11,15,32,0.03);
  transition: border-color 150ms, box-shadow 150ms, background 150ms;
}
.ws-search:focus,
.pac-search:focus {
  outline: none;
  background: #FFFFFF;
  border-color: rgba(82,102,235,0.22);
  box-shadow: 0 0 0 3px rgba(82,102,235,0.08);
}

.pac-filters {
  padding: 0 0 22px;
}

.ws-filter-row .filter-pill,
.pac-filters .filter-pill,
.fin-status-pills .filter-pill {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}
.ws-filter-row .filter-pill-active,
.pac-filters .filter-pill-active,
.fin-status-pills .filter-pill-active,
.pes-filter-pills .filter-pill-active {
  background: rgba(82,102,235,0.08);
  border-color: rgba(82,102,235,0.18);
}
.pac-filter-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 var(--space-1);
  flex-shrink: 0;
}

.btn-active {
  background: var(--surface-tint-hover) !important;
  color: var(--text-ink) !important;
  border-color: rgba(123,108,168,0.20) !important;
}

.td-muted { color: var(--text-muted); font-size: var(--size-sm); }

.action-row { display: flex; align-items: center; gap: var(--space-1); justify-content: flex-end; }

/* Seção de form no modal */
.form-section-title {
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
  margin-top: var(--space-1);
}

.form-grid   { display: grid; gap: var(--space-3); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

/* Status toggle */
.field-label {
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
  margin-bottom: var(--space-2);
}

.status-toggle {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.status-opt {
  min-width: 84px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--surface-tint-border);
  background: rgba(255,255,255,0.76);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.58);
  color: var(--text-cool);
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms, box-shadow 150ms;
}
.status-opt:hover {
  border-color: rgba(123,108,168,0.22);
  background: rgba(255,255,255,0.92);
  color: var(--text-ink);
}

.status-opt-active {
  box-shadow: none;
}
/* Origem pills */
.origem-pills {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.origem-pill {
  height: 30px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  border: 1px solid var(--surface-tint-border);
  background: rgba(255,255,255,0.72);
  color: var(--text-cool);
  font-size: var(--size-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all 150ms;
}
.origem-pill:hover {
  border-color: rgba(123,108,168,0.20);
  background: rgba(255,255,255,0.92);
  color: var(--text-ink);
}
.origem-pill-active {
  background: var(--surface-tint);
  border-color: rgba(123,108,168,0.20);
  color: var(--text-ink);
}

.ws-table-shell,
.pac-list-shell {
  overflow: hidden;
  background: #FFFFFF;
  border-top: 1px solid rgba(112,115,147,0.08);
  border-bottom: 1px solid rgba(112,115,147,0.08);
}

/* Tabela de pacientes */
.ws-table,
.pac-table,
.fin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.ws-table thead th,
.pac-table thead th,
.fin-table thead th {
  padding: 18px 28px 16px;
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: rgb(112, 112, 125);
  text-align: left;
  letter-spacing: -0.01em;
  border-bottom: 1px solid rgba(112,115,147,0.10);
  background: #FFFFFF;
  white-space: nowrap;
}
.ws-table td,
.pac-table tbody td,
.fin-table td {
  padding: 18px 28px;
  font-size: 15px;
  color: #2A2C3F;
  border-bottom: 1px solid rgba(112,115,147,0.08);
  vertical-align: middle;
  line-height: 1.2;
}
.pac-table tbody tr:last-child td { border-bottom: none; }
.ws-table-row,
.pac-table-row,
.fin-tr-click {
  cursor: pointer;
  transition: background 140ms ease, box-shadow 140ms ease;
}
.ws-table-row:hover,
.pac-table-row:hover,
.fin-tr-click:hover { background: rgba(17, 24, 39, 0.018); }
.ws-row-active,
.pac-table-row.pac-row-active,
.fin-tr-selected {
  background: rgba(82, 102, 235, 0.04);
  box-shadow: inset 0 0 0 1px rgba(82, 102, 235, 0.18);
}

.pac-cell-nome-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.pac-row-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  background: rgba(199, 210, 254, 0.34);
  color: #41507B;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.pac-cell-nome-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.pac-nome-text { font-weight: 500; }
.pac-cpf-inline { font-weight: 400; color: rgba(112, 112, 125, 0.92); font-size: 14px; }
.pac-cell-medico { color: rgba(112, 112, 125, 0.92); font-size: 15px; }
.pac-cell-status { white-space: nowrap; }
.pac-cell-proxima { color: rgba(112, 112, 125, 0.92); white-space: nowrap; }
.ws-cell-actions,
.pac-cell-actions,
.fin-td-action {
  width: 92px;
  white-space: nowrap;
  vertical-align: middle;
  text-align: right;
}
.ws-action-group,
.pac-actions-wrap,
.fin-action-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.ws-action-btn,
.pac-table-row .row-action-btn,
.btn-icon.fin-action-btn {
  opacity: 0.54;
  color: rgba(112, 112, 125, 0.86);
  transition: opacity 150ms ease, color 150ms ease, background 150ms ease;
}
.ws-table-row:hover .ws-action-btn,
.ws-row-active .ws-action-btn,
.pac-table-row:hover .row-action-btn,
.pac-row-active .row-action-btn,
.fin-tr-click:hover .btn-icon.fin-action-btn,
.fin-tr-selected .btn-icon.fin-action-btn {
  opacity: 1;
}
.ws-action-btn:hover,
.pac-table-row .row-action-btn:hover,
.btn-icon.fin-action-btn:hover {
  color: var(--navy);
  background: rgba(82, 102, 235, 0.06);
}
.pac-retorno-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(112, 112, 125, 0.92);
  background: rgba(27,43,75,0.04);
  border-radius: 999px;
  padding: 4px 10px;
}
.pac-retorno-vencido {
  color: #D97706;
  background: rgba(245,158,11,0.10);
}

/* Card de detalhe lateral */
.ws-drawer,
.pac-detail-card,
.fin-drawer {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  z-index: 1002;
  overflow: visible;
}

.pac-detail-card {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}
.pac-detail-card--open {
  opacity: 1;
  transform: translateY(0);
}
.pac-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.pac-detail-header-info { display: flex; align-items: flex-start; gap: 12px; }
.pac-detail-header-actions { display: flex; align-items: center; gap: 8px; }
.ws-drawer-shell,
.ws-drawer-empty,
.pac-detail-shell,
.fin-drawer-shell,
.fin-drawer-empty {
  background: #FFFFFF;
  border: 1px solid rgba(112,115,147,0.14);
  border-radius: 28px;
  box-shadow: 0 0 2px rgba(175,178,206,0.44), 0 10px 24px rgba(11,15,32,0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
}
.ws-drawer-shell .pac-detail-body {
  flex: 1;
  min-height: 0;
}

.ws-drawer-head,
.pac-detail-header,
.fin-drawer-head {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 20px 16px;
  border-bottom: 1px solid rgba(112,115,147,0.10);
  flex-shrink: 0;
  background: rgba(255,255,255,0.96);
}

.fin-drawer-head-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.pac-detail-shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
}

.ws-drawer-close,
.pac-detail-close,
.fin-drawer-close {
  flex-shrink: 0;
  margin-top: 1px;
}

.ws-drawer-icon-btn,
.ws-drawer-close,
.pac-detail-icon-btn,
.pac-detail-close,
.fin-drawer-icon-btn,
.fin-drawer-close {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  border: 1px solid rgba(112,115,147,0.14);
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(42,44,63,0.84);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.ws-drawer-icon-btn:hover,
.ws-drawer-close:hover,
.pac-detail-icon-btn:hover,
.pac-detail-close:hover,
.fin-drawer-icon-btn:hover,
.fin-drawer-close:hover {
  background: rgba(82,102,235,0.05);
  border-color: rgba(82,102,235,0.18);
  color: var(--navy);
}
.ws-drawer-icon-btn-primary,
.pac-detail-icon-btn-primary,
.fin-drawer-icon-btn-primary {
  background: #1F325A;
  border-color: #1F325A;
  color: #FFFFFF;
}
.ws-drawer-icon-btn-primary:hover,
.pac-detail-icon-btn-primary:hover,
.fin-drawer-icon-btn-primary:hover {
  background: #263D6D;
  border-color: #263D6D;
  color: #FFFFFF;
}
.ws-drawer-title,
.pac-detail-nome,
.fin-drawer-title {
  font-size: 30px;
  font-weight: 420;
  color: var(--text-ink);
  line-height: 1.08;
  letter-spacing: -0.04em;
}
.pac-detail-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}
.ws-drawer-kicker,
.pac-detail-kicker,
.fin-drawer-kicker {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(112, 112, 125, 0.8);
  margin-bottom: 8px;
}
.pac-detail-body {
  overflow-y: auto;
  padding: 0 26px 30px;
  min-height: 0;
}
.pac-detail-body-edit {
  padding-top: 0;
}
.pac-detail-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 14px;
}
.pac-detail-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ws-drawer-chip,
.pac-detail-chip,
.fin-drawer-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(112, 115, 147, 0.14);
  background: rgba(246, 247, 251, 0.9);
  font-size: 12px;
  font-weight: 500;
  color: rgba(42, 44, 63, 0.82);
}
.pac-detail-consulta-next {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(27,43,75,0.035);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 16px;
}
.pac-detail-consulta-retorno { color: #1A7A4A; background: rgba(26,122,74,0.07); }
.pac-detail-consulta-vencido { color: #D97706; background: rgba(245,158,11,0.08); }
.pac-detail-section-title {
  font-size: 12px;
  font-weight: var(--weight-medium);
  color: var(--text-xmuted);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pac-detail-section {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid rgba(112, 115, 147, 0.12);
  padding-top: 16px;
  margin-top: 16px;
}
.pac-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.pac-detail-col { display: flex; flex-direction: column; }
.pac-detail-linha {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 15px 0;
  border-bottom: 1px solid rgba(112,115,147,0.08);
  font-size: 14px;
  color: var(--text-ink);
  line-height: 1.4;
}
.pac-detail-linha small { color: var(--text-muted); font-size: 11px; }
.pac-detail-values {
  display: flex;
  flex-direction: column;
}
.pac-detail-value-row,
.pac-detail-linha-valor {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(112,115,147,0.08);
  padding: 10px 0;
}
.pac-detail-servico-nome { font-size: 14px; color: var(--text-muted); }
.pac-detail-servico-valor { font-size: 14px; }
.pac-ic { color: var(--text-xmuted); flex-shrink: 0; margin-top: 1px; }
.pac-detail-obs {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(27,43,75,0.03);
  border-radius: 14px;
  padding: 10px 12px;
  line-height: 1.5;
}
.pac-detail-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 26px 18px;
  border-top: 1px solid rgba(112,115,147,0.10);
  flex-shrink: 0;
  background: rgba(255,255,255,0.96);
}
.pac-detail-footer .pac-detail-icon-btn,
.pac-detail-footer a.pac-detail-icon-btn {
  text-decoration: none;
}
.pac-detail-loading {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--size-sm);
}

.pac-detail-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 14px;
}

.pac-detail-form .field input,
.pac-detail-form .field select,
.pac-detail-form .field textarea {
  border-radius: 14px;
  border-color: rgba(112,115,147,0.16);
  background: #FFFFFF;
}
.pac-detail-form textarea {
  min-height: 110px;
}

/* ============================================================
   Home — 4 cards 2×2
   ============================================================ */
.home-wrap {
  max-width: 1328px;
  margin: 0 auto;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 0 0 24px;
}

/* Card base */
.ws-card-shell,
.home-card {
  background: linear-gradient(180deg, var(--home-surface-strong) 0%, var(--home-surface) 100%);
  border: 1px solid var(--home-line-soft);
  border-radius: 16px;
  box-shadow: var(--home-shadow-card);
  display: flex;
  flex-direction: column;
  min-height: 336px;
  overflow: hidden;
  cursor: default;
}

.ws-card-header,
.home-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--home-line-faint);
  flex-shrink: 0;
}

.ws-card-title,
.home-card-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: var(--weight-semibold);
  color: var(--home-text-strong);
  letter-spacing: -0.015em;
}

.home-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: var(--weight-medium);
  background: rgba(112,123,146,0.08);
  color: var(--home-text-muted);
}

.ws-card-link,
.home-card-link {
  font-size: 12px;
  font-weight: var(--weight-medium);
  color: var(--home-text-muted);
  text-decoration: none;
  transition: color 140ms;
}
.ws-card-link:hover,
.home-card-link:hover { color: var(--home-text-strong); }

.ws-card-body,
.home-card-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.ws-card-footer,
.home-card-footer {
  padding: 12px 20px 18px;
  flex-shrink: 0;
}

.home-card-loading {
  height: 3px;
  background: linear-gradient(90deg, rgba(118,129,166,0.04) 25%, rgba(118,129,166,0.10) 50%, rgba(118,129,166,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 2px;
  margin: 20px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.ws-card-empty,
.home-card-empty {
  padding: 40px 24px;
  font-size: 14px;
  color: var(--home-text-soft);
  text-align: center;
}

/* Card Pendências */
#home-pend-body {
  display: flex;
  flex-direction: column;
}

.home-pend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  flex: 1;
  border-bottom: 1px solid var(--home-line-faint);
  transition: background 120ms;
  min-height: 56px;
}
.home-pend-row:last-child { border-bottom: none; }
.home-pend-row--active { cursor: pointer; }
.home-pend-row--active:hover { background: var(--home-hover); }

.home-pend-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--home-pend-hover-bg, rgba(113,123,155,0.10));
  color: var(--home-pend-accent, var(--home-text-strong));
  flex-shrink: 0;
  transform: scale(1.02);
  transition: filter 140ms ease, transform 140ms ease;
}

.home-pend-row--active:hover .home-pend-icon {
  filter: saturate(1.08) brightness(0.98);
}
.home-pend-label { flex: 1; font-size: 14px; color: var(--home-text); letter-spacing: -0.012em; }
.home-pend-count {
  font-size: 14px;
  font-weight: var(--weight-medium);
  color: var(--home-text-soft);
  min-width: 20px;
  text-align: right;
}
.home-pend-count--has { color: var(--home-text-strong); }

/* Modal lista por tipo */
.pend-tipo-list { list-style: none; margin: 0; padding: 0; }
.pend-tipo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 4px;
  border-bottom: 1px solid var(--home-line-faint);
  cursor: pointer;
  transition: background 100ms;
  border-radius: var(--radius-sm);
}
.pend-tipo-item:last-child { border-bottom: none; }
.pend-tipo-item:hover { background: var(--home-hover); }
.pend-tipo-nome { font-size: 14px; color: var(--home-text); }

/* Card Agenda — grade diária */
#home-card-agenda {
  max-height: 415px;
}
#home-card-fin {
  max-height: 415px;
}
.hw-ag-grid {
  /* scroll é feito pelo .home-card-body pai */
}
.hw-ag-row {
  display: grid;
  grid-template-columns: 46px 1fr;
  min-height: 40px;
  border-bottom: 1px solid rgba(228,232,239,0.8);
  position: relative;
}
.hw-ag-time {
  font-size: 11px;
  color: rgba(107,114,128,0.85);
  padding: 8px 8px 0 12px;
  letter-spacing: -0.01em;
  user-select: none;
  flex-shrink: 0;
}
.hw-ag-cell {
  position: relative;
  min-height: 40px;
  padding: 3px 6px 3px 4px;
}
.hw-ag-chip {
  position: absolute;
  left: 4px; right: 6px;
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: filter 100ms;
  border-left: 3px solid transparent;
}
.hw-ag-chip:hover { filter: brightness(0.94); }
.hw-ag-chip--agendada   { background: var(--s-agendada-bg);   border-left-color: var(--s-agendada);   color: var(--s-agendada); }
.hw-ag-chip--confirmada { background: var(--s-confirmada-bg); border-left-color: var(--s-confirmada); color: var(--s-confirmada); }
.hw-ag-chip--atendida   { background: var(--s-atendida-bg);   border-left-color: var(--s-atendida);   color: var(--s-atendida); }
.hw-ag-chip--falta      { background: var(--s-falta-bg);      border-left-color: var(--s-falta);      color: var(--s-falta); }
.hw-ag-chip--cancelada  { background: var(--s-cancelada-bg);  border-left-color: var(--s-cancelada);  color: var(--s-cancelada); }
.hw-ag-chip-nome {
  font-weight: var(--weight-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-size: 12px;
}
.hw-ag-chip-medico {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card Agenda — legado (mantido para compatibilidade) */
.home-agenda-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--home-line-faint);
  cursor: pointer;
  transition: background 120ms;
}
.home-agenda-row:last-child { border-bottom: none; }
.home-agenda-row:hover { background: var(--home-hover); }
.home-agenda-hora { font-size: 12px; font-weight: var(--weight-medium); color: var(--home-text-muted); min-width: 44px; flex-shrink: 0; letter-spacing: -0.01em; }
.home-agenda-nome { font-size: 14px; color: var(--home-text); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.012em; }
.home-agenda-medico { font-size: 13px; color: var(--home-text-muted); white-space: nowrap; flex-shrink: 0; }

/* Card Financeiro */
.home-fin-toggle {
  display: flex;
  background: rgba(113,123,155,0.06);
  border: 1px solid var(--home-line-faint);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.home-fin-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--home-text-muted);
  cursor: pointer;
  transition: background 140ms, color 140ms;
}
.home-fin-toggle-btn--active {
  background: #FFFFFF;
  color: var(--home-text-strong);
  box-shadow: var(--home-shadow-card);
}

#home-fin-body { padding: 22px 24px 24px; }

.home-fin-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 18px;
}

.home-fin-hero-label {
  font-size: 12px;
  color: var(--home-text-muted);
  letter-spacing: -0.012em;
}

.home-fin-hero-value {
  font-family: var(--font-display);
  font-size: 39px;
  line-height: 0.9;
  letter-spacing: -0.045em;
  font-weight: var(--weight-medium);
  color: var(--home-text-strong);
}

.home-fin-hero-indicators {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 1px;
}

.home-fin-hero-meta {
  font-size: 12px;
  color: var(--home-text-muted);
  letter-spacing: -0.012em;
  margin-left: auto;
}

.home-fin-ind {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: var(--weight-medium);
  letter-spacing: -0.012em;
}

.home-fin-ind--up {
  color: #1A7A4A;
}

.home-fin-ind--down {
  color: var(--home-text-muted);
}

.home-fin-ind-sep {
  font-size: 12px;
  color: var(--home-text-soft);
}

.home-fin-chart-wrap {
  min-height: 232px;
}

.home-fin-table {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.home-fin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--home-line-faint);
  font-size: 14px;
  color: var(--home-text);
}
.home-fin-row:last-child { border-bottom: none; }
.home-fin-row--muted { color: var(--home-text-muted); }
.home-fin-recebido { color: #1A7A4A; font-weight: var(--weight-semibold); }

/* Card To Do */
.home-todo-body { padding: 0; overflow-y: auto; align-self: flex-start; width: 100%; cursor: pointer; }

/* Sidebar badge */
.sidebar-item-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  background: rgba(194,24,91,0.12);
  color: #B5185A;
  margin-left: auto;
}
.sidebar-item-badge:empty,
.sidebar-item-badge.hidden { display: none; }

/* Modal pendências (ficha do paciente — mantido) */
.pm-header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.pm-pac-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--navy-light);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 150ms;
}
.pm-header-inner:hover .pm-pac-icon { background: var(--navy-hover); }

.pm-header-info { display: flex; flex-direction: column; gap: 4px; }
.pm-header-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.pm-nome { font-size: var(--size-md); font-weight: var(--weight-semibold); }
.pm-meta { font-size: var(--size-xs); color: var(--text-muted); }
.pm-actions { display: flex; flex-direction: column; gap: 0; }

.pm-action-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.pm-action-row:last-child { border-bottom: none; }

.pm-action-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: rgba(17,24,39,0.05);
  color: var(--text-muted);
}
.pm-action-info { flex: 1; min-width: 0; }
.pm-action-label { font-size: var(--size-sm); font-weight: var(--weight-medium); }
.pm-action-desc  { font-size: var(--size-xs); color: var(--text-muted); margin-top: 2px; }
.pm-action-btns  { display: flex; gap: var(--space-2); flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; max-width: 160px; }


/* View Pendências */
.pend-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.pend-view .pend-toolbar {
  flex-shrink: 0;
}

.pend-view .ws-table-shell {
  width: 100%;
}

/* Painel genérico pendências */
.pend-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: 20px;
}

/* Empty state */
.pend-empty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-10) var(--space-5);
  color: var(--text-muted);
  text-align: center;
}
.pend-empty-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(27,43,75,0.05);
  border-radius: 50%;
  color: var(--text-muted);
}

/* Lote — prep */
.pend-lote-prep {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.pend-lote-card {
  background: linear-gradient(180deg, var(--home-surface-strong) 0%, var(--home-surface) 100%);
  border: 1px solid var(--home-line-soft);
  border-radius: 16px;
  box-shadow: var(--home-shadow-card);
  overflow: hidden;
}
.pend-lote-card-head {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--home-line-faint);
  font-size: 15px;
  font-weight: var(--weight-semibold);
  color: var(--home-text-strong);
  letter-spacing: -0.015em;
}
.pend-lote-type-list,
.pend-lote-order-list {
  display: flex;
  flex-direction: column;
  padding: var(--space-2) 0;
}
.pend-lote-type,
.pend-lote-order-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 11px 18px;
  cursor: pointer;
  font-size: 14px;
  color: var(--home-text);
  letter-spacing: -0.012em;
}
.pend-lote-type:hover,
.pend-lote-order-option:hover { background: var(--home-hover); }
.pend-lote-type--disabled { opacity: 0.45; cursor: default; }
.pend-lote-type-copy { flex: 1; }
.pend-lote-type-count {
  font-size: 13px;
  font-weight: var(--weight-semibold);
  color: var(--home-text-muted);
  min-width: 20px;
  text-align: right;
}
.pend-lote-card-actions {
  padding: var(--space-3) 18px;
  border-top: 1px solid var(--home-line-faint);
}

/* Lote — run phase */
.pend-lote-workspace {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-5);
  align-items: start;
}
.pend-lote-queue {
  background: linear-gradient(180deg, var(--home-surface-strong) 0%, var(--home-surface) 100%);
  border: 1px solid var(--home-line-soft);
  border-radius: 12px;
  box-shadow: var(--home-shadow-card);
  overflow: hidden;
}
.pend-lote-queue-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 12px 10px 10px;
  border-bottom: 1px solid var(--home-line-faint);
}
.pend-lote-queue-head span {
  margin-left: auto;
  font-size: 12px;
  color: var(--home-text-muted);
}
.pend-lote-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--home-text-muted);
  border-radius: 6px;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.pend-lote-back:hover { background: var(--home-hover); color: var(--home-text-strong); }
.pend-lote-queue-list {
  display: flex;
  flex-direction: column;
  max-height: 480px;
  overflow-y: auto;
}
.pend-lote-queue-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px solid var(--home-line-faint);
  transition: background 0.12s;
}
.pend-lote-queue-item:last-child { border-bottom: none; }
.pend-lote-queue-item:hover { background: var(--home-hover); }
.pend-lote-queue-item.is-active { background: var(--home-hover); }
.pend-lote-queue-title {
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--home-text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pend-lote-queue-sub {
  font-size: 12px;
  color: var(--home-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Coluna direita — card único */
.pend-lote-detail {
  background: linear-gradient(180deg, var(--home-surface-strong) 0%, var(--home-surface) 100%);
  border: 1px solid var(--home-line-soft);
  border-radius: 12px;
  box-shadow: var(--home-shadow-card);
  overflow: hidden;
}
.pend-lote-detail-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--home-line-faint);
}
.pend-lote-head-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}
.pend-lote-run-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
  justify-content: flex-end;
}
.pend-lote-detail-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 16px 18px;
}
.pend-lote-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.pend-lote-progress {
  font-size: 11px;
  font-weight: var(--weight-semibold);
  color: var(--home-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 4px;
}
.pend-lote-paciente {
  font-size: 16px;
  font-weight: var(--weight-semibold);
  color: var(--home-text-strong);
  margin: 0 0 2px;
}
.pend-lote-summary {
  font-size: 13px;
  color: var(--home-text-muted);
  margin: 0;
}
.pend-lote-meta {
  font-size: 13px;
  color: var(--home-text-muted);
  white-space: nowrap;
}
.pend-lote-message-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.pend-lote-field-label {
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--home-text);
}
.pend-lote-message-wrap {
  position: relative;
}
.pend-lote-copy-inline {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  transition: color 0.15s;
}
.pend-lote-message {
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.5;
  color: var(--home-text-strong);
  background: var(--home-hover);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  cursor: text;
}
.pend-lote-message:hover {
  background: var(--home-hover);
  border-color: var(--home-line-soft);
}
.pend-lote-message:focus {
  outline: none;
  background: var(--home-surface);
  border-color: var(--home-line-soft);
  cursor: auto;
}
.pend-lote-link {
  font-size: 12px;
  color: var(--navy);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  align-self: flex-start;
}
.pend-lote-link:hover { opacity: 0.75; }
.pend-lote-utility-actions {
  display: flex;
  gap: var(--space-1);
}
.pend-lote-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--home-text-muted);
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.pend-lote-icon-btn:hover {
  background: var(--home-hover);
  color: var(--home-text-strong);
}

/* Bulk bar — flutuante na base */
.pend-bulk-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 24px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
  white-space: nowrap;
}
.pend-bulk-bar.hidden { display: none; }
.pend-bulk-count {
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  padding-right: 6px;
  border-right: 1px solid var(--border);
}
.pend-bulk-actions {
  display: flex;
  gap: 4px;
}
.pend-bulk-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text);
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background 120ms;
}
.pend-bulk-btn:hover { background: var(--navy-light); color: var(--navy); }
.pend-bulk-btn--danger { color: #DC2626; }
.pend-bulk-btn--danger:hover { background: rgba(220,38,38,0.06); color: #DC2626; }
.pend-bulk-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.04);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 120ms;
  flex-shrink: 0;
  margin-left: 2px;
}
.pend-bulk-clear:hover { background: rgba(0,0,0,0.08); color: var(--text); }

.pend-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.pend-toggles {
  display: flex;
  background: rgba(27,43,75,0.05);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.pend-toggle {
  padding: 5px 16px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: background 140ms, color 140ms, box-shadow 140ms;
}
.pend-toggle--active {
  background: #FFFFFF;
  color: var(--text-ink);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.pend-filters { display: flex; gap: 8px; flex-wrap: wrap; }

.pend-filter-select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(27,43,75,0.10);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  font-size: 13px;
  color: var(--text-ink);
  cursor: pointer;
}

/* Checkbox column */
.pend-view .ws-table thead th:first-child,
.pend-cell-check {
  width: 40px;
  padding: 0 16px 0 16px !important;
  vertical-align: middle !important;
  text-align: center;
}
.pend-cell-check input {
  display: block;
  margin: auto;
}
.pend-checkbox {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1.5px solid rgba(27,43,75,0.22);
  background: #fff;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  display: block;
  flex-shrink: 0;
  transition: border-color 120ms, background 120ms;
  position: relative;
}
.pend-checkbox:checked {
  background: var(--navy);
  border-color: var(--navy);
}
.pend-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 1px;
  width: 5px;
  height: 8px;
  border: 1.5px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.pend-checkbox:indeterminate {
  background: var(--navy);
  border-color: var(--navy);
}
.pend-checkbox:indeterminate::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 5px;
  width: 7px;
  height: 1.5px;
  background: #fff;
}
/* Checkbox visível só no hover ou quando selecionado */
.pend-checkbox-row {
  opacity: 0;
  transition: opacity 120ms;
}
.ws-table-row:hover .pend-checkbox-row,
.ws-row-active .pend-checkbox-row,
.pend-checkbox-row:checked {
  opacity: 1;
}
.pend-cell-actions { text-align: right; white-space: nowrap; }

.row-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.row-action-btn svg {
  display: block;
  pointer-events: none;
  flex-shrink: 0;
}

.row-action-btn:hover {
  background: rgba(27,43,75,0.07);
  color: var(--text-ink);
}
.row-action-btn--danger:hover {
  background: rgba(220,38,38,0.07);
  color: #DC2626;
}

.pend-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid rgba(27,43,75,0.07);
  background: rgba(27,43,75,0.015);
}

.pend-pag-info {
  font-size: 12px;
  color: var(--text-muted);
}

.pend-pag-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pend-page-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: var(--weight-medium);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms, color 120ms;
}

.pend-page-btn:hover:not(:disabled) {
  background: rgba(27,43,75,0.07);
  color: var(--text-ink);
}

.pend-page-btn--active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.pend-page-btn--active:hover {
  background: var(--navy);
  color: #fff;
}

.pend-page-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.pend-page-nav {
  color: var(--text-cool);
}

/* filter-pill — mantido para outras views */
.filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  border: 1px solid var(--surface-tint-border);
  background: rgba(255,255,255,0.76);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.58);
  color: var(--text-cool);
  font-size: var(--size-xs);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background 150ms, border-color 150ms, color 150ms, box-shadow 150ms;
}
.filter-pill:hover { border-color: rgba(123,108,168,0.22); background: rgba(255,255,255,0.92); color: var(--text-ink); }
.filter-pill-active { background: var(--surface-tint); border-color: rgba(123,108,168,0.20); color: var(--navy); box-shadow: none; }
.filter-pill-circle { width: 34px; min-width: 34px; height: 34px; padding: 0; border-radius: 50%; font-size: var(--size-sm); }
.filter-pill-mono { color: var(--navy); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.filter-pill-mono:hover { color: var(--navy); }

.pm-footer-btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.64);
}

.pm-footer-btn:hover {
  background: var(--bg);
  border-color: rgba(27,43,75,0.16);
}

.pm-footer-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  color: var(--text-ink);
  font-size: 13px;
  font-weight: var(--weight-medium);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.pm-footer-cta svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Modal NF */
.nf-modal {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.nf-summary {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.nf-summary-title {
  font-family: var(--font-display);
  font-size: var(--size-md);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
}

.nf-summary-main {
  font-size: var(--size-sm);
  color: var(--text);
}

.nf-summary-meta {
  font-size: var(--size-xs);
  color: var(--text-muted);
}

.nf-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.nf-section-title {
  font-size: var(--size-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
}

.nf-copy-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.nf-copy-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 0 -10px;
  transition: background 120ms;
}
.nf-copy-block:hover {
  background: rgba(27,43,75,0.04);
}

.nf-copy-label {
  font-size: var(--size-xs);
  color: var(--text-muted);
  line-height: 1;
}

.nf-copy-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.nf-copy-value {
  font-size: var(--size-sm);
  color: var(--text);
  line-height: 1.45;
  word-break: break-word;
  flex: 1;
}

.nf-copy-value--multi {
  white-space: pre-wrap;
}

.nf-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 140ms, color 140ms, opacity 120ms;
  margin-top: -2px;
  opacity: 0;
}
.nf-copy-block:hover .nf-copy-btn { opacity: 1; }
.nf-copy-btn:hover { background: var(--navy-light); color: var(--navy); }
.nf-copy-btn--copied { pointer-events: none; opacity: 1; }

.nf-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.nf-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  width: 100%;
}

.nf-wa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--navy-light);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 140ms, color 140ms;
}
.nf-wa-btn:hover {
  background: var(--navy-hover);
  color: var(--navy);
}
.nf-wa-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Badge NF clicável — ficha */
.ficha-nf-badge-btn {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--navy-light);
  color: var(--navy);
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: background 140ms, color 140ms;
}
.ficha-nf-badge-btn:hover {
  background: rgba(27,43,75,0.15);
}

/* Badge NF clicável — financeiro */
.fin-nf-badge-btn {
  cursor: pointer;
  border: none;
  transition: opacity 140ms;
}
.fin-nf-badge-btn:hover { opacity: 0.75; }

/* Modal de visualização NF */
.nf-view-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.nf-view-fields {
  display: flex;
  gap: var(--space-6);
}
.nf-view-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nf-view-value {
  font-size: var(--size-sm);
  color: var(--text);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.nf-view-open-btn {
  flex-shrink: 0;
  align-self: center;
}

/* ============================================================
   Responsive — Tablet (< 1024px)
   ============================================================ */
/* ============================================================
   Responsive — Mobile (< 768px)
   ============================================================ */
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .hamburger {
    display: inline-flex;
  }

  .topbar-datetime {
    display: none;
  }

  .view {
    padding: var(--space-4);
  }

  .view--agenda {
    padding: var(--space-4);
  }

  .view-header {
    padding: var(--space-4) var(--space-4) var(--space-2);
  }

  .view-header-greeting {
    font-size: 23px;
  }

  .view-header-title {
    font-size: 18px;
  }

  .modal { max-width: 100% !important; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  .toast-container {
    bottom: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
  }
  .toast { max-width: 100%; }

  /* Home mobile */
  .home-grid { grid-template-columns: 1fr; }
  .home-grid { gap: 16px; }
  .pm-action-btns { flex-direction: column; align-items: flex-end; }
  .nf-form-grid { grid-template-columns: 1fr; }

  /* Agenda mobile */
  .ag-calendar { min-width: 600px; }
  .ag-calendar-wrap { overflow-x: auto; }
  .view--agenda .ag-calendar-wrap {
    width: calc(100% + (var(--space-4) * 2));
    margin-left: calc(var(--space-4) * -1);
    margin-right: calc(var(--space-4) * -1);
  }
  .ag-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .ag-toolbar-right {
    width: 100%;
    justify-content: space-between;
  }
  .ag-periodo {
    font-size: clamp(1.75rem, 7vw, 2.2rem);
  }

  /* Overlay mobile: mostrar apenas quando não tem hidden */
  .sidebar-overlay:not(.hidden) { display: block; }

  /* Fix: removido .sidebar-collapsed override — o JS nunca aplica essa classe no mobile (isMobile() guard em app.js:171) */
}

/* ============================================================
   Agenda
   ============================================================ */

/* Layout wrapper */
.ag-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 12px;
}

/* Toolbar */
.ag-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 0;
}

.ag-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.ag-nav-pill {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(214, 220, 229, 0.92);
  background: rgba(255, 255, 255, 0.82);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 140ms, color 140ms, border-color 140ms;
  flex-shrink: 0;
}
.ag-nav-pill:hover {
  background: rgba(246, 248, 252, 0.88);
  border-color: rgba(204, 211, 222, 0.96);
}

.ag-hoje-btn {
  height: auto;
  padding: 0 6px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 140ms;
}
.ag-hoje-btn:hover {
  color: var(--text);
}
.ag-hoje-btn-disabled {
  color: var(--text-xmuted);
  cursor: default;
  pointer-events: none;
  box-shadow: none;
}

.ag-periodo {
  font-size: clamp(1.55rem, 1.95vw, 2.15rem);
  font-weight: 620;
  color: var(--text);
  letter-spacing: -0.035em;
  white-space: nowrap;
  line-height: 1.05;
  margin: 0 6px 0 8px;
}

.ag-periodo-hidden {
  display: none;
}

.ag-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Segmented control Dia/Semana */
.ag-view-toggle {
  display: flex;
  gap: 2px;
  background: rgba(248, 249, 252, 0.96);
  border: 1px solid rgba(214, 220, 229, 0.92);
  border-radius: 9px;
  padding: 2px;
}
.ag-view-btn {
  min-height: 26px;
  padding: 2px 9px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 12px;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.ag-view-btn:hover { color: var(--text); }
.ag-view-btn-active {
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
}

.ag-quick-add {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(214, 220, 229, 0.92);
  border-radius: 9px;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.82);
}
.ag-quick-add:hover {
  background: rgba(246, 248, 252, 0.88);
  color: var(--navy);
}

.ag-loading {
  padding: var(--space-10);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--size-sm);
}

/* Calendário */
.ag-calendar-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  width: calc(100% + 112px);
  margin-left: -56px;
  margin-right: -56px;
}

.ag-calendar {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Cabeçalho dos dias */
.ag-header {
  display: grid;
  grid-template-columns: 72px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid rgba(228, 232, 239, 0.92);
  background: transparent;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
}

.ag-time-gutter {
  border-right: 1px solid rgba(228, 232, 239, 0.92);
  background: transparent;
}

.ag-col-header {
  padding: 8px 8px 9px;
  text-align: center;
  border-right: 1px solid rgba(228, 232, 239, 0.92);
}
.ag-col-header:last-child { border-right: none; }

.ag-col-hoje {
  background: rgba(246, 248, 252, 0.78);
}

.ag-col-header-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ag-dow {
  display: inline;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0.01em;
  line-height: 1;
  margin: 0;
}

.ag-day-num {
  display: inline;
  min-width: 0;
  height: auto;
  padding: 0;
  border-radius: 0;
  font-size: 13px;
  font-weight: 560;
  color: var(--text);
}

.ag-day-hoje {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-weight: 620;
  font-size: 12px;
}

/* Body scrollável */
.ag-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  background: transparent;
}

/* Indicador de hora atual */
.ag-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--navy);
  opacity: 0.55;
  pointer-events: none;
  z-index: 3;
  transition: top 1s linear;
}
.ag-now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--navy);
  opacity: 1;
}

/* Linhas de horário */
.ag-row {
  display: grid;
  grid-template-columns: 72px repeat(7, minmax(0, 1fr));
  min-height: 74px;
  border-bottom: 1px solid rgba(228, 232, 239, 0.92);
  position: relative;
}

.ag-time-label {
  font-size: 12px;
  color: rgba(107, 114, 128, 0.92);
  padding: 10px 12px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  border-right: 1px solid rgba(228, 232, 239, 0.92);
  user-select: none;
  letter-spacing: -0.01em;
  background: transparent;
}

.ag-time-label.ag-half {
  border-right: 1px solid rgba(228, 232, 239, 0.92);
}

/* Células do grid */
.ag-cell {
  border-right: 1px solid rgba(228, 232, 239, 0.92);
  min-height: 74px;
  padding: 4px 5px;
  position: relative;
  overflow: visible;
  cursor: pointer;
  transition: background 100ms;
}
.ag-cell:last-child { border-right: none; }
.ag-cell:hover { background: transparent; }

.ag-cell-bloqueio {
  background: repeating-linear-gradient(
    45deg,
    rgba(0,0,0,0.02),
    rgba(0,0,0,0.02) 4px,
    transparent 4px,
    transparent 8px
  );
  cursor: not-allowed;
}
.ag-cell-bloqueio:hover { background: repeating-linear-gradient(
  45deg,
  rgba(0,0,0,0.04),
  rgba(0,0,0,0.04) 4px,
  transparent 4px,
  transparent 8px
); }

.ag-bloqueio-label {
  font-size: 10px;
  color: var(--text-xmuted);
  padding: 2px 4px;
  user-select: none;
}

/* Eventos */
.ag-event {
  border-radius: var(--radius-sm);
  padding: 3px 6px;
  font-size: var(--size-xs);
  line-height: 1.3;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  cursor: pointer;
  position: absolute;
  left: 2px;
  right: 2px;
  transition: filter 100ms;
  min-height: 32px;
  z-index: 2;
  box-sizing: border-box;
}
.ag-event:hover { filter: brightness(0.95); }

.ag-ev-agendada   { background: var(--s-agendada-bg);   border-left: 3px solid var(--s-agendada);   }
.ag-ev-confirmada { background: var(--s-confirmada-bg); border-left: 3px solid var(--s-confirmada); }
.ag-ev-atendida   { background: var(--s-atendida-bg);   border-left: 3px solid var(--s-atendida);   }
.ag-ev-falta      { background: var(--s-falta-bg);      border-left: 3px solid var(--s-falta);      }
.ag-ev-cancelada  { background: var(--s-cancelada-bg);  border-left: 3px solid var(--s-cancelada);  }
.ag-ev-pendente   { background: var(--s-pendente-bg);   border-left: 3px solid var(--s-pendente);   }
.ag-ev-paga       { background: var(--s-paga-bg);       border-left: 3px solid var(--s-paga);       }

/* Drop hover */
.ag-drop-hover {
  background: rgba(27,43,75,0.07) !important;
}

/* Modo de seleção ativo — cursor crosshair nos slots vazios */
.ag-selecting .ag-cell,
.ag-selecting .ag-mes-cell { cursor: crosshair; }

/* Estado selecionado — fundo sólido, texto branco, estilo Apple Calendar */
.ag-chip-selected.ag-ev-agendada,   .ag-grade-chip.ag-chip-selected.ag-ev-agendada   { background: var(--s-agendada-sel)   !important; color: #fff !important; border-left-color: transparent !important; filter: none; outline: none; }
.ag-chip-selected.ag-ev-confirmada, .ag-grade-chip.ag-chip-selected.ag-ev-confirmada { background: var(--s-confirmada-sel) !important; color: #fff !important; border-left-color: transparent !important; filter: none; outline: none; }
.ag-chip-selected.ag-ev-atendida,   .ag-grade-chip.ag-chip-selected.ag-ev-atendida   { background: var(--s-atendida-sel)   !important; color: #fff !important; border-left-color: transparent !important; filter: none; outline: none; }
.ag-chip-selected.ag-ev-falta,      .ag-grade-chip.ag-chip-selected.ag-ev-falta      { background: var(--s-falta-sel)      !important; color: #fff !important; border-left-color: transparent !important; filter: none; outline: none; }
.ag-chip-selected.ag-ev-cancelada,  .ag-grade-chip.ag-chip-selected.ag-ev-cancelada  { background: var(--s-cancelada-sel)  !important; color: #fff !important; border-left-color: transparent !important; filter: none; outline: none; }
.ag-chip-selected .ag-ev-nome,
.ag-chip-selected .ag-ev-serv,
.ag-chip-selected .ag-mes-chip-nome,
.ag-chip-selected .ag-mes-chip-hora,
.ag-chip-selected .ag-grade-chip-nome,
.ag-chip-selected .ag-grade-chip-serv { color: #fff !important; }

.ag-ev-nome {
  font-weight: var(--weight-semibold);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
}

.ag-ev-mode-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.ag-ev-serv {
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ag-ev-horario {
  display: flex;
  align-items: center;
  gap: 3px;
}

.ag-ev-badge {
  align-self: flex-start;
}

.ag-ev-badge-agendada   { background: var(--s-agendada-bg);   color: var(--s-agendada); }
.ag-ev-badge-confirmada { background: var(--s-confirmada-bg); color: var(--s-confirmada); }
.ag-ev-badge-atendida   { background: var(--s-atendida-bg);   color: var(--s-atendida); }
.ag-ev-badge-falta      { background: var(--s-falta-bg);      color: var(--s-falta); }
.ag-ev-badge-cancelada  { background: var(--s-cancelada-bg);  color: var(--s-cancelada); }
.ag-ev-badge-pendente   { background: var(--s-pendente-bg);   color: var(--s-pendente); }
.ag-ev-badge-paga       { background: var(--s-paga-bg);       color: var(--s-paga); }

/* -------- Formulário de agendamento -------- */
.ag-form { display: flex; flex-direction: column; gap: var(--space-4); }

/* Autocomplete de paciente */
.ag-pac-search-wrap {
  position: relative;
}
.ag-pac-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}
.ag-pac-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-xmuted);
  pointer-events: none;
  flex-shrink: 0;
}
.ag-pac-input-row input {
  flex: 1;
  padding-left: 30px;
}
.ag-pac-add-btn {
  flex-shrink: 0;
}

.ag-pac-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--glass-modal);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}
.ag-pac-dropdown.ag-pop-open { display: block; }

.ag-pac-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: var(--space-2) var(--space-3);
  color: var(--text);
  cursor: pointer;
  transition: background 100ms;
}
.ag-pac-item-name { font-size: var(--size-sm); }
.ag-pac-item-meta {
  margin-top: 2px;
  font-size: var(--size-xs);
  color: var(--text-muted);
}
.ag-pac-item:hover { background: var(--navy-light); }
.ag-pac-empty { color: var(--text-muted); cursor: default; }
.ag-pac-empty:hover { background: transparent; }

/* -------- Pill de modalidade -------- */
.ag-modal-pill {
  border-color: transparent;
  gap: 4px;
}
.ag-modal-pill-presencial {
  background: rgba(27,43,75,0.08);
  border-color: rgba(27,43,75,0.14);
  color: var(--navy);
}
.ag-modal-pill-teleconsulta {
  background: rgba(26,58,42,0.08);
  border-color: rgba(26,58,42,0.14);
  color: var(--teal);
}

/* -------- Popover balão de detalhes (estilo Apple Calendar) -------- */
.ag-detail-pop {
  position: fixed;
  z-index: 9500;
  isolation: isolate;
  width: 400px;
  background: rgba(248,248,252,0.68);
  backdrop-filter: blur(48px) saturate(180%);
  -webkit-backdrop-filter: blur(48px) saturate(180%);
  border: 0.5px solid rgba(255,255,255,0.75);
  border-radius: 20px;
  box-shadow:
    0 20px 48px rgba(0,0,0,0.12),
    0 4px 12px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.5);
  animation: ag-pop-in 180ms cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes ag-pop-in {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

/* Seta do balão */
.ag-detail-pop-arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: rgba(248,248,252,0.9);
  border: 0.5px solid rgba(255,255,255,0.75);
  transform: rotate(45deg);
  z-index: -1;
}
.ag-detail-pop-arrow--left  { left: -6px; border-right: none; border-top: none; }
.ag-detail-pop-arrow--right { right: -6px; border-left: none; border-bottom: none; }
.ag-detail-pop-arrow--top   { top: -6px; border-bottom: none; border-right: none; }
.ag-detail-pop-arrow--bottom { bottom: -6px; border-top: none; border-left: none; }

/* Inner container */
.ag-detail-pop-inner {
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Header: nome do paciente + X */
.ag-detail-pop-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.ag-detail-pop-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(0,0,0,0.08);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
  margin-left: auto;
}
.ag-detail-pop-close:hover { background: rgba(0,0,0,0.13); }
.ag-detail-pop-close:active { background: rgba(0,0,0,0.18); transform: scale(0.93); }

/* Meta (data/hora/repetir) — seção cinza */
.ag-detail-pop-meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(0,0,0,0.03);
  border: 0.5px solid rgba(0,0,0,0.07);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
}

/* Linha data/hora */
.ag-dpop-datetime-row,
.ag-dpop-repeat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  min-height: 44px;
  border-bottom: 0.5px solid rgba(0,0,0,0.07);
}
.ag-dpop-repeat-row { border-bottom: none; }
.ag-dpop-dt-lbl {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  width: 58px;
  flex-shrink: 0;
}
.ag-dpop-dt-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Rows de campos (Serviço, Modalidade, Status, Obs) */
.ag-detail-pop-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(0,0,0,0.03);
  border: 0.5px solid rgba(0,0,0,0.07);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
}
.ag-detail-pop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  min-height: 44px;
  border-bottom: 0.5px solid rgba(0,0,0,0.07);
}
.ag-detail-pop-row:last-child { border-bottom: none; }
.ag-detail-pop-lbl {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  flex-shrink: 0;
}
.ag-detail-pop-row > .ag-dpop-value-btn,
.ag-detail-pop-row > .ag-dpop-mode-toggle,
.ag-detail-pop-row > .ag-status-badge,
.ag-detail-pop-row > .ag-dpop-field-obs {
  width: 178px;
  max-width: 178px;
  margin-left: auto;
}
.ag-detail-pop-val {
  font-size: 13px;
  color: var(--text);
  font-weight: 400;
}
.ag-detail-pop-row--obs {
  align-items: center;
  min-height: 44px;
  height: auto;
}
.ag-detail-pop-row--obs > .ag-dpop-field-obs {
  width: 100%;
  max-width: none;
}

/* Footer — ações ícone */
.ag-detail-pop-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 0.5px solid rgba(0,0,0,0.07);
}
.ag-detail-pop-footer-left,
.ag-detail-pop-footer-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Campos inline — apenas reseta width global */
.ag-dpop-field {
  width: auto !important;
}

.ag-dpop-field-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.24px;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-appearance: none;
  color: var(--text);
  width: 100% !important;
}
.ag-dpop-field-name::placeholder { color: var(--text-muted); font-weight: 400; }
.ag-dpop-date-wrap {
  width: 130px;
  height: 32px;
  flex-shrink: 0;
  overflow: hidden;
  border: none;
  border-radius: 8px;
  background: rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
}
.ag-dpop-time-wrap {
  width: 100px;
  height: 32px;
  flex-shrink: 0;
  overflow: visible;
  border: none;
  border-radius: 8px;
  background: rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
}
.ag-dpop-field-date,
.ag-dpop-field-time {
  width: 100% !important;
  font-size: 12px;
  padding: 0 4px;
  height: 32px !important;
  margin-top: 0;
  box-sizing: border-box;
  border: none !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text);
  cursor: pointer;
  display: block;
  outline: none;
}
.ag-dpop-field-date::-webkit-date-and-time-value,
.ag-dpop-field-time::-webkit-date-and-time-value {
  text-align: center;
}
.ag-dpop-field-date::-webkit-datetime-edit,
.ag-dpop-field-time::-webkit-datetime-edit {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-height: 0;
}
/* Obs — linha única, expande ao digitar */
.ag-dpop-field-obs {
  flex: 1;
  min-width: 0;
  resize: none;
  font-size: 13px;
  color: var(--text);
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  padding: 0 !important;
  overflow: hidden;
  transition: height 160ms ease;
  line-height: 1.4;
  height: 20px;
  min-height: 20px;
}

/* Dropdown de pacientes */
.ag-dpop-pac-dropdown {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 0.5px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  overflow: hidden;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 2px;
}
.ag-dpop-pac-item {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 0.5px solid rgba(0,0,0,0.07);
  cursor: pointer;
  display: block;
}
.ag-dpop-pac-item:last-child { border-bottom: none; }
.ag-dpop-pac-item:hover { background: rgba(120,120,128,0.08); }

/* Toggle modalidade — segmented control Apple */
.ag-dpop-mode-toggle {
  display: flex;
  background: rgba(120,120,128,0.12);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
  justify-content: flex-end;
}
.ag-dpop-mode-btn {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: 7px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 120ms, color 120ms, box-shadow 120ms;
}
.ag-dpop-mode-btn.ag-dpop-mode-active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 1px rgba(0,0,0,0.06);
  font-weight: 600;
}

/* Serviço e Repetir — valor à direita */
.ag-dpop-value-btn {
  font-size: 13px;
  color: var(--navy);
  font-weight: 400;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: right;
  white-space: nowrap;
}
.ag-dpop-value-btn:active { opacity: 0.6; }

/* Separator no action-pop */
.action-pop-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Sheet "Personalizar repetição" */
.ag-rrule-sheet {
  background: var(--glass-modal);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 0.5px solid var(--border-glass);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
}
.ag-rrule-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.ag-rrule-sheet-title {
  font-size: var(--size-base);
  font-weight: var(--weight-semibold);
  color: var(--text);
}
.ag-rrule-sheet-close {
  width: 24px;
  height: 24px;
  border: none;
  background: var(--navy-light);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.ag-rrule-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ag-rrule-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.ag-rrule-lbl {
  font-size: var(--size-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}
.ag-rrule-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ag-rrule-step-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  flex-shrink: 0;
}
.ag-rrule-step-btn:hover { background: var(--navy-hover); }
.ag-rrule-step-val {
  min-width: 28px;
  text-align: center;
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
  padding: 0 4px;
}
.ag-rrule-seg {
  display: inline-flex;
  background: rgba(120,120,128,0.12);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
  flex: 1;
}
.ag-rrule-seg-stop { width: 100%; }
.ag-rrule-seg-btn {
  flex: 1;
  padding: 5px 6px;
  font-size: var(--size-xs);
  font-weight: var(--weight-medium);
  border: none;
  border-radius: 7px;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 120ms, color 120ms, box-shadow 120ms;
  white-space: nowrap;
}
.ag-rrule-seg-btn.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-weight: var(--weight-semibold);
}
.ag-rrule-seg-btn:active { transform: scale(0.96); }

/* Campo "Até" na sheet de repetição */
.ag-dpop-date-wrap[data-rrule-date] {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 220px;
  max-width: 220px;
  height: 36px;
  border-radius: 9px;
  background: rgba(0,0,0,0.05);
  border: none;
  overflow: hidden;
  cursor: pointer;
}
.ag-dpop-date-pill {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
  pointer-events: none;
}
.ag-dpop-picker-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100% !important;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  border: none !important;
  background: transparent !important;
}
.ag-rrule-sheet-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* ── Sinalizador de recorrência nos chips ─────────────────── */
.ag-chip-recorrente {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  opacity: 0.55;
  flex-shrink: 0;
  vertical-align: middle;
}
.ag-chip-recorrente--inline {
  margin-left: 4px;
}

/* View Mês */
.ag-mes-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: transparent;
}

.ag-mes-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid rgba(228, 232, 239, 0.92);
  background: transparent;
}

.ag-mes-dow {
  padding: 14px 12px;
  font-size: 12px;
  font-weight: 560;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0.01em;
  text-align: center;
}

.ag-mes-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  flex: 1;
  overflow-y: auto;
  align-content: start;
  background: transparent;
}

.ag-mes-cell {
  min-height: 164px;
  border-right: 1px solid rgba(228, 232, 239, 0.92);
  border-bottom: 1px solid rgba(228, 232, 239, 0.92);
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: background 0.1s;
  text-align: left;
  background: transparent;
}

.ag-mes-cell:hover { background: transparent; }

.ag-mes-cell:nth-child(7n) { border-right: none; }

.ag-mes-cell-vazia {
  border-right: 1px solid rgba(228, 232, 239, 0.92);
  border-bottom: 1px solid rgba(228, 232, 239, 0.92);
  background: transparent;
  cursor: default;
}

.ag-mes-cell.ag-mes-hoje {
  background: rgba(246, 248, 252, 0.68);
}

.ag-mes-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 28px;
}

.ag-mes-cell-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.ag-mes-dia-num {
  font-size: 13px;
  font-weight: 560;
  color: var(--text-muted);
  line-height: 1;
  padding: 0;
  align-self: flex-start;
}

.ag-mes-dia-hoje {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  background: var(--navy);
  color: white;
  border-radius: 50%;
  font-weight: 620;
  font-size: 12px;
}

.ag-mes-chip {
  font-size: 11px;
  font-weight: var(--weight-medium);
  padding: 2px 5px 2px 0;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  min-height: 22px;
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  color: var(--text);
}

.ag-mes-chip-bar {
  width: 3px;
  align-self: stretch;
  border-radius: 2px 0 0 2px;
  flex-shrink: 0;
}
.ag-ev-agendada   .ag-mes-chip-bar { background: var(--s-agendada);   }
.ag-ev-confirmada .ag-mes-chip-bar { background: var(--s-confirmada); }
.ag-ev-atendida   .ag-mes-chip-bar { background: var(--s-atendida);   }
.ag-ev-falta      .ag-mes-chip-bar { background: var(--s-falta);      }
.ag-ev-cancelada  .ag-mes-chip-bar { background: var(--s-cancelada);  }
.ag-ev-pendente   .ag-mes-chip-bar { background: var(--s-pendente);   }
.ag-ev-paga       .ag-mes-chip-bar { background: var(--s-paga);       }
.ag-chip-selected .ag-mes-chip-bar { display: none; }

.ag-mes-chip-nome {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.ag-mes-chip-sep {
  flex: 1;
}

.ag-mes-chip-hora {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.ag-mes-chip:hover { background: rgba(27, 43, 75, 0.04); }

/* Reset estilos de ag-ev-* no contexto do mês */
.ag-mes-chip[class*="ag-ev-"]:not(.ag-chip-selected) {
  background: transparent;
  border-left: none;
  opacity: 1;
}

.ag-mes-mais {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 0 0;
  cursor: pointer;
  margin-top: auto;
  align-self: flex-start;
}

.ag-mes-mais:hover { color: var(--navy); }

/* ============================================================
   Agenda — Grade multi-coluna (sem filtro)
   ============================================================ */

.ag-grade-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Header fixo — fora do scroll */
.ag-grade-header-row {
  display: grid;
  min-width: max-content;
  flex-shrink: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: relative;
  z-index: 2;
}

.ag-grade-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
}

.ag-grade-grid {
  display: grid;
  min-width: max-content;
}

/* Célula de canto (acima da coluna de horas) */
.ag-grade-corner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  border-right: 1px solid var(--border);
  background: var(--bg-card);
}

/* Header de cada médico */
.ag-grade-doc-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-right: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: background 140ms;
}
.ag-grade-doc-header:last-child { border-right: none; }
.ag-grade-doc-header:hover { background: var(--navy-light); }

.ag-grade-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  flex-shrink: 0;
  letter-spacing: 0.02em;
  letter-spacing: 0.02em;
}

.ag-grade-doc-info { min-width: 0; }
.ag-grade-doc-nome {
  font-size: var(--size-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ag-grade-doc-cnt {
  font-size: var(--size-xs);
  color: var(--text-muted);
}

/* Coluna de horários (sticky à esquerda) */
.ag-grade-time {
  padding: var(--space-1) var(--space-2) 0;
  font-size: var(--size-xs);
  color: var(--text-xmuted);
  font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  position: sticky;
  left: 0;
  z-index: 1;
}

/* Células de agendamento */
.ag-grade-cell {
  padding: var(--space-1) var(--space-2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.ag-grade-cell-event {
  padding: 2px 3px 2px 0;
  border-bottom: none;
}
.ag-grade-cell:last-child { border-right: none; }
button.ag-grade-cell,
button.ag-cell,
button.ag-mes-cell {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border-radius: 0;
  color: inherit;
  font: inherit;
  text-align: left;
}
button.ag-grade-cell {
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background 120ms;
}
button.ag-grade-cell-empty:hover {
  background: var(--navy-light);
}
button.ag-cell, div.ag-cell {
  border: 0;
  border-right: 1px solid rgba(229,231,235,0.45);
  border-bottom: 1px solid rgba(229,231,235,0.45);
}
div.ag-cell:hover,
[data-grade-drop]:hover { background: transparent; cursor: pointer; }
button.ag-mes-cell {
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
button.ag-mes-cell:hover { background: transparent; }
button.ag-status-badge,
button.ag-wapop-item,
button.ag-ctxpop-item,
button.ag-spop-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}
button.ag-status-badge {
  width: auto;
}

.ag-grade-cell-bloqueio {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 4px,
    rgba(0,0,0,0.025) 4px,
    rgba(0,0,0,0.025) 8px
  );
}

.ag-grade-bloqueio-lbl {
  font-size: 10px;
  color: var(--text-xmuted);
  font-style: italic;
}

/* Chip dentro da grade — estilo Apple Calendar */
.ag-grade-chip {
  width: 100%;
  height: 100%;
  padding: 4px var(--space-2) 4px 6px;
  border-radius: 4px;
  border: none;
  border-left: 2.5px solid transparent;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: filter 140ms;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 1px;
  position: relative;
  font: inherit;
  text-align: left;
}

.ag-grade-chip-modal-icon {
  position: absolute;
  top: 3px;
  right: 4px;
  opacity: 0.45;
  display: flex;
  align-items: center;
  line-height: 1;
}
.ag-grade-chip:hover { filter: brightness(0.96); }

.ag-grade-chip.ag-ev-agendada   { background: var(--s-agendada-bg);   border-left-color: var(--s-agendada);   }
.ag-grade-chip.ag-ev-confirmada { background: var(--s-confirmada-bg); border-left-color: var(--s-confirmada); }
.ag-grade-chip.ag-ev-atendida   { background: var(--s-atendida-bg);   border-left-color: var(--s-atendida);   }
.ag-grade-chip.ag-ev-falta      { background: var(--s-falta-bg);      border-left-color: var(--s-falta);      }
.ag-grade-chip.ag-ev-cancelada  { background: var(--s-cancelada-bg);  border-left-color: var(--s-cancelada);  }
.ag-grade-chip.ag-ev-pendente   { background: var(--s-pendente-bg);   border-left-color: var(--s-pendente);   }
.ag-grade-chip.ag-ev-paga       { background: var(--s-paga-bg);       border-left-color: var(--s-paga);       }

.ag-grade-chip-nome {
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.3;
}

.ag-grade-chip-serv {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* Legenda de status */
.ag-legend {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  flex-wrap: wrap;
}
.ag-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.ag-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ag-legend-dot.ag-ev-agendada   { background: var(--s-agendada);   }
.ag-legend-dot.ag-ev-confirmada { background: var(--s-confirmada); }
.ag-legend-dot.ag-ev-atendida   { background: var(--s-atendida);   }
.ag-legend-dot.ag-ev-falta      { background: var(--s-falta);      }
.ag-legend-dot.ag-ev-cancelada  { background: var(--s-cancelada);  }
.ag-legend-dot.ag-ev-pendente   { background: var(--s-pendente);   }
.ag-legend-dot.ag-ev-paga       { background: var(--s-paga);       }
.ag-legend-label {
  font-size: var(--size-xs);
  color: var(--text-muted);
}

/* ============================================================
   Agenda — Tabela (dia, médico filtrado)
   ============================================================ */

.ag-tabela-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ag-tabela-inner {
  flex: 1;
  overflow-y: auto;
}

.ag-tabela {
  width: 100%;
  border-collapse: collapse;
}

.ag-tabela thead th {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.7);
  position: sticky;
  top: 0;
  z-index: 2;
}

.ag-tabela tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background 100ms;
}
.ag-tabela tbody tr:hover { background: rgba(27,43,75,0.02); }
.ag-tabela tbody tr:last-child { border-bottom: none; }

.ag-tabela td {
  padding: var(--space-2) var(--space-3);
  vertical-align: middle;
}

.ag-tab-hora {
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
  width: 88px;
  line-height: 1.5;
}
.ag-tab-hora-fim {
  font-size: var(--size-xs);
  font-weight: var(--weight-regular);
  color: var(--text-xmuted);
}

.ag-tab-nome {
  min-width: 180px;
}
.ag-tab-nome strong {
  display: block;
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
}
.ag-tab-nome small {
  font-size: var(--size-xs);
  color: var(--text-muted);
}

.ag-tab-serv {
  width: 120px;
}

/* Coluna de ações */
.ag-tab-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  width: 80px;
}
.ag-tab-action-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
}

/* Badge de status (inline na tabela) */
.ag-status-wrap { position: relative; display: inline-block; }

.ag-status-badge {
  gap: 5px;
}
.ag-status-badge:hover { filter: brightness(0.93); }

/* Dot no status badge */
.ag-status-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Status popover */
.ag-status-pop {
  min-width: 150px;
}
.ag-status-pop.ag-pop-open { display: block; }

.ag-spop-item {
}
.ag-spop-item-active {
  background: var(--navy-light);
  font-weight: var(--weight-medium);
}

.ag-spop-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* WA popover */
.ag-wa-pop,
.ag-ctx-pop {
  min-width: 140px;
}
.ag-wa-pop.ag-pop-open,
.ag-ctx-pop.ag-pop-open { display: block; }

.ag-wapop-item,
.ag-ctxpop-item {
}

/* Legenda (rodapé da tabela) */
.ag-tabela-legenda {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.ag-leg-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--size-xs);
  color: var(--text-muted);
}

.ag-leg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ag-leg-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ag-leg-text {
  font-size: var(--size-xs);
  color: var(--text-muted);
}

/* ============================================================
   Agenda — Modal motivo (falta/cancelada)
   ============================================================ */

.ag-toggle-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ag-toggle-wrap input[type="checkbox"] {
  display: none;
}

.ag-toggle-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 200ms;
  flex-shrink: 0;
}
.ag-toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 200ms;
  box-shadow: var(--shadow-sm);
}
.ag-toggle-slider.ag-toggle-on,
input[type="checkbox"]:checked + .ag-toggle-slider {
  background: var(--navy);
}
.ag-toggle-slider.ag-toggle-on::after,
input[type="checkbox"]:checked + .ag-toggle-slider::after {
  transform: translateX(16px);
}

.ag-mot-textarea {
  width: 100%;
  min-height: 80px;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: var(--size-sm);
  color: var(--text);
  background: var(--bg-input);
  resize: vertical;
  transition: border-color 150ms;
  box-sizing: border-box;
}
.ag-mot-textarea:focus {
  outline: none;
  border-color: var(--navy);
}
.ag-mot-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   Botões de ação da tabela (wrapper relativo para popovers)
   ============================================================ */

.ag-btn-wa,
.ag-btn-ctx {
  position: relative;
}

/* Asterisco obrigatório */
.req { color: var(--s-cancelada); }

/* form-label (alias para label em modais da agenda) */
.form-label {
  font-size: var(--size-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
}

/* ============================================================
   Financeiro
   ============================================================ */

.view--financeiro {
  background: #FFFFFF;
}

.fin-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.fin-shell {
  position: relative;
}

.fin-shell.fin-shell-has-drawer {
  gap: 0;
}

.fin-main {
  min-width: 0;
}

.fin-ledger-shell {
  background: #FFFFFF;
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.fin-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 18px;
}

.fin-toolbar-top,
.fin-toolbar-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.fin-toolbar-top {
  justify-content: flex-start;
}

.fin-toolbar-bottom {
  justify-content: flex-start;
}

.fin-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.fin-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: rgba(112, 115, 147, 0.06);
  border-radius: 18px;
  flex-shrink: 0;
}

.fin-tab {
  height: 34px;
  padding: 0 16px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.fin-tab-active {
  background: #FFFFFF;
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(112, 115, 147, 0.08);
}

.fin-nav-mes {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.fin-nav-mes .btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(112, 115, 147, 0.14);
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(11, 15, 32, 0.04);
  color: var(--text-muted);
}

.fin-nav-mes .btn-icon:hover {
  color: var(--text);
  border-color: rgba(82, 102, 235, 0.22);
  background: rgba(82, 102, 235, 0.03);
}

.fin-mes-label {
  min-width: 92px;
  text-align: center;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: #222539;
}

.fin-search-wrap {
  min-width: 360px;
  max-width: 540px;
}

.fin-search-wrap .pac-search {
  height: 44px;
}

.fin-search-wrap,
.fin-status-pills,
.fin-btn-new {
  flex-shrink: 0;
}

.fin-btn-new {
  margin-left: auto;
}

.fin-status-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fin-spill {
  min-width: 0;
  min-height: 32px;
  border-radius: 999px;
  border-color: rgba(112, 115, 147, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-muted);
  box-shadow: none;
  padding: 0 12px;
  font-size: 12px;
}

.fin-spill-active {
  background: rgba(82, 102, 235, 0.06);
  border-color: rgba(82, 102, 235, 0.16);
  color: var(--navy);
}

.fin-btn-new {
  min-height: 38px;
  padding-inline: 15px;
  border-radius: 14px;
  box-shadow: none;
}

.fin-kpis {
  background: #FFFFFF;
}

.fin-summary {
  background: #FFFFFF;
  border-top: 1px solid rgba(112, 115, 147, 0.12);
}

.fin-summary-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px;
  padding: 4px 0 0;
  border-bottom: 1px solid rgba(112, 115, 147, 0.12);
}

.fin-summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.fin-kpi {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 18px 16px;
}

.fin-kpi + .fin-kpi {
  border-left: 1px solid rgba(112, 115, 147, 0.1);
}

.fin-kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: rgb(112, 112, 125);
  letter-spacing: -0.01em;
}

.fin-kpi-valor {
  font-size: clamp(1.45rem, 1.05rem + 0.9vw, 1.95rem);
  font-weight: 420;
  letter-spacing: -0.045em;
  line-height: 1.08;
  color: #2A2C3F;
}

.fin-kpi-sub {
  font-size: 11px;
  color: rgba(112, 112, 125, 0.86);
}

.fin-summary-toggle {
  align-self: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(106, 131, 255, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #2A2C3F;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.fin-summary-toggle:hover {
  background: rgba(82, 102, 235, 0.04);
  border-color: rgba(82, 102, 235, 0.48);
}

.fin-summary-expanded .fin-summary-toggle {
  transform: rotate(180deg);
}

.fin-summary-expanded-head {
  display: flex;
  justify-content: flex-end;
  padding: 8px 0 6px;
}

.fin-summary-expanded-layout {
  display: grid;
  grid-template-columns: minmax(200px, 0.62fr) minmax(0, 1.06fr) minmax(0, 0.74fr);
  align-items: stretch;
  border-bottom: 1px solid rgba(112, 115, 147, 0.1);
}

.fin-summary-focus {
  padding: 20px 18px 20px 6px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid rgba(112, 115, 147, 0.1);
}

.fin-summary-focus-kicker {
  font-size: 13px;
  font-weight: 500;
  color: rgb(82, 84, 99);
}

.fin-summary-focus-value {
  font-size: clamp(1.75rem, 1.32rem + 0.7vw, 2.3rem);
  font-weight: 420;
  letter-spacing: -0.055em;
  line-height: 1.02;
  color: #2A2C3F;
}

.fin-summary-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.fin-summary-stat {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.fin-summary-stat-dot {
  width: 4px;
  height: 22px;
  border-radius: 999px;
  display: inline-block;
}

.fin-summary-stat-dot-liquida { background: #176748; }
.fin-summary-stat-dot-total { background: #E5367A; }
.fin-summary-stat-dot-pendente { background: #D17A1C; }
.fin-summary-stat-dot-despesa { background: #A54C61; }

.fin-summary-stat-label {
  font-size: 13px;
  color: rgb(82, 84, 99);
}

.fin-summary-stat-value {
  font-size: 13px;
  font-weight: 500;
  color: #2A2C3F;
  text-align: right;
}

.fin-summary-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 0;
}

.fin-summary-panel {
  padding: 14px 16px 16px;
}

.fin-summary-panel + .fin-summary-panel {
  border-left: 1px solid rgba(112, 115, 147, 0.1);
}

.fin-summary-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.fin-summary-panel-title {
  font-size: 12px;
  font-weight: 500;
  color: rgb(112, 112, 125);
}

.fin-summary-legend {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.fin-summary-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: rgba(42, 44, 63, 0.88);
}

.fin-summary-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.fin-summary-dot-recebido { background: #16825D; }
.fin-summary-dot-pendente { background: #D17A1C; }
.fin-summary-dot-despesa { background: #A54C61; }

.fin-line-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fin-line-chart svg {
  width: 100%;
  height: 176px;
  display: block;
}

.fin-line-chart-guide,
.fin-line-chart-point {
  opacity: 0;
  transition: opacity 140ms ease;
}

.fin-line-chart-guide.is-active,
.fin-line-chart-point.is-active {
  opacity: 1;
}

.fin-line-chart-hotspot {
  cursor: crosshair;
}

.fin-line-chart-axis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: rgba(112, 112, 125, 0.9);
}

.fin-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fin-breakdown-focus {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.fin-breakdown-focus-label {
  font-size: 13px;
  font-weight: 500;
  color: rgb(82, 84, 99);
}

.fin-breakdown-focus-value {
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.05em;
  font-weight: 430;
  color: #2A2C3F;
}

.fin-breakdown-focus-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(82, 84, 99, 0.9);
}

.fin-breakdown-chart {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  min-height: 138px;
}

.fin-breakdown-bar-item {
  border: none;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: rgba(82, 84, 99, 0.94);
}

.fin-breakdown-bar-shell {
  width: 100%;
  height: 110px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.fin-breakdown-bar-fill {
  width: 24px;
  height: var(--fin-break-height);
  border-radius: 1px 1px 0 0;
  background: linear-gradient(180deg, rgba(23, 103, 72, 0.14), rgba(23, 103, 72, 0.5));
  border-top: 3px solid #176748;
  transition: transform 140ms ease, opacity 140ms ease;
}

.fin-breakdown-bar-item.is-active .fin-breakdown-bar-fill,
.fin-breakdown-bar-item:hover .fin-breakdown-bar-fill {
  transform: translateY(-2px);
  opacity: 1;
}

.fin-breakdown-bar-caption {
  font-size: 12px;
  white-space: nowrap;
}

.fin-breakdown-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fin-breakdown-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.fin-breakdown-label {
  font-size: 14px;
  font-weight: 500;
  color: #2A2C3F;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fin-breakdown-value {
  font-size: 13px;
  color: rgba(42, 44, 63, 0.76);
  white-space: nowrap;
}

.fin-breakdown-bar {
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(112, 115, 147, 0.08);
  overflow: hidden;
}

.fin-breakdown-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.fin-breakdown-fill-receita {
  background: linear-gradient(90deg, rgba(22, 130, 93, 0.82), rgba(22, 130, 93, 0.28));
}

.fin-breakdown-fill-despesa {
  background: linear-gradient(90deg, rgba(165, 76, 97, 0.82), rgba(165, 76, 97, 0.28));
}

.fin-summary-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}

.fin-summary-empty-inline {
  padding: 8px 0 0;
  text-align: left;
}

.fin-summary-loading .fin-summary-metric {
  min-height: 102px;
  border-radius: 22px;
}

.fin-summary-loading .fin-summary-toggle {
  width: 56px;
  height: 56px;
  border-radius: 999px;
}

.fin-list {
  min-width: 0;
  background: #FFFFFF;
}

.fin-loading {
  padding: var(--space-10);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--size-sm);
}

.fin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.fin-table thead th {
  padding: 18px 28px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: rgb(112, 112, 125);
  letter-spacing: -0.01em;
  border-bottom: 1px solid rgba(112, 115, 147, 0.1);
  background: #FFFFFF;
  position: sticky;
  top: 0;
  z-index: 1;
}

.fin-table tbody tr {
  border-bottom: 1px solid rgba(112, 115, 147, 0.08);
  transition: background 140ms ease, box-shadow 140ms ease;
}

.fin-table tbody tr:last-child {
  border-bottom: none;
}

.fin-tr-click {
  cursor: pointer;
}

.fin-tr-click:hover {
  background: rgba(17, 24, 39, 0.018);
}

.fin-tr-selected {
  background: rgba(82, 102, 235, 0.04);
  box-shadow: inset 0 0 0 1px rgba(82, 102, 235, 0.18);
}

.fin-table td {
  padding: 18px 28px;
  color: #2A2C3F;
  vertical-align: middle;
}

.fin-td-nome {
  font-weight: 500;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fin-td-date,
.fin-td-serv {
  color: rgba(112, 112, 125, 0.92);
}

.fin-td-date {
  white-space: nowrap;
}

.fin-td-valor {
  font-weight: 520;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.fin-valor-despesa {
  color: #A54C61;
}

.fin-td-action {
  width: 92px;
  text-align: right;
}

.fin-action-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.fin-edit-icon {
  opacity: 0.28;
  transition: opacity 150ms ease;
}

.fin-tr-click:hover .fin-edit-icon,
.fin-tr-selected .fin-edit-icon {
  opacity: 0.92;
}

.btn-icon.fin-action-btn {
  color: rgba(112, 112, 125, 0.86);
  opacity: 0.54;
  transition: opacity 150ms ease, color 150ms ease, background 150ms ease;
}

.fin-tr-click:hover .btn-icon.fin-action-btn,
.fin-tr-selected .btn-icon.fin-action-btn {
  opacity: 1;
}

.btn-icon.fin-action-btn:hover {
  color: var(--navy);
  background: rgba(82, 102, 235, 0.06);
  opacity: 1;
}

.fin-status-wrap-inline {
  position: relative;
  display: inline-flex;
}

.fin-status-btn {
  cursor: pointer;
  transition: filter 140ms ease, transform 140ms ease;
}

.fin-status-btn:hover {
  filter: brightness(0.98);
}

.fin-status-pop {
  top: calc(100% + 6px);
  left: 0;
  min-width: 132px;
}

.fin-status-pop .action-pop-item {
  gap: 10px;
}

.fin-status-pop-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 8px;
}

.fin-status-pop-dot-pendente {
  background: var(--s-pendente);
}

.fin-status-pop-dot-paga {
  background: var(--s-paga);
}

.fin-status-pop-dot-cancelada {
  background: var(--s-cancelada);
}

.fin-nf-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  background: var(--s-atendida-bg);
  color: var(--s-atendida);
  border-color: var(--s-atendida-border);
}

.fin-nf-enviada {
  background: var(--s-confirmada-bg);
  color: var(--s-confirmada);
  border-color: var(--s-paga-border);
}

.fin-pagination-wrap {
  padding: 18px 0 24px;
  border-top: 1px solid rgba(112, 115, 147, 0.08);
  background: #FFFFFF;
}

.fin-drawer {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(420px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1002;
  transform: translateX(110%);
  transition: transform 180ms ease, opacity 160ms ease;
}

.fin-shell.fin-shell-has-drawer .fin-drawer {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.fin-drawer-shell,
.fin-drawer-empty {
  background: #FFFFFF;
  border: 1px solid rgba(112, 115, 147, 0.14);
  border-radius: 28px;
  box-shadow: 0 0 2px rgba(175, 178, 206, 0.44), 0 10px 24px rgba(11, 15, 32, 0.05);
}

.fin-drawer-empty {
  min-height: 260px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
}

.fin-drawer-empty-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(112, 112, 125, 0.86);
}

.fin-drawer-shell {
  padding: 26px 20px 30px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: relative;
  height: auto;
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.fin-drawer-shell > .fin-drawer-head,
.fin-drawer-shell > .ws-drawer-head {
  margin-inline: -20px;
  padding-inline: 20px;
}

.fin-drawer-kicker {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(112, 112, 125, 0.8);
  margin-bottom: 8px;
}

.fin-drawer-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.08;
  font-weight: 420;
  letter-spacing: -0.04em;
  color: #222539;
}


.fin-drawer-close:hover {
  background: rgba(82, 102, 235, 0.04);
}

.fin-drawer-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fin-drawer-amount {
  font-size: clamp(2rem, 1.6rem + 1vw, 3rem);
  line-height: 1;
  font-weight: 430;
  letter-spacing: -0.055em;
  color: #222539;
}

.fin-drawer-amount-despesa {
  color: #A54C61;
}

.fin-drawer-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fin-drawer-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(112, 115, 147, 0.14);
  background: rgba(246, 247, 251, 0.9);
  font-size: 12px;
  font-weight: 500;
  color: rgba(42, 44, 63, 0.82);
}

.fin-drawer-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.fin-drawer-actions-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fin-drawer-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  border: 1px solid rgba(112, 115, 147, 0.14);
  background: #FFFFFF;
  color: rgba(42, 44, 63, 0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.fin-drawer-icon-btn:hover {
  background: rgba(82, 102, 235, 0.05);
  border-color: rgba(82, 102, 235, 0.2);
  color: var(--navy);
}

.fin-drawer-icon-btn-primary {
  background: #1F325A;
  border-color: #1F325A;
  color: #FFFFFF;
}

.fin-drawer-icon-btn-primary:hover {
  background: #263D6D;
  border-color: #263D6D;
  color: #FFFFFF;
}

.fin-drawer-section {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid rgba(112, 115, 147, 0.12);
  padding-top: 8px;
}

.fin-drawer-section-form {
  gap: 14px;
  padding-top: 16px;
}

.fin-drawer-meta-note {
  font-size: 12px;
  color: rgba(112, 112, 125, 0.9);
}

.fin-drawer-field {
  gap: 6px;
}

.fin-drawer-field-label {
  color: rgb(112, 112, 125);
}

.fin-drawer-field input,
.fin-drawer-field select {
  min-height: 42px;
  border-radius: 14px;
  border-color: rgba(112, 115, 147, 0.16);
  background: #FFFFFF;
  box-shadow: none;
}

.fin-drawer-static {
  min-height: 42px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(112, 115, 147, 0.14);
  background: rgba(246, 247, 251, 0.72);
  font-size: 14px;
  font-weight: 500;
  color: #2A2C3F;
}

.fin-drawer-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid rgba(112, 115, 147, 0.08);
}

.fin-drawer-row:last-child {
  border-bottom: none;
}

.fin-drawer-row-label {
  font-size: 13px;
  color: rgb(112, 112, 125);
}

.fin-drawer-row-value {
  font-size: 14px;
  font-weight: 500;
  color: #2A2C3F;
  text-align: right;
}

.ws-drawer-backdrop,
.pac-detail-backdrop,
.fin-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 32, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.ws-drawer-backdrop-visible,
.pac-detail-backdrop-visible,
.fin-drawer-backdrop-visible {
  opacity: 1;
  pointer-events: auto;
  z-index: 1001;
}

@media (max-width: 1180px) {
  .fin-toolbar {
    gap: 12px;
  }

  .fin-toolbar-top,
  .fin-toolbar-bottom {
    align-items: stretch;
  }

  .fin-summary-expanded-layout {
    grid-template-columns: 1fr;
  }

  .fin-summary-focus,
  .fin-summary-panel {
    border-right: none;
    border-left: none;
  }

  .fin-summary-expanded-layout > * + * {
    border-top: 1px solid rgba(112, 115, 147, 0.1);
  }
}

@media (max-width: 768px) {
  .fin-summary-strip {
    grid-template-columns: 1fr;
    padding: 12px 12px 0;
  }

  .fin-summary-metrics {
    grid-template-columns: 1fr;
  }

  .fin-kpi {
    padding: 18px 16px;
  }

  .fin-kpi + .fin-kpi {
    border-left: none;
    border-top: 1px solid rgba(112, 115, 147, 0.1);
  }

  .fin-summary-toggle {
    justify-self: flex-end;
    margin: 0 4px 12px 0;
  }

  .fin-summary-panels {
    grid-template-columns: 1fr;
  }

  .fin-summary-expanded-head {
    padding: 8px 12px 4px;
  }

  .fin-summary-expanded-layout {
    grid-template-columns: 1fr;
  }

  .fin-summary-focus {
    padding: 18px 16px;
    border-right: none;
  }

  .fin-summary-panel + .fin-summary-panel {
    border-left: none;
    border-top: 1px solid rgba(112, 115, 147, 0.1);
  }

  .fin-search-wrap {
    min-width: min(100%, 240px);
    width: 100%;
    max-width: none;
  }

  .fin-status-pills {
    width: 100%;
  }

  .fin-btn-new {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }

  .fin-table thead th,
  .fin-table td,
  .fin-pagination-wrap {
    padding-left: 18px;
    padding-right: 18px;
  }

  .fin-td-serv {
    display: none;
  }

  .fin-drawer {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .fin-breakdown-chart {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fin-drawer-actions {
    grid-template-columns: 1fr;
  }

  .fin-drawer-actions-icons {
    display: flex;
    flex-wrap: wrap;
  }
}

/* ============================================================
   Configurações
   ============================================================ */

.cfg-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 1480px;
  margin: 0 auto;
  padding-bottom: 40px;
}

.view--configuracoes {
  background: #FFFFFF;
}

.cfg-toolbar {
  gap: 0;
}

.cfg-toolbar-row {
  justify-content: space-between;
}

.cfg-tabs-scroll {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(27,43,75,0.08);
}

.cfg-tabs {
  width: max-content;
}

.cfg-tab {
  white-space: nowrap;
}

.cfg-tabs-scroll .tab-active::after {
  bottom: -3px;
}

.cfg-body { flex: 1; min-height: 0; }
.cfg-loading { padding: var(--space-10); text-align: center; color: var(--text-muted); font-size: var(--size-sm); }

/* Section wrap */
.cfg-section-wrap { display: flex; flex-direction: column; gap: var(--space-6); }
.cfg-section { display: flex; flex-direction: column; gap: var(--space-3); }
.cfg-section-title { font-size: var(--size-sm); font-weight: var(--weight-semibold); color: var(--text); letter-spacing: -0.01em; }
.cfg-section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.cfg-section-h2 { font-size: 17px; font-weight: var(--weight-semibold); color: var(--home-text-strong); }
.cfg-section-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.cfg-empty-text { font-size: var(--size-sm); color: var(--text-muted); padding: var(--space-3) 0; }
.cfg-footer-actions {
  padding: var(--space-3) 16px var(--space-4);
  border-top: 1px solid var(--home-line-faint);
  display: flex;
  justify-content: flex-end;
}
.cfg-actions-row { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.cfg-table-shell {
  border: 1px solid rgba(112,115,147,0.08);
  border-radius: var(--radius-lg);
  overflow: auto;
}
.cfg-pane-card {
  background: var(--bg-card);
  border: 1px solid rgba(52,44,36,0.05);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  gap: var(--space-4);
}
/* Toggle switch (ui-switch) */
.ui-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}
.ui-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.ui-switch-track {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: 13px;
  background: rgba(113,123,155,0.18);
  transition: background 200ms;
  flex-shrink: 0;
}
.ui-switch input:checked ~ .ui-switch-track {
  background: var(--navy);
}
.ui-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0,0,0,0.20);
  transition: transform 200ms;
}
.ui-switch input:checked ~ .ui-switch-track .ui-switch-thumb {
  transform: translateX(22px);
}
.ui-switch-label {
  font-size: 14px;
  color: var(--home-text);
}

/* Relatórios — corpo do card */
.cfg-rel-dia-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
}
.cfg-rel-auto-head {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cfg-divider--spaced {
  margin: 8px 0;
}
.cfg-rel-dia-wrap {
  width: 44px;
  flex-shrink: 0;
  overflow: hidden;
}
.cfg-rel-dia-input {
  width: 100%;
  padding: 3px 6px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--home-text-strong);
  background: var(--home-hover);
  border: 1px solid var(--home-line-soft);
  border-radius: 6px;
  text-align: center;
  box-sizing: border-box;
}
.cfg-rel-dia-input:focus { outline: none; border-color: var(--home-line); background: var(--home-surface); }
.cfg-rel-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: 14px 16px;
}
.cfg-rel-checks-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.cfg-rel-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-3);
}
.cfg-rel-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.cfg-rel-pills .filter-pill-active {
  background: rgba(82,102,235,0.08);
  border-color: rgba(82,102,235,0.18);
}
/* Pill estático (envio automático — não clicável) */
.cfg-rel-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: var(--weight-medium);
  color: var(--home-text);
  background: var(--home-hover);
  border: 1px solid var(--home-line-soft);
}

/* Toggle sm para linhas de tabela */
.ui-switch-sm .ui-switch-track {
  width: 36px;
  height: 20px;
  border-radius: 10px;
}
.ui-switch-sm .ui-switch-thumb {
  width: 14px;
  height: 14px;
  top: 3px;
  left: 3px;
}
.ui-switch-sm input:checked ~ .ui-switch-track .ui-switch-thumb {
  transform: translateX(16px);
}

/* Médicos layout */
.cfg-med-head {
  align-items: center;
}

.cfg-med-search-wrap {
  min-width: min(100%, 300px);
  max-width: 620px;
}

.cfg-med-table-shell {
  border-top: 1px solid rgba(112,115,147,0.08);
  border-bottom: 1px solid rgba(112,115,147,0.08);
}

.cfg-med-table td {
  vertical-align: middle;
}

.cfg-med-row {
  cursor: pointer;
}

.cfg-med-avatar {
  background: rgba(199, 210, 254, 0.34);
  color: #41507B;
}

.cfg-med-drawer {
  opacity: 0;
  pointer-events: none;
  transform: translateX(110%);
  transition: transform 180ms ease, opacity 160ms ease;
}

.cfg-med-drawer.cfg-med-drawer-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}


.cfg-med-drawer-empty {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: var(--space-6);
}

.cfg-medico-badge { flex-shrink: 0; }
.badge-ativo   { background: var(--s-confirmada-bg); color: var(--s-confirmada); }
.badge-inativo { background: var(--s-cancelada-bg);  color: var(--s-cancelada); }

.cfg-add-btn {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--size-sm);
  cursor: pointer;
  transition: all 150ms;
  margin-top: auto;
}
.cfg-add-btn:hover { border-color: var(--navy); color: var(--navy); }
.cfg-add-btn-inline { margin-top: 0; }

/* Serviços table */
.cfg-servicos-table { width: 100%; border-collapse: collapse; font-size: var(--size-sm); }
.cfg-servicos-table th { padding: var(--space-2); text-align: left; font-size: 11px; font-weight: var(--weight-medium); color: var(--text-muted); letter-spacing: 0.01em; border-bottom: 1px solid var(--border); }
.cfg-servicos-table td { padding: var(--space-2); border-bottom: 1px solid var(--border); }
.cfg-servicos-table input, .cfg-servicos-table select { width: 100%; }
.cfg-srv-del { color: var(--text-xmuted); }
.cfg-srv-del:hover { color: var(--s-cancelada); }

/* Dias de atendimento */
.cfg-dias-wrap { display: flex; gap: var(--space-2); }
.cfg-dia-pill {
  line-height: 1;
}
.cfg-dia-active { background: var(--surface-tint); border-color: rgba(123,108,168,0.20); color: var(--navy); box-shadow: none; }

/* Acesso */
.cfg-acesso-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: flex-end; }
.cfg-access-head { align-items: center; }
.cfg-access-search-wrap { min-width: min(100%, 300px); max-width: 620px; }

/* WhatsApp / NF */
.cfg-wa-vars {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  padding: var(--space-2) var(--space-3);
  background: linear-gradient(180deg, var(--home-surface-strong) 0%, var(--home-surface) 100%);
  border: 1px solid var(--home-line-soft);
  border-radius: 16px;
  box-shadow: var(--home-shadow-card);
}
.cfg-vars-label { font-size: 11px; font-weight: var(--weight-medium); color: var(--home-text-muted); letter-spacing: 0.01em; }
.cfg-var-pill {
  min-height: 26px;
}

.cfg-wa-templates { display: flex; flex-direction: column; gap: var(--space-4); }
.cfg-rel-table-scroll { max-height: 420px; overflow-y: auto; }
.cfg-rel-body--scroll { max-height: 560px; overflow-y: auto; }
.cfg-wa-card {
  background: linear-gradient(180deg, var(--home-surface-strong) 0%, var(--home-surface) 100%);
  border: 1px solid var(--home-line-soft);
  border-radius: 16px;
  box-shadow: var(--home-shadow-card);
  overflow: hidden;
}
.cfg-wa-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--home-line-faint);
}
.cfg-wa-card-label { font-size: 14px; font-weight: var(--weight-medium); color: var(--home-text-strong); }
.cfg-wa-card-hint  { font-size: 12px; color: var(--home-text-muted); }
.cfg-wa-textarea {
  width: 100%; padding: 12px 16px;
  border: none; resize: vertical;
  font-size: 14px; color: var(--home-text-strong);
  background: transparent; font-family: var(--font);
  line-height: 1.6;
  box-sizing: border-box;
  min-height: 80px;
}
.cfg-wa-textarea:focus { outline: none; }

/* Cfg divider */
.cfg-divider {
  border: none;
  border-top: 1px solid var(--home-line-faint);
  margin: 0;
}

/* NF vars */
.cfg-nf-vars { display: flex; flex-direction: column; }
.cfg-nf-vars-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: 6px 0;
}

/* NF textarea dentro do card */
.cfg-nf-textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: 14px;
  font-family: var(--font);
  line-height: 1.6;
  color: var(--home-text-strong);
  background: transparent;
  border: none;
  padding: 12px 16px;
  resize: vertical;
  min-height: 80px;
}
.cfg-nf-textarea:focus { outline: none; }

/* NF preview */
.cfg-nf-layout { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.cfg-nf-edit-card { display: flex; flex-direction: column; }
.cfg-nf-preview-card {
  display: flex;
  flex-direction: column;
  background: var(--home-hover);
  border-radius: 16px;
}
.cfg-nf-preview-box {
  flex: 1;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--home-text);
  line-height: 1.7;
  white-space: pre-wrap;
  min-height: 120px;
}

/* Audit log — badges de ação */
.cfg-log-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
}
.cfg-log-badge--insert { background: rgba(34,197,94,0.10); color: #16a34a; }
.cfg-log-badge--update { background: rgba(234,179,8,0.10); color: #ca8a04; }
.cfg-log-badge--delete { background: rgba(239,68,68,0.10); color: #dc2626; }
.cfg-log-row:hover { background: rgba(17,24,39,0.018); cursor: pointer; }

/* Audit log — modal diff */
.cfg-log-modal-meta { margin-bottom: var(--space-3); }
.cfg-log-diff-wrap { overflow-x: auto; }
.cfg-log-diff-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cfg-log-diff-table thead th { text-align: left; padding: 6px 10px; font-weight: var(--weight-medium); color: var(--home-text-muted); border-bottom: 1px solid var(--home-line-faint); }
.cfg-log-diff-table tbody td { padding: 6px 10px; border-bottom: 1px solid var(--home-line-faint); vertical-align: top; }
.cfg-log-diff-key { font-weight: var(--weight-medium); color: var(--home-text); white-space: nowrap; }
.cfg-log-diff-old { color: #dc2626; text-decoration: line-through; opacity: 0.7; }
.cfg-log-diff-new { color: #16a34a; }
.cfg-log-diff-changed { background: rgba(234,179,8,0.04); }

/* Dados / Exportar */
.cfg-export-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  gap: var(--space-4);
}
.cfg-export-row-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Minha conta */
.cfg-conta-two-col {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
}
.cfg-conta-col-left {
  padding-top: 4px;
}
.cfg-conta-col-divider {
  width: 1px;
  background: var(--home-line-soft);
  margin: 16px 0;
}
.cfg-conta-col-right {
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}
.cfg-conta-col-right .cfg-wa-card-header {
  padding-top: 12px;
}
.cfg-conta-col-right .field {
  padding: 0 16px;
}
.cfg-conta-col-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px 16px;
  margin-top: auto;
}
.cfg-conta-avatar-block {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 20px 16px 16px;
}
.cfg-conta-avatar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cfg-conta-avatar {
  width: 56px; height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius-pill);
  background: var(--navy-light);
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--size-lg); font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
}
.cfg-conta-pessoal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-3);
  padding: 0 16px;
}
.cfg-report-toggle-inline {
  align-self: end;
  min-height: 44px;
  justify-content: space-between;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

@media (max-width: 980px) {
  .cfg-med-head {
    align-items: stretch;
  }

  .cfg-med-search-wrap {
    max-width: none;
    width: 100%;
  }

  .cfg-access-head {
    align-items: stretch;
  }

  .cfg-access-search-wrap {
    max-width: none;
    width: 100%;
  }

}

@media (max-width: 768px) {
  .cfg-wrap {
    padding-bottom: 24px;
  }

  .cfg-med-table thead th,
  .cfg-med-table td {
    padding-left: 18px;
    padding-right: 18px;
  }

  .cfg-table-shell .ws-table {
    min-width: 720px;
  }

  .cfg-med-drawer {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .cfg-pane-card {
    padding: var(--space-4);
  }

  .cfg-conta-head {
    align-items: flex-start;
  }
}

/* ============================================================
   Pessoal
   ============================================================ */
.pes-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 1160px;
}

.pes-detail-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 1160px;
}

.pes-card {
  background: var(--bg-card);
  border: 1px solid rgba(52,44,36,0.05);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.pes-global-hint-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: var(--space-3) 0 var(--space-1);
}

.pes-global-hint-divider {
  width: 100%;
  border: none;
  border-top: 1px solid rgba(112,115,147,0.12);
  margin: 0;
}

.pes-global-hint {
  font-size: 11px;
  color: var(--text-muted);
  padding: 7px 0;
  text-align: center;
  letter-spacing: 0.01em;
}

.pes-section-eyebrow {
  display: inline-block;
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.pes-section-title,
.pes-detail-name {
  font-size: var(--size-xl);
  font-weight: var(--weight-semibold);
  color: var(--text);
  letter-spacing: -0.02em;
}

.pes-section-desc,
.pes-detail-sub {
  color: var(--text-muted);
  font-size: var(--size-xs);
}

.pes-config-label {
  font-size: 12px;
  font-weight: var(--weight-medium);
  letter-spacing: -0.01em;
  color: var(--text-muted);
}

.pes-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  font-size: var(--size-sm);
  color: var(--text-muted);
  cursor: pointer;
}

.pes-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
}

.pes-medico-cell { max-width: 220px; }

.pes-medico-main {
  font-weight: var(--weight-medium);
}

.pes-medico-sub,
.pes-history-meta,
.pes-config-global,
.pes-config-missing {
  font-size: var(--size-xs);
  color: var(--text-muted);
}

.pes-status-badge { border-color: transparent; }
.pes-status-badge--em_dia          { background: var(--s-paga-bg);      color: var(--s-paga); }
.pes-status-badge--atrasado        { background: var(--s-cancelada-bg); color: var(--s-cancelada); }
.pes-status-badge--vencem_em_breve { background: var(--s-pendente-bg);  color: var(--s-pendente); }
.pes-status-badge--sem_config,
.pes-status-badge--inativo         { background: rgba(0,0,0,0.06);      color: var(--text-muted); }

.pes-empty {
  padding: var(--space-9);
  margin-top: var(--space-6);
}

/* ── Breadcrumb de volta ── */
.pes-detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pes-breadcrumb-label {
  font-size: var(--size-sm);
  color: var(--text-muted);
}

/* ── Header card ── */
.pes-detail-header-card {
  padding: var(--space-5);
}

.pes-detail-header-main {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.pes-detail-header-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
}

.pes-detail-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.pes-detail-name {
  font-size: 18px;
  font-weight: var(--weight-semibold);
  color: var(--text);
  letter-spacing: -0.02em;
  margin: 0;
}

.pes-detail-sub {
  color: var(--text-muted);
  font-size: var(--size-xs);
}

/* ── Section head ── */
.pes-section-head,
.pes-inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.pes-section-title {
  font-size: var(--size-base);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  margin: 0;
}

/* ── Config strip (modo visualização) ── */
.pes-config-effective-strip {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

.pes-config-effective-valor {
  font-size: var(--size-xl);
  font-weight: var(--weight-semibold);
  color: var(--text);
  letter-spacing: -0.03em;
}

.pes-config-effective-dot {
  color: var(--text-muted);
  opacity: 0.4;
}

.pes-config-effective-meta {
  font-size: var(--size-sm);
  color: var(--text-muted);
}

.pes-config-overrides {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.pes-config-override-chip {
  font-size: var(--size-xs);
  background: var(--navy-light);
  color: var(--navy);
  border-radius: var(--radius-pill);
  padding: 2px var(--space-2);
}

/* ── Config editor ── */
.pes-config-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.pes-config-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.pes-config-label {
  font-size: var(--size-xs);
  font-weight: var(--weight-medium);
  letter-spacing: -0.01em;
  color: var(--text-muted);
}

.pes-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid rgba(52,44,36,0.05);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.78);
  color: var(--text);
  font-size: var(--size-sm);
}

.pes-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
}

/* ── Histórico de mensalidades ── */
.pes-history-section {
  margin-top: var(--space-5);
}

.pes-history-shell {
  margin-top: var(--space-2);
}

.pes-history-competencia {
  font-weight: var(--weight-medium);
  color: var(--text);
}

.pes-history-meta {
  font-size: var(--size-xs);
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.pes-history-tr td {
  vertical-align: middle;
}

.pes-status-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.pes-status-cell .pes-history-meta {
  display: inline;
}

/* ── Draft row (nova mensalidade) ── */
.pes-history-draft-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid rgba(82,102,235,0.14);
  border-radius: var(--radius-md);
  background: rgba(82,102,235,0.03);
  margin-bottom: var(--space-2);
}

.pes-history-draft-fields {
  display: flex;
  gap: var(--space-3);
  flex: 1;
  flex-wrap: wrap;
}

.pes-draft-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 100px;
}

.pes-draft-label {
  font-size: var(--size-xs);
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}

.pes-draft-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  padding-bottom: 2px;
}

.pes-draft-save {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.pes-draft-save:hover {
  background: var(--navy-dark, #131f42);
  border-color: var(--navy-dark, #131f42);
}

/* ── Inputs inline na tabela ── */
.pes-row-input,
.pes-row-select {
  width: 100%;
}

.pes-competencia-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

/* ── Modal sem título (só X no header) ── */
.modal-body--no-header-title ~ * { display: none; }
.modal:has(.modal-body--no-header-title) .modal-title { display: none; }
.modal:has(.modal-body--no-header-title) .modal-header {
  padding-bottom: 0;
  justify-content: flex-end;
}
.modal:has(.modal-body--no-header-title) .modal-body {
  padding-top: var(--space-3);
}

/* ── Config drawer — toggle row e botão discreto ── */
.pes-cfg-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pes-cfg-hero-row {
  padding-bottom: 4px;
}

.pes-cfg-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  margin-inline: -20px;
  margin-bottom: -30px;
  border-top: 1px solid var(--border-soft);
}
.pes-cfg-save-btn {
  border-radius: 999px;
  height: 32px;
  padding: 0 18px;
  font-size: var(--size-sm);
}

.pes-cfg-status-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--size-sm);
  color: var(--s-cancelada);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 150ms;
}
.pes-cfg-status-btn:hover {
  opacity: 1;
}

/* ── Modal de configuração do cliente pessoal ── */
.pes-cfg-modal .pac-detail-value-row {
  gap: var(--space-4);
}

.pes-cfg-modal .pac-detail-value-row input {
  width: 120px;
  text-align: right;
  border: 1px solid rgba(112,115,147,0.18);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-size: var(--size-sm);
  background: #fff;
}

.pes-cfg-modal .pac-detail-value-row input::placeholder {
  color: var(--text-muted);
}

.pes-cfg-switch {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.pes-cfg-switch-label {
  font-size: var(--size-sm);
  color: var(--text-muted);
}

.pes-cfg-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(112,115,147,0.10);
}

/* ── Responsive ── */
@media (max-width: 980px) {
  .pes-global-grid,
  .pes-kpis,
  .pes-config-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .pes-section-head {
    align-items: flex-start;
  }

  .pes-global-grid,
  .pes-kpis,
  .pes-config-grid {
    grid-template-columns: 1fr;
  }

  .pes-history-draft-fields {
    flex-direction: column;
  }

  .pes-history-shell {
    overflow-x: auto;
  }
}

/* ============================================================
   Ficha do Paciente
   ============================================================ */
.ficha-wrap {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 1240px;
}


.ficha-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Identidade (topo da coluna esquerda) */
.fp-identity {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fp-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--navy-light);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--size-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.fp-identity-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fp-aviso-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: rgba(236,72,153,0.12);
  color: #be185d;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition: background 150ms;
}
.fp-aviso-badge:hover {
  background: rgba(236,72,153,0.22);
}

.fp-aviso-tooltip {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 6px);
  background: #1f1f1f;
  color: #fff;
  font-size: var(--size-xs);
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms;
  z-index: 200;
}
.fp-aviso-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1f1f1f;
}
.fp-aviso-badge {
  position: relative;
}
.fp-aviso-badge.fp-aviso-open .fp-aviso-tooltip {
  opacity: 1;
}

.fp-nome {
  font-size: 18px;
  font-weight: var(--weight-semibold);
  color: var(--text-ink);
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.fp-medico-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.fp-status-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fp-pend {
  margin-top: 2px;
}



.fp-proxima {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(27,43,75,0.04);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}
.fp-proxima svg { flex-shrink: 0; color: var(--text-muted); }
.fp-proxima strong { font-weight: var(--weight-semibold); color: var(--text); }
.fp-proxima-vencido { background: rgba(245,158,11,0.08); color: #9a6c2d; }
.fp-proxima-vencido svg { color: #9a6c2d; }
.fp-retorno-vencido { font-size: 11px; font-weight: var(--weight-medium); color: var(--s-falta); }


.ficha-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  font-size: 12px;
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  transition: background 120ms, color 120ms;
}
.ficha-back-btn:hover {
  background: rgba(27,43,75,0.04);
  color: var(--text);
}

/* Topbar da ficha (breadcrumb + título + ação) */
.ficha-topbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* Header operacional da ficha */
.ficha-header-surface {
  background: linear-gradient(180deg, var(--home-surface-strong) 0%, var(--home-surface) 100%);
  border: 1px solid var(--home-line-soft);
  border-radius: 16px;
  box-shadow: var(--home-shadow-card);
  padding: var(--space-4) var(--space-5);
}


.ficha-header-main {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.fp-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.fp-proxima-wrap {
  margin-left: auto;
  flex-shrink: 0;
  border-top: none;
  padding-top: 0;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ficha-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.ficha-header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.ficha-header-icon-btn:hover {
  background: rgba(27,43,75,0.04);
  color: var(--text);
}

/* Timeline da ficha */
.ficha-timeline-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.ficha-timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.ficha-timeline-filters {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.ficha-timeline-filter {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  font-size: var(--size-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
  font-family: var(--font);
}
.ficha-timeline-filter:hover { background: rgba(27,43,75,0.03); color: var(--text); }
.ficha-timeline-filter--active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.ficha-timeline-filter--active:hover { background: var(--navy); color: #fff; }

.ficha-timeline-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-8) 0;
  color: var(--text-muted);
}
.ficha-timeline-empty-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(27,43,75,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.ficha-timeline-empty-copy {
  font-size: var(--size-sm);
  color: var(--text-muted);
}

.ficha-timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.ficha-timeline-group-header {
  font-size: var(--size-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-3);
}

.ficha-timeline-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ficha-timeline-entry {
  padding: var(--space-4) var(--space-5);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--home-surface-strong) 0%, var(--home-surface) 100%);
  border: 1px solid var(--home-line-soft);
  box-shadow: var(--home-shadow-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ficha-timeline-entry-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.ficha-timeline-entry-actions-hover {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity 120ms;
}
.ficha-timeline-entry:hover .ficha-timeline-entry-actions-hover { opacity: 1; }

.ficha-timeline-del {
  background: none;
  border: none;
  padding: 3px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color 120ms, background 120ms;
}
.ficha-timeline-del:hover { color: #DC2626; background: rgba(220,38,38,0.07); }

.ficha-timeline-action-btn {
  background: none;
  border: none;
  padding: 3px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color 120ms, background 120ms;
}
.ficha-timeline-action-btn:hover { color: var(--navy); background: rgba(27,43,75,0.06); }

.ficha-timeline-time {
  font-size: var(--size-sm);
  color: var(--text-muted);
  white-space: nowrap;
}

.ficha-timeline-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  border: none;
  padding: 0;
  font-family: inherit;
}

.ficha-timeline-kind--btn {
  cursor: pointer;
  transition: opacity 120ms;
}
.ficha-timeline-kind--btn:hover { opacity: 0.75; }

.ficha-timeline-summary {
  font-size: var(--size-base);
  font-weight: var(--weight-medium);
  color: var(--text);
}

.ficha-timeline-note {
  font-size: var(--size-sm);
  color: var(--text-muted);
  white-space: pre-wrap;
}

.ficha-timeline-entry-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.ficha-timeline-link {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--size-xs);
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ficha-timeline-link:hover { color: var(--navy); }

.ficha-timeline-editor {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}
.ficha-timeline-editor.hidden { display: none; }

.ficha-timeline-textarea {
  width: 100%;
  resize: vertical;
  font-family: var(--font);
  font-size: var(--size-sm);
}

.ficha-timeline-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.ficha-timeline-shortcut {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--size-sm);
  color: var(--text-muted);
  cursor: pointer;
}
.ficha-timeline-shortcut input { margin-top: 2px; flex-shrink: 0; }

.ficha-header-loading {
  padding: 0;
  color: var(--text-cool);
  font-size: var(--size-sm);
}


.ficha-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.ficha-meta-dot {
  color: var(--text-xmuted);
  font-size: 11px;
}

.ficha-pend-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.pend-chip {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 3px;
}

.pend-chip svg { flex-shrink: 0; }

.pend-cell-icon {
  width: 32px;
  padding: 0 4px 0 0 !important;
  vertical-align: middle !important;
  text-align: center;
}
.pend-cell-paciente-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pend-open-ficha {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  font-weight: var(--weight-medium);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pend-open-ficha:hover { color: var(--navy); text-decoration: underline; }
.pend-cell-inline-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}


/* Tabs bar */
.ficha-tabs-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 2px;
  border-bottom: 1px solid rgba(27,43,75,0.08);
  background: var(--bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  margin-bottom: 20px;
  position: relative;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 0 var(--space-4);
  padding-top: var(--space-2);
}

/* ============================================================
   Tabs de linha com underline — padrão do sistema
   Usar .tabs + .tab + .tab-active em qualquer view
   ============================================================ */
.tabs {
  display: flex;
  gap: 28px;
  background: transparent;
  padding: 0;
}

.tab {
  padding: 10px 0;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: var(--weight-medium);
  color: var(--text-cool);
  cursor: pointer;
  font-family: var(--font);
  transition: color 150ms;
  white-space: nowrap;
  border-radius: 0;
  position: relative;
}

.tab:hover {
  color: var(--text-ink);
  background: transparent;
}

.tab-active {
  color: var(--text-ink);
  font-weight: var(--weight-semibold);
  background: transparent;
  box-shadow: none;
}

.tab-active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(123,108,168,0.40);
  border-radius: 2px 2px 0 0;
}

/* Aliases da ficha — mantidos para compatibilidade */
.ficha-tabs { display: flex; gap: 28px; background: transparent; padding: 0; }
.ficha-tab { padding: 10px 0; border: none; background: transparent; font-size: 14px; font-weight: var(--weight-medium); color: var(--text-cool); cursor: pointer; font-family: var(--font); transition: color 150ms; white-space: nowrap; border-radius: 0; position: relative; }
.ficha-tab:hover { color: var(--text-ink); background: transparent; }
.ficha-tab-active { color: var(--text-ink); font-weight: var(--weight-semibold); background: transparent; box-shadow: none; }
.ficha-tab-active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: rgba(123,108,168,0.40); border-radius: 2px 2px 0 0; }

#ficha-tab-action {
  padding-right: 0;
  display: flex;
  align-items: flex-end;
}

#ficha-tab-action.ficha-tab-action-has-cta {
  padding-bottom: 8px;
}


/* Tab content */
.ficha-tab-content {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  min-height: 0;
}

/* Tabela de consultas e cobranças */

.ficha-td-main {
  display: block;
  font-weight: var(--weight-medium);
  color: var(--text-ink);
}

.ficha-td-sub {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.ficha-td-valor-num { font-weight: var(--weight-semibold); }

.ficha-td-data { white-space: nowrap; }
.ficha-td-actions { white-space: nowrap; vertical-align: middle; }
.ficha-td-nf { white-space: nowrap; }

.ficha-actions-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.ficha-actions-wrap .row-action-btn svg { display: block; }

/* Badge de status clicável (cobranças) */
.ficha-cob-status {
  cursor: pointer;
  border: none;
  font-family: var(--font);
  font-size: 12px;
  font-weight: var(--weight-medium);
  padding: 0 8px;
  min-height: 24px;
  border-radius: var(--radius-pill);
}

.ficha-nf-link {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: none;
  border-radius: var(--radius-pill);
  background: rgba(124,107,200,0.08);
  color: #6f5ec0;
  font-size: 12px;
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.ficha-nf-link:hover {
  text-decoration: none;
  background: rgba(124,107,200,0.12);
  color: #6859b2;
}

/* Dropdown de mais opções */
.ficha-dropdown-wrap { position: relative; }
.ficha-dd-excluir { color: #c85e66; }
.ficha-dd-excluir:hover { background: rgba(209,106,106,0.08); }

/* Empty state da aba */
.ficha-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: var(--space-8) var(--space-6);
  color: var(--text-cool);
  font-size: 14px;
  background: rgba(255,255,255,0.58);
  border: 1px dashed rgba(123,108,168,0.16);
  border-radius: 18px;
}

/* Aba Cadastro */
.ficha-cadastro {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.ficha-form-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--space-5);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.ficha-cadastro .form-section-title {
  margin: 0 0 var(--space-4);
}

.ficha-cadastro textarea {
  min-height: 96px;
}

.ficha-servicos-table {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ficha-servico-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.ficha-servico-row:last-child { border-bottom: none; }

.ficha-servico-name {
  font-size: var(--size-sm);
  font-weight: var(--weight-semibold);
  color: var(--text);
}

.ficha-servico-default {
  margin-top: 4px;
  font-size: var(--size-xs);
  color: var(--text-muted);
}

.ficha-servico-field {
  min-width: 170px;
}

.ficha-cadastro-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  margin-top: var(--space-1);
}

/* WhatsApp button na ficha — sem cor especial */
.ficha-wa-btn { color: var(--text-muted); }


/* Status inline de agendamento */
.ficha-status-ag-btn {
  cursor: pointer;
  border: none;
  font-family: var(--font);
}
.ficha-status-ag-pop {
  left: 0;
  right: auto;
  min-width: 140px;
}
.action-pop-item-active {
  font-weight: var(--weight-semibold);
  color: var(--navy);
}

/* Responsive */
@media (max-width: 640px) {
  .ficha-wrap { gap: var(--space-4); }
  .ficha-tabs-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .ficha-tabs { width: 100%; overflow-x: auto; gap: 16px; }
  #ficha-tab-action { width: 100%; padding: 0; }
  #ficha-tab-action.ficha-tab-action-has-cta { padding-bottom: 0; }
  #ficha-tab-action .btn-primary { width: 100%; justify-content: center; }
  .ficha-servico-row { flex-direction: column; align-items: stretch; }
  .ficha-servico-field { min-width: 0; }
}

.btn-sm { height: 28px; padding: 0 var(--space-3); font-size: var(--size-xs); }

/* ============================================================
   Pacientes — grupos por médico (master-detail)
   ============================================================ */

/* Lista de pacientes (sem tabela) */
.pac-list {
  display: flex;
  flex-direction: column;
}
.pac-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--space-6);
  cursor: pointer;
  position: relative;
  transition: background 140ms ease;
  gap: var(--space-4);
  min-height: 72px;
}
.pac-row:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-6);
  right: var(--space-6);
  height: 1px;
  background: rgba(123,108,168,0.08);
}
.pac-row:hover { background: rgba(124,107,200,0.04); }
/* Layout 2 colunas — card único com divisor */
.pac-col-lista {
  display: flex;
  flex-direction: column;
  border-right: 0 solid var(--border);
  overflow: hidden;
  min-height: 0;
  height: 100%;
  transition: border-right-width 220ms ease;
}
.pac-col-lista .pac-medico-header {
  border-radius: 0;
  flex-shrink: 0;
}
.pac-col-lista .pac-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.pac-col-painel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.50));
  opacity: 0;
  transition: opacity 180ms ease 40ms;
}
.pac-painel-vazio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-10);
  flex: 1;
  color: var(--text-muted);
  font-size: var(--size-sm);
}
.pac-painel-loading {
  padding: var(--space-6);
  font-size: var(--size-sm);
  color: var(--text-cool);
}
.pac-painel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--space-5) 16px;
  border-bottom: 1px solid rgba(123,108,168,0.08);
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.90), rgba(255,255,255,0.82));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 5;
  flex-shrink: 0;
}
.pac-painel-nome {
  font-size: var(--size-base);
  font-weight: var(--weight-semibold);
  color: var(--text-ink);
  margin-bottom: 2px;
}
.pac-painel-link {
  font-size: var(--size-xs);
  color: var(--text-cool);
  text-decoration: none;
}
.pac-painel-link:hover { color: var(--text-ink); }
.pac-painel-body {
  padding: var(--space-3) var(--space-5) var(--space-5);
  overflow-y: auto;
}
.pac-painel-body-edicao {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  padding: var(--space-3) var(--space-5) var(--space-5);
}
.pac-painel-footer {
  padding: var(--space-3) var(--space-5) var(--space-4);
  border-top: 1px solid rgba(123,108,168,0.08);
  display: flex;
  justify-content: flex-end;
}
.pac-row-active {
  background: rgba(124,107,200,0.07) !important;
}
.pac-row-chevron {
  color: var(--text-xmuted);
  flex-shrink: 0;
  opacity: 0;
  transform: translateX(-2px);
  transition: opacity 140ms ease, transform 140ms ease;
}
.pac-row:hover .pac-row-chevron,
.pac-row-active .pac-row-chevron {
  opacity: 1;
  transform: translateX(0);
}

/* Modo leitura do painel */
.pac-leitura {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.pac-leitura-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--space-5);
}
.pac-leitura-col {
  display: flex;
  flex-direction: column;
}
.pac-leitura-linha {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: 14px 0;
  font-size: var(--size-base);
  color: var(--text-ink);
  border-bottom: 1px solid rgba(123,108,168,0.08);
}
.pac-leitura-linha:last-child { border-bottom: none; }
.pac-leitura-vazio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 14px 0;
  font-size: var(--size-base);
  color: var(--text-xmuted);
  border-bottom: 1px solid rgba(123,108,168,0.08);
}
.pac-leitura-vazio:last-child { border-bottom: none; }
.pac-ic {
  color: var(--text-xmuted);
  flex-shrink: 0;
  margin-top: 3px;
}
.pac-leitura-obs {
  font-size: var(--size-sm);
  color: var(--text-cool);
  padding: var(--space-4);
  border: 1px solid rgba(123,108,168,0.08);
  border-radius: 14px;
  background: rgba(255,255,255,0.56);
  white-space: pre-wrap;
}

/* Botão excluir na linha */
.pac-del-btn {
  opacity: 0;
  transform: translateX(-2px);
  transition: opacity 120ms ease, transform 120ms ease;
  color: var(--text-muted);
}
.pac-del-btn:hover { color: #DC2626; }
.pac-row:hover .pac-del-btn {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================================
   Pacientes — container único com médico (modo filtrado)
   ============================================================ */
.pac-filtro-card {
  padding: 0;
  overflow: hidden;
}
.pac-medico-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, rgba(255,255,255,0.90), rgba(255,255,255,0.82));
  border-bottom: 1px solid rgba(123,108,168,0.08);
  padding: var(--space-6) var(--space-6);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.pac-medico-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.pac-medico-header-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pac-medico-header-nome {
  font-size: var(--size-md);
  font-weight: var(--weight-semibold);
  color: var(--text-ink);
}
.pac-medico-header-sub {
  font-size: var(--size-sm);
  color: var(--text-cool);
}
.pac-medico-header-prefs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pac-status-badge {
  height: 20px;
  padding: 0 7px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: var(--weight-medium);
  letter-spacing: 0.01em;
  line-height: 1;
}

.pac-status-lead {
  background: var(--patient-status-lead-bg);
  border-color: var(--patient-status-lead-border);
  color: var(--patient-status-lead);
}

.pac-status-ativo {
  background: var(--patient-status-active-bg);
  border-color: var(--patient-status-active-border);
  color: var(--patient-status-active);
}

.pac-status-inativo {
  background: var(--patient-status-inactive-bg);
  border-color: var(--patient-status-inactive-border);
  color: var(--patient-status-inactive);
}

/* ── Agenda Pessoal (pag-*) ──────────────────────────────────────────────── */

/* Tab bar — Financeiro | Agenda | Tarefas */
.pes-tab-bar {
  padding: 12px 20px 2px;
  border-bottom: 1px solid rgba(27,43,75,0.08);
  margin-bottom: 0;
  flex-shrink: 0;
}
.pes-tab-bar .tabs {
  padding-bottom: 0;
}
.pes-tab-bar .tab-active::after {
  bottom: -3px;
}

.pes-tab-bar + #pes-tab-content .fin-wrap {
  padding-top: 18px;
}

/* Quando a aba Agenda está ativa, o #view vira flex column para que
   #pes-tab-content (flex:1) preencha toda a altura restante */
.view--pessoal-agenda {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}

/* ── Tarefas Pessoal (ptk-*) ─────────────────────────────────────────────── */
.ptk-wrap {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 0;
  padding: 22px 0 0;
}

/* ── Nav bar (tab bar) ─────────────────────────── */
.ptk-nav {
  border-radius: 14px;
  background: rgba(255,255,255,0.88);
  border: 1px solid rgba(113,123,155,0.14);
  padding: 0 16px;
}

.ptk-nav-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ptk-tabs-scroll {
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.ptk-tabs-scroll::-webkit-scrollbar { display: none; }

.ptk-tabs {
  width: max-content;
  gap: 24px;
}

.ptk-tab {
  font-size: 13.5px;
}

.ptk-tab-list {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ptk-tab-count {
  font-size: 10.5px;
  font-weight: var(--weight-medium);
  color: var(--text-xmuted);
  background: rgba(113,123,155,0.12);
  border-radius: 999px;
  padding: 1px 6px;
  line-height: 1.6;
  transition: background 150ms, color 150ms;
}

.tab-active .ptk-tab-count {
  background: rgba(123,108,168,0.15);
  color: rgba(123,108,168,0.9);
}

.ptk-tab-divider {
  width: 1px;
  height: 16px;
  background: rgba(113,123,155,0.2);
  flex-shrink: 0;
  align-self: center;
}

.ptk-nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding-left: 8px;
  border-left: 1px solid rgba(113,123,155,0.14);
}

.ptk-list-icon {
  width: 14px;
  height: 14px;
  color: var(--list-color, #6b7280);
  display: inline-flex;
  flex-shrink: 0;
}

.ptk-list-icon svg {
  width: 14px;
  height: 14px;
}


.ptk-main-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: var(--weight-semibold);
  color: var(--text);
}

.ptk-head-actions {
  display: flex;
  gap: 8px;
}

.ptk-link-btn {
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 12.5px;
  cursor: pointer;
  border-radius: 8px;
  padding: 6px 8px;
}

.ptk-link-btn:hover {
  background: rgba(107,118,146,0.12);
  color: var(--text);
}

.ptk-icon-btn {
  border: none;
  background: transparent;
  color: var(--text-soft);
  border-radius: 8px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ptk-icon-btn:hover {
  background: rgba(98,107,139,0.12);
  color: var(--text);
}

.ptk-icon-btn svg {
  width: 14px;
  height: 14px;
}

/* ── Sidebar estilo Lembretes ──────────────────────── */
.ptk-sidebar {
  width: 278px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 6px 18px 24px 4px;
  overflow-y: auto;
  border-right: 1px solid rgba(113,123,155,0.09);
  border-radius: 0;
  background: rgba(255,255,255,0.84);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.48);
  align-self: stretch;
}

.ptk-sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ptk-sidebar-group--smart {
  gap: 4px;
}

.ptk-sidebar-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px 0 12px;
}

.ptk-sidebar-group-icon {
  width: 24px;
  height: 24px;
  color: rgba(27,43,75,0.58);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ptk-sidebar-group-icon svg {
  width: 22px;
  height: 22px;
}

.ptk-sidebar-group-title {
  font-size: 15px;
  font-weight: 650;
  color: rgba(27,43,75,0.88);
  letter-spacing: -0.02em;
}

.ptk-sidebar-group-title--muted {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-transform: none;
  color: rgba(27,43,75,0.88);
}

.ptk-smart-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ptk-sidebar-item {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
}

/* Listas */
.ptk-lists-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ptk-lists-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.ptk-lists-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-xmuted);
}

.ptk-list-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Cada lista (div clicável) */
.ptk-list-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 12px;
  text-align: left;
  border-radius: 14px;
  transition: background 120ms, box-shadow 120ms, transform 120ms;
  position: relative;
  cursor: pointer;
  border: none;
  background: transparent;
  box-sizing: border-box;
}

.ptk-list-btn { cursor: grab; }
.ptk-list-btn:active { cursor: grabbing; }
.ptk-list-btn:hover { background: rgba(113,123,155,0.08); }
.ptk-list-btn--active {
  background: rgba(113,123,155,0.13);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.72),
    0 1px 0 rgba(191,201,216,0.12);
}

.ptk-list-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(69, 87, 110, 0.86);
  opacity: 1;
  border: 1px solid rgba(255,255,255,0.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}
.ptk-list-icon-wrap svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  color: var(--list-icon-color, #6b7280);
}

.ptk-list-name {
  font-size: 15px;
  color: rgba(27,43,75,0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Wrapper que mantém contador e "..." no mesmo slot fixo à direita */
.ptk-list-end {
  position: relative;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ptk-list-count {
  font-size: 13px;
  color: rgba(113,123,155,0.88);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 120ms;
  pointer-events: none;
}
.ptk-list-btn:hover .ptk-list-count { opacity: 0; }

/* Botão "..." de edição — ocupa o mesmo slot, aparece no hover */
.ptk-list-edit {
  border: none;
  background: transparent;
  color: var(--text-xmuted);
  cursor: pointer;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: opacity 120ms, background 120ms;
  position: absolute;
  inset: 0;
}
.ptk-list-btn:hover .ptk-list-edit { opacity: 1; }
.ptk-list-edit:hover { background: rgba(113,123,155,0.15); color: var(--text); }

/* Popover de menu da lista (Editar / Excluir) */
.ptk-list-pop {
  background: #fff;
  border: 1px solid rgba(113,123,155,0.18);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(27,43,75,0.13), 0 1px 4px rgba(27,43,75,0.07);
  padding: 4px;
  min-width: 148px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ptk-list-pop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 100ms;
}
.ptk-list-pop-item:hover { background: rgba(113,123,155,0.1); }
.ptk-list-pop-item--danger { color: #d03030; }
.ptk-list-pop-item--danger:hover { background: rgba(208,48,48,0.08); }

/* "Adicionar lista" fixo no rodapé da sidebar */
.ptk-lists-add-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: auto;
  padding: 12px 12px 2px;
  border: none;
  background: transparent;
  color: #7b93d6;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity 150ms;
}
.ptk-lists-add-footer:hover { opacity: 0.75; }
.ptk-lists-add-footer svg { flex-shrink: 0; }

/* ── Modal nova/editar lista ────────────────────────── */
.ptk-list-modal-body { overflow: visible; }

.ptk-list-modal-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 4px 0 8px;
  width: 100%;
}

.ptk-list-modal-preview {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms;
}
.ptk-list-modal-preview-icon { color: #fff; }
.ptk-list-modal-preview-icon svg {
  width: 26px;
  height: 26px;
  stroke-width: 1.8;
}

.ptk-list-modal-colors {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
}
.ptk-modal-color {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 120ms, transform 120ms;
}
.ptk-modal-color--active,
.ptk-modal-color:hover {
  border-color: rgba(0,0,0,0.25);
  transform: scale(1.15);
}

.ptk-list-modal-icons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.ptk-modal-icon-btn {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1.5px solid var(--border-light);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.ptk-modal-icon-btn svg { width: 15px; height: 15px; }
.ptk-modal-icon-btn--active,
.ptk-modal-icon-btn:hover {
  background: rgba(123,108,168,0.10);
  border-color: rgba(123,108,168,0.40);
  color: var(--text);
}

.ptk-list-modal-input {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--border-light);
  padding: 0 14px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 150ms;
  box-sizing: border-box;
}
.ptk-list-modal-input:focus { border-color: rgba(123,108,168,0.50); }

.ptk-list-modal-delete {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--error, #dc2626);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  font-family: var(--font);
}
.ptk-list-modal-delete:hover { opacity: 0.75; }

/* ── Main card ─────────────────────────────────────── */
.ptk-main {
  flex: 1;
  min-width: 0;
  padding: 10px 18px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  min-height: 0;
  align-self: stretch;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ptk-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 18px 2px;
  border-bottom: 1px solid rgba(113,123,155,0.10);
  margin-bottom: 12px;
}

.ptk-main-title {
  margin: 0;
  font-size: 22px;
  font-weight: 730;
  color: var(--text);
  letter-spacing: -0.45px;
}

.ptk-main-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ptk-head-btn {
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 13.5px;
  cursor: pointer;
  border-radius: 999px;
  padding: 8px 12px;
  transition: background 120ms, color 120ms;
}

.ptk-head-btn:hover {
  background: rgba(107,118,146,0.08);
  color: var(--text);
}

.ptk-head-btn--primary {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(27,43,75,0.08);
  color: var(--text);
  font-weight: 600;
}

.ptk-head-btn--primary:hover {
  background: rgba(27,43,75,0.12);
}

/* ── Nova tarefa inline ─────────────────────────────── */
.ptk-task-row--add {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 12px 6px;
}
.ptk-task-add-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  font-size: 15px;
  color: var(--text);
  outline: none !important;
  box-shadow: none !important;
  height: auto !important;
  padding: 0 !important;
  width: auto !important;
  font-family: var(--font);
}
.ptk-task-add-input::placeholder { color: var(--text-xmuted); }

/* ── Content / Task list ────────────────────────────── */
.ptk-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Seção */
.ptk-section {
  display: flex;
  flex-direction: column;
  background: transparent;
}
.ptk-section + .ptk-section {
  border-top: 1.5px solid rgba(113,123,155,0.18);
  margin-top: 6px;
}


.ptk-task-list {
  display: flex;
  flex-direction: column;
}

/* Task item */
.ptk-task {
  border-bottom: 1px solid rgba(113,123,155,0.08);
  border-radius: 12px;
  transition: background 140ms, box-shadow 140ms, border-color 140ms;
}

.ptk-task:last-child {
  border-bottom: none;
}

.ptk-task--done {
  opacity: 0.55;
}

.ptk-task.is-drop {
  background: rgba(43,101,255,0.04);
}

.ptk-task:hover {
  background: rgba(247,247,249,0.72);
}

.ptk-task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 12px 6px;
  min-height: 50px;
}

.ptk-task-body {
  flex: 1;
  min-width: 0;
}

.ptk-task-title {
  font-size: 15px;
  color: var(--text);
  line-height: 1.35;
}

.ptk-task-title--done {
  color: var(--text-xmuted);
  text-decoration: line-through;
}

.ptk-task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.ptk-meta-item {
  font-size: 11px;
  color: var(--text-xmuted);
}

.ptk-meta-flag {
  color: #f59e0b;
  display: flex;
  align-items: center;
}

.ptk-meta-overdue {
  color: #ef4444;
}

/* Checkbox circular */
.ptk-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(113,123,155,0.35);
  background: rgba(255,255,255,0.96);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms, border-color 150ms;
  color: transparent;
}

.ptk-check:hover {
  border-color: rgba(113,123,155,0.6);
}

.ptk-check--done {
  background: #059669;
  border-color: #059669;
  color: #fff;
}

.ptk-check--done svg {
  width: 11px;
  height: 11px;
}

.ptk-check--sm {
  width: 16px;
  height: 16px;
}

.ptk-check--sm svg {
  width: 9px;
  height: 9px;
}

/* Botões de ação inline (aparecem no hover) */
.ptk-task-actions-inline {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 120ms;
}

.ptk-task:hover .ptk-task-actions-inline {
  opacity: 1;
}

.ptk-action-btn {
  border: none;
  background: transparent;
  color: var(--text-xmuted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  transition: background 120ms, color 120ms;
}

.ptk-action-btn:hover {
  background: rgba(113,123,155,0.10);
  color: var(--text-soft);
}

.ptk-action-btn--flagged {
  color: #f59e0b;
}

.ptk-action-btn--delete:hover {
  background: rgba(239,68,68,0.08);
  color: #ef4444;
}

/* ── Subtarefas ──────────────────────────────────────── */
.ptk-subtask-list {
  padding: 0 8px 8px 34px;
  display: flex;
  flex-direction: column;
}

.ptk-task--child {
  border-bottom: none;
  border-radius: 8px;
}

.ptk-task--child .ptk-task-row {
  padding: 7px 6px 7px 4px;
  min-height: 36px;
}

.ptk-task--child .ptk-check {
  width: 15px;
  height: 15px;
  min-width: 15px;
  border-radius: 50%;
}

.ptk-task--child .ptk-task-title {
  font-size: 13.5px;
}

/* Botão + subtarefa — oculto, aparece no hover da tarefa pai */
.ptk-action-btn--add-child {
  opacity: 0;
  transition: opacity 120ms, background 120ms, color 120ms;
}
.ptk-task:hover .ptk-action-btn--add-child {
  opacity: 1;
}

/* Contador filhos na meta */
.ptk-meta-children {
  font-size: 11px;
  color: var(--text-xmuted);
  font-variant-numeric: tabular-nums;
}

/* Row de adição de subtarefa */
.ptk-task-row--add-child {
  padding: 6px 6px 6px 4px;
}
.ptk-task-row--add-child .ptk-check {
  width: 15px;
  height: 15px;
  min-width: 15px;
  border-radius: 50%;
  pointer-events: none;
}
.ptk-task-row--add-child .ptk-task-add-input {
  font-size: 13.5px;
}

.ptk-section-empty {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-xmuted);
  font-size: 12px;
  padding: 14px 4px;
}

.ptk-empty,
.ptk-empty--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-10);
  color: var(--text-muted);
  font-size: var(--size-base);
  text-align: center;
}

/* ── Seções colapsáveis ──────────────────────────────── */
.ptk-section-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 8px 6px 2px;
}
.ptk-section-head:hover .ptk-section-menu-btn { opacity: 1; }

.ptk-section-chevron-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--text-xmuted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ptk-section-chevron {
  transition: transform 160ms;
}
.ptk-section--collapsed .ptk-section-chevron { transform: rotate(-90deg); }

.ptk-section-name-input {
  flex: 1;
  background: transparent;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  height: auto;
  width: auto;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  cursor: text;
  padding: 2px 0 !important;
  min-width: 0;
}
.ptk-section-name-input:focus,
.ptk-section-name-input:focus-visible {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent;
}
.ptk-section-name-input--ghost {
  color: var(--text-xmuted);
  font-weight: 500;
  letter-spacing: normal;
}
.ptk-section-name-input--ghost:focus,
.ptk-section-name-input--ghost:focus-visible {
  color: var(--text);
  font-weight: 650;
  letter-spacing: 0.02em;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.ptk-section-count {
  font-size: 11px;
  color: var(--text-xmuted);
  background: rgba(113,123,155,0.10);
  border-radius: 999px;
  padding: 1px 6px;
  flex-shrink: 0;
}

.ptk-section-menu-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-xmuted);
  width: 22px; height: 22px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 120ms, background 120ms;
  flex-shrink: 0;
  padding: 0;
}
.ptk-section-menu-btn:hover { background: rgba(113,123,155,0.10); opacity: 1 !important; }

.ptk-section--collapsed .ptk-task-list { display: none; }

/* Ghost row — nova tarefa fantasma no final de cada seção */
.ptk-ghost-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 6px;
  cursor: text;
}
.ptk-ghost-row:hover .ptk-ghost-label { color: var(--text-muted); }
.ptk-check--ghost {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px dashed rgba(113,123,155,0.25);
  flex-shrink: 0;
}
.ptk-ghost-label {
  font-size: 14px;
  color: var(--text-xmuted);
  transition: color 120ms;
  user-select: none;
}

/* ── Botão ⓘ de detalhes (hover na row) ─────────────── */
.ptk-task-info-btn {
  border: none;
  background: transparent;
  color: var(--text-xmuted);
  cursor: pointer;
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 120ms, color 120ms, background 120ms;
  flex-shrink: 0;
  padding: 0;
  font-size: 14px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
}
.ptk-task:hover .ptk-task-info-btn { opacity: 1; }
.ptk-task-info-btn:hover { background: rgba(113,123,155,0.10); color: var(--text-soft); }

/* ── Inline edit do título ───────────────────────────── */
.ptk-task-title-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  font-size: 15px;
  color: var(--text);
  outline: none !important;
  box-shadow: none !important;
  height: auto !important;
  padding: 0 !important;
  width: auto !important;
  font-family: var(--font);
  min-width: 0;
}

/* ── Drag & drop ────────────────────────────────────── */
.ptk-drop-indicator {
  height: 2px;
  background: var(--accent, #3b82f6);
  border-radius: 2px;
  margin: 1px 0;
  pointer-events: none;
}

.ptk-drop-list-target {
  background: rgba(59,130,246,0.10) !important;
  border-radius: 6px;
  outline: 1.5px solid rgba(59,130,246,0.35);
  outline-offset: -1px;
}

/* ── Busca ──────────────────────────────────────────── */
.ptk-search-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
  max-width: 28px;
  transition: max-width 250ms cubic-bezier(0.4,0,0.2,1);
}
.ptk-search-wrap--open {
  max-width: 220px;
}
.ptk-search-input {
  flex: 1;
  min-width: 0;
  width: 160px;
  border: none !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  font-size: 13.5px;
  color: var(--text);
  font-family: var(--font);
  padding: 0 6px 0 2px !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}
.ptk-search-wrap--open .ptk-search-input {
  opacity: 1;
  pointer-events: auto;
}
.ptk-search-input::placeholder { color: var(--text-xmuted); }
.ptk-search-toggle {
  flex-shrink: 0;
}
.ptk-search-icon       { display: block; }
.ptk-search-close-icon { display: none;  }
.ptk-search-wrap--open .ptk-search-icon       { display: none;  }
.ptk-search-wrap--open .ptk-search-close-icon { display: block; }

/* ── Botões icon-only do header ─────────────────────── */
.ptk-head-icon-btn {
  border: none;
  background: transparent;
  color: var(--text-xmuted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms, color 120ms;
  flex-shrink: 0;
  padding: 0;
}
.ptk-head-icon-btn:hover { background: rgba(113,123,155,0.10); color: var(--text); }

/* ── Balão de detalhes da tarefa ─────────────────────── */
.ptk-detail-pop {
  position: fixed;
  z-index: 9500;
  isolation: isolate;
  width: 320px;
  background: rgba(248,248,252,0.68);
  backdrop-filter: blur(48px) saturate(180%);
  -webkit-backdrop-filter: blur(48px) saturate(180%);
  border: 0.5px solid rgba(255,255,255,0.75);
  border-radius: 20px;
  box-shadow:
    0 20px 48px rgba(0,0,0,0.12),
    0 4px 12px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.5);
  animation: ag-pop-in 180ms cubic-bezier(0.34,1.56,0.64,1);
}
.ptk-detail-pop-arrow {
  position: absolute;
  width: 12px; height: 12px;
  background: rgba(248,248,252,0.9);
  border: 0.5px solid rgba(255,255,255,0.75);
  transform: rotate(45deg);
  z-index: -1;
}
.ptk-detail-pop-arrow--left  { left: -6px;  border-right: none;  border-top: none; }
.ptk-detail-pop-arrow--right { right: -6px; border-left: none;   border-bottom: none; }
.ptk-detail-pop-arrow--top   { top: -6px;   border-bottom: none; border-right: none; }
.ptk-detail-pop-inner {
  padding: 14px 14px 10px;
  display: flex; flex-direction: column; gap: 0;
}
.ptk-detail-pop-header {
  display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 10px;
  padding-left: 6px;
}
.ptk-detail-pop-close {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border: none; background: rgba(0,0,0,0.08);
  border-radius: 50%; cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  padding: 0; transition: background 0.15s; margin-left: auto;
}
.ptk-detail-pop-close:hover  { background: rgba(0,0,0,0.13); }
.ptk-detail-pop-close:active { background: rgba(0,0,0,0.18); transform: scale(0.93); }
.ptk-detail-pop-title {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 600;
  letter-spacing: -0.24px;
  padding: 0 !important; background: transparent !important;
  border: none !important; box-shadow: none !important; outline: none !important;
  -webkit-appearance: none; color: var(--text); width: 100% !important;
  font-family: var(--font);
}
.ptk-detail-pop-title::placeholder { color: var(--text-muted); font-weight: 400; }
.ptk-detail-pop-rows {
  display: flex; flex-direction: column; gap: 0;
  background: rgba(0,0,0,0.03);
  border: 0.5px solid rgba(0,0,0,0.07);
  border-radius: 12px; overflow: hidden; margin-bottom: 8px;
}
.ptk-detail-pop-desc {
  padding: 0 14px 10px 20px;
  margin-bottom: 8px;
}
.ptk-detail-pop-desc textarea {
  width: 100%; resize: none; font-size: 13px; color: var(--text);
  background: transparent !important; border: none !important;
  outline: none !important; box-shadow: none !important;
  appearance: none; -webkit-appearance: none;
  padding: 0 !important; overflow: hidden;
  line-height: 1.4; min-height: 20px;
  font-family: var(--font);
}
.ptk-detail-pop-desc textarea::placeholder { color: var(--text-xmuted); }
.ptk-dpop-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 14px; min-height: 44px;
  border-bottom: 0.5px solid rgba(0,0,0,0.07);
}
.ptk-dpop-row:last-child { border-bottom: none; }
.ptk-detail-pop-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 4px 2px;
  border-top: 0.5px solid rgba(0,0,0,0.07);
  margin-top: 4px;
}
.ptk-dpop-delete-btn {
  display: flex; align-items: center; gap: 5px;
  border: none; background: transparent;
  color: var(--text-xmuted); font-size: 12px;
  cursor: pointer; border-radius: 7px;
  padding: 5px 8px;
  transition: background 120ms, color 120ms;
}
.ptk-dpop-delete-btn:hover {
  background: rgba(239,68,68,0.08);
  color: #ef4444;
}
.ptk-dpop-lbl {
  font-size: 13px; color: var(--text-muted);
  font-weight: 400; flex-shrink: 0;
}
.ptk-dpop-val {
  font-size: 13px; color: var(--navy);
  font-weight: 400; background: none; border: none;
  padding: 0; cursor: pointer;
  text-align: right; white-space: nowrap;
  font-family: var(--font);
}
.ptk-dpop-val:active { opacity: 0.6; }
.ptk-dpop-select {
  font-size: 13px; color: var(--navy);
  background: none; border: none; outline: none;
  padding: 0 2px 0 0; cursor: pointer;
  text-align: right; direction: rtl;
  font-family: var(--font);
  margin-left: auto;
}
.ptk-dpop-date-wrap {
  width: 116px; height: 32px; flex-shrink: 0;
  overflow: hidden; border: none; border-radius: 8px;
  background: rgba(0,0,0,0.05);
}
.ptk-dpop-time-wrap {
  width: 76px; height: 32px; flex-shrink: 0;
  overflow: hidden; border: none; border-radius: 8px;
  background: rgba(0,0,0,0.05);
}
.ptk-dpop-field-date,
.ptk-dpop-field-time {
  width: 100% !important; font-size: 12px;
  padding: 0 4px; height: 44px !important; margin-top: -5px;
  box-sizing: border-box; border: none !important; border-radius: 0;
  background: transparent !important; box-shadow: none !important;
  color: var(--text); cursor: pointer; display: block; outline: none;
}
.ptk-dpop-field-date::-webkit-date-and-time-value,
.ptk-dpop-field-time::-webkit-date-and-time-value { text-align: center; }
.ptk-dpop-field-date::-webkit-datetime-edit,
.ptk-dpop-field-time::-webkit-datetime-edit {
  display: flex; align-items: center; justify-content: center; min-height: 32px;
}

#pes-tab-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* Shell e toolbar — espelha ag-wrap/ag-toolbar */
.pag-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 12px;
  padding-top: 16px;
}
.pag-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 0 20px;
}
.pag-nav { display: flex; align-items: center; gap: 4px; }
.pag-nav-pill {
  width: 28px; height: 28px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(214,220,229,0.92);
  background: rgba(255,255,255,0.82);
  color: var(--navy);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 140ms, border-color 140ms;
  flex-shrink: 0;
}
.pag-nav-pill:hover { background: rgba(246,248,252,0.88); border-color: rgba(204,211,222,0.96); }
.pag-hoje-btn {
  height: auto; padding: 0 6px;
  border: none; background: transparent;
  font-size: 13px; font-weight: var(--weight-medium);
  color: var(--text-muted); cursor: pointer;
  transition: color 140ms;
}
.pag-hoje-btn:hover { color: var(--text); }
.pag-periodo {
  font-size: clamp(1.35rem, 1.65vw, 1.85rem);
  font-weight: 620;
  color: var(--text);
  letter-spacing: -0.03em;
  white-space: nowrap;
  line-height: 1.05;
  margin: 0 6px 0 8px;
}
.pag-toolbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pag-toolbar-right .pag-cat-config-btn { margin-left: 8px; }
.pag-view-toggle {
  display: flex; gap: 2px; padding: 2px;
  background: rgba(248,249,252,0.96);
  border: 1px solid rgba(214,220,229,0.92);
  border-radius: 9px;
}
.pag-view-btn {
  min-height: 26px; padding: 2px 9px;
  border: none; background: transparent;
  border-radius: 7px;
  font-size: 12px; font-weight: var(--weight-medium);
  color: var(--text-muted); cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.pag-view-btn:hover { color: var(--text); }
.pag-view-btn-active {
  background: rgba(255,255,255,0.96); color: var(--text);
}
.pag-cat-config-btn, .pag-quick-add {
  width: 28px; height: 28px;
  border: 1px solid rgba(214,220,229,0.92);
  border-radius: 9px;
  color: var(--navy);
  background: rgba(255,255,255,0.82);
}
.pag-cat-config-btn:hover, .pag-quick-add:hover {
  background: rgba(246,248,252,0.88);
}

/* Calendar container — sangra as bordas laterais do padding do #view */
.pag-calendar-wrap {
  flex: 1; min-height: 0;
  overflow: hidden;
  width: calc(100% + 128px);
  margin-left: -64px;
  margin-right: -64px;
}
.pag-calendar {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ── Vista Dia — layout com painel de tarefas ── */
.pag-dia-layout {
  display: flex;
  gap: 0;
  height: 100%;
  min-height: 0;
}
.pag-dia-wrap {
  display: flex; flex-direction: column;
  height: 100%; min-height: 0;
  flex: 1 1 0;
  min-width: 0;
}
.pag-dia-grid { flex: 1; overflow-y: auto; overflow-x: hidden; }

/* Painel lateral de tarefas */
.pag-dia-tasks {
  width: 50%;
  flex-shrink: 0;
  border-left: 1px solid rgba(228,232,239,0.92);
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
}
.pag-dt-head {
  display: flex; align-items: center; gap: 8px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(228,232,239,0.7);
  flex-shrink: 0;
}
.pag-dt-label {
  font-size: 20px; font-weight: var(--weight-bold);
  color: var(--text-strong);
  flex: 1; letter-spacing: -0.02em;
}
.pag-dt-count {
  font-size: 11px; font-weight: var(--weight-semibold);
  background: rgba(27,43,75,0.08); color: var(--text-muted);
  border-radius: 8px; padding: 2px 7px;
}
.pag-dt-add-icon {
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: rgba(113,123,155,0.08);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 120ms, color 120ms;
}
.pag-dt-add-icon:hover { background: var(--navy-light); color: var(--navy); }
.pag-dt-list {
  flex: 1; overflow-y: auto;
  padding: 4px 0;
}
.pag-dia-tasks .ptk-task { padding-inline: 8px; }
.pag-dia-tasks .ptk-task-row { padding-left: 14px; }
.pag-dt-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-10);
  color: var(--text-muted);
  font-size: var(--size-base);
  text-align: center;
}
/* Itens — espelha hw-task do widget */
.pag-dt-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px;
  cursor: pointer;
  transition: background 100ms;
}
.pag-dt-item:hover { background: rgba(27,43,75,0.03); }
.pag-dt-item--done { opacity: 0.45; }
.pag-dt-item--done .pag-dt-title { text-decoration: line-through; }
.pag-dt-check {
  width: 20px; height: 20px; flex-shrink: 0;
  border-radius: 50%; border: 1.5px solid rgba(113,123,155,0.28);
  background: transparent; cursor: pointer; padding: 0;
  color: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 140ms, background 140ms, color 140ms;
}
.pag-dt-check:hover { border-color: #1A7A4A; color: #1A7A4A; }
.pag-dt-check--done { background: var(--navy); border-color: var(--navy); color: #fff; }
.pag-dt-title {
  flex: 1;
  font-size: 14px; line-height: 1.4;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pag-dt-meta {
  display: flex; align-items: center; gap: 5px; flex-shrink: 0;
}
.pag-dt-flag { color: #F59E0B; display: flex; align-items: center; }
.pag-dt-due { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.pag-dt-due--overdue { color: #E03131; }
.pag-dt-done-group { opacity: 0.6; }
.pag-dt-inline-input {
  width: 100%; box-sizing: border-box;
  font-size: 13px; font-family: var(--font);
  border: 1px solid rgba(180,185,195,0.9); border-radius: 8px;
  padding: 6px 10px; outline: none;
  background: #fff; margin-bottom: 4px;
}
.pag-dt-inline-input:focus { border-color: var(--navy); }
.pag-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  min-height: 74px;
  border-bottom: 1px solid rgba(228,232,239,0.92);
  position: relative;
}
.pag-time-label {
  font-size: 12px;
  color: rgba(107,114,128,0.92);
  padding: 10px 12px 0 0;
  display: flex; align-items: flex-start; justify-content: flex-end;
  border-right: 1px solid rgba(228,232,239,0.92);
  user-select: none;
  letter-spacing: -0.01em;
}
.pag-cell {
  position: relative;
  min-height: 74px;
  padding: 4px 5px;
  overflow: visible;
  cursor: pointer;
  transition: background 100ms;
}
.pag-cell:hover { background: transparent; }

/* ── Vista Semana ── */
.pag-semana-wrap {
  display: flex; flex-direction: column;
  height: 100%;
  min-width: 0;
}
.pag-header {
  display: grid;
  grid-template-columns: 72px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid rgba(228,232,239,0.92);
  background: transparent;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 2;
}
.pag-time-gutter {
  border-right: 1px solid rgba(228,232,239,0.92);
  background: transparent;
}
.pag-col-header {
  padding: 8px 8px 9px;
  text-align: center;
  border-right: 1px solid rgba(228,232,239,0.92);
}
.pag-col-header:last-child { border-right: none; }
.pag-col-hoje { background: rgba(246,248,252,0.78); }
.pag-dow {
  display: inline;
  font-size: 12px; color: var(--text-muted);
  letter-spacing: 0.01em; line-height: 1;
}
.pag-day-num {
  display: inline;
  font-size: 13px; font-weight: 560;
  color: var(--text);
}
.pag-day-hoje {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px;
  padding: 0 6px; border-radius: 999px;
  background: var(--navy); color: #fff;
  font-weight: 620; font-size: 12px;
}
.pag-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  position: relative; background: transparent;
}
.pag-body .pag-row {
  grid-template-columns: 72px repeat(7, minmax(0, 1fr));
}
.pag-body .pag-cell {
  border-right: 1px solid rgba(228,232,239,0.92);
}
.pag-body .pag-cell:last-child { border-right: none; }

/* ── Vista Mês ── */
.pag-mes-wrap { display: flex; flex-direction: column; height: 100%; }
.pag-mes-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid rgba(228,232,239,0.92);
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 2;
  background: transparent;
}
.pag-mes-dow {
  padding: 8px 4px;
  text-align: center; font-size: 11px;
  font-weight: 600; color: var(--text-muted);
  border-right: 1px solid rgba(228,232,239,0.92);
}
.pag-mes-dow:last-child { border-right: none; }
.pag-mes-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  flex: 1; overflow-y: auto;
}
.pag-mes-cell {
  min-height: 100px;
  border-right: 1px solid rgba(228,232,239,0.92);
  border-bottom: 1px solid rgba(228,232,239,0.92);
  padding: 4px;
  cursor: pointer;
  background: transparent;
  text-align: left;
  transition: background 100ms;
}
.pag-mes-cell:hover { background: rgba(27,43,75,0.03); }
.pag-mes-cell:nth-child(7n) { border-right: none; }
.pag-mes-cell-vazia { background: rgba(0,0,0,0.01); cursor: default; }
.pag-mes-hoje { background: rgba(246,248,252,0.78); }
.pag-mes-cell-head { display: flex; align-items: center; justify-content: flex-end; padding: 2px; }
.pag-mes-dia-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; border-radius: 50%;
  font-size: 12px; font-weight: 560;
  color: var(--text-muted);
}
.pag-mes-dia-hoje {
  background: var(--navy); color: #fff; font-weight: 620;
}
.pag-mes-cell-body { display: flex; flex-direction: column; gap: 2px; }
.pag-mes-mais { font-size: 11px; color: var(--text-muted); padding: 2px 4px; }

/* ── Chips dia/semana — espelha ag-event ── */
.pag-chip {
  position: absolute;
  left: 2px; right: 2px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  padding: 3px 6px;
  font-size: var(--size-xs);
  line-height: 1.3;
  text-align: left;
  overflow: hidden;
  display: flex; flex-direction: column;
  gap: 1px;
  min-height: 32px;
  z-index: 2;
  box-sizing: border-box;
  transition: filter 100ms;
}
.pag-chip:hover { filter: brightness(0.95); }
.pag-chip-titulo {
  font-weight: var(--weight-semibold);
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; justify-content: space-between; gap: 3px;
}
.pag-chip-cat { color: var(--text-muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pag-chip-rec { display: inline-flex; align-items: center; opacity: 0.7; flex-shrink: 0; }

/* Chips do mês — espelha ag-mes-chip */
.pag-mes-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 2px 5px 2px 0; border-radius: 5px;
  font-size: 11px; font-weight: var(--weight-medium);
  cursor: pointer; overflow: hidden; white-space: nowrap;
  min-height: 22px; background: transparent; color: var(--text);
}
.pag-mes-chip-bar { width: 3px; align-self: stretch; border-radius: 2px 0 0 2px; flex-shrink: 0; }
.pag-mes-chip-titulo { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; white-space: nowrap; }
.pag-mes-chip-hora { font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.pag-mes-chip:hover { background: rgba(27,43,75,0.04); }

/* Cores dos chips — paleta pastel exclusiva da Agenda Pessoal */
/* Dia/Semana: fundo pastel + borda esquerda */
.pag-ev-agendada   { background: var(--pag-cat1-bg); border-left: 3px solid var(--pag-cat1); color: var(--pag-cat1); }
.pag-ev-confirmada { background: var(--pag-cat2-bg); border-left: 3px solid var(--pag-cat2); color: var(--pag-cat2); }
.pag-ev-atendida   { background: var(--pag-cat3-bg); border-left: 3px solid var(--pag-cat3); color: var(--pag-cat3); }
.pag-ev-falta      { background: var(--pag-cat4-bg); border-left: 3px solid var(--pag-cat4); color: var(--pag-cat4); }
.pag-ev-cancelada  { background: var(--pag-cat5-bg); border-left: 3px solid var(--pag-cat5); color: var(--pag-cat5); }
/* Mês: fundo transparente, cor na bar */
.pag-mes-chip.pag-ev-agendada   { background: transparent; border-left: none; color: var(--text); }
.pag-mes-chip.pag-ev-confirmada { background: transparent; border-left: none; color: var(--text); }
.pag-mes-chip.pag-ev-atendida   { background: transparent; border-left: none; color: var(--text); }
.pag-mes-chip.pag-ev-falta      { background: transparent; border-left: none; color: var(--text); }
.pag-mes-chip.pag-ev-cancelada  { background: transparent; border-left: none; color: var(--text); }
.pag-mes-chip.pag-ev-agendada   .pag-mes-chip-bar { background: var(--pag-cat1); }
.pag-mes-chip.pag-ev-confirmada .pag-mes-chip-bar { background: var(--pag-cat2); }
.pag-mes-chip.pag-ev-atendida   .pag-mes-chip-bar { background: var(--pag-cat3); }
.pag-mes-chip.pag-ev-falta      .pag-mes-chip-bar { background: var(--pag-cat4); }
.pag-mes-chip.pag-ev-cancelada  .pag-mes-chip-bar { background: var(--pag-cat5); }

/* Estado selecionado — fundo sólido da categoria */
.pag-chip-selected.pag-ev-agendada   { background: var(--pag-cat1-sel) !important; color: #fff !important; border-left-color: transparent !important; filter: none; }
.pag-chip-selected.pag-ev-confirmada { background: var(--pag-cat2-sel) !important; color: #fff !important; border-left-color: transparent !important; filter: none; }
.pag-chip-selected.pag-ev-atendida   { background: var(--pag-cat3-sel) !important; color: #fff !important; border-left-color: transparent !important; filter: none; }
.pag-chip-selected.pag-ev-falta      { background: var(--pag-cat4-sel) !important; color: #fff !important; border-left-color: transparent !important; filter: none; }
.pag-chip-selected.pag-ev-cancelada  { background: var(--pag-cat5-sel) !important; color: #fff !important; border-left-color: transparent !important; filter: none; }
.pag-chip-selected .pag-chip-titulo,
.pag-chip-selected .pag-chip-cat     { color: #fff !important; }

/* Dot de legenda */
.pag-legend-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.pag-legend-dot.pag-ev-agendada   { background: var(--pag-cat1); }
.pag-legend-dot.pag-ev-confirmada { background: var(--pag-cat2); }
.pag-legend-dot.pag-ev-atendida   { background: var(--pag-cat3); }
.pag-legend-dot.pag-ev-falta      { background: var(--pag-cat4); }
.pag-legend-dot.pag-ev-cancelada  { background: var(--pag-cat5); }

/* Legenda */
.pag-legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding: 10px 20px;
  border-top: 1px solid rgba(228,232,239,0.92);
  font-size: 12px;
  flex-shrink: 0;
}
.pag-legend-item { display: flex; align-items: center; gap: 6px; }
.pag-legend-label { color: var(--text-muted); }

/* Linha de hora atual — espelha ag-now-line */
.pag-now-line {
  position: absolute;
  height: 2px;
  background: var(--pag-cat1);
  opacity: 0.7;
  pointer-events: none;
  z-index: 10;
  transition: top 1s linear;
}
.pag-now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pag-cat1);
  opacity: 1;
}

/* ── Balão de detalhes — espelha ag-detail-pop ── */
.pag-detail-pop {
  position: fixed;
  z-index: 9500;
  isolation: isolate;
  width: 400px;
  background: rgba(248,248,252,0.68);
  backdrop-filter: blur(48px) saturate(180%);
  -webkit-backdrop-filter: blur(48px) saturate(180%);
  border: 0.5px solid rgba(255,255,255,0.75);
  border-radius: 20px;
  box-shadow:
    0 20px 48px rgba(0,0,0,0.12),
    0 4px 12px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.5);
  animation: ag-pop-in 180ms cubic-bezier(0.34,1.56,0.64,1);
}
.pag-detail-pop-arrow {
  position: absolute;
  width: 12px; height: 12px;
  background: rgba(248,248,252,0.9);
  border: 0.5px solid rgba(255,255,255,0.75);
  transform: rotate(45deg);
  z-index: -1;
}
.pag-detail-pop-arrow--left  { left: -6px;  border-right: none;  border-top: none;    }
.pag-detail-pop-arrow--right { right: -6px; border-left: none;   border-bottom: none; }
.pag-detail-pop-arrow--top   { top: -6px;   border-bottom: none; border-right: none;  }
.pag-detail-pop-inner {
  padding: 14px 14px 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.pag-detail-pop-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.pag-detail-pop-close {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border: none; background: rgba(0,0,0,0.08);
  border-radius: 50%; cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  padding: 0; transition: background 0.15s; margin-left: auto;
}
.pag-detail-pop-close:hover  { background: rgba(0,0,0,0.13); }
.pag-detail-pop-close:active { background: rgba(0,0,0,0.18); transform: scale(0.93); }
.pag-detail-pop-meta {
  display: flex; flex-direction: column; gap: 0;
  background: rgba(0,0,0,0.03);
  border: 0.5px solid rgba(0,0,0,0.07);
  border-radius: 12px; overflow: hidden; margin-bottom: 8px;
}
.pag-dpop-datetime-row, .pag-dpop-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 14px; min-height: 44px;
  border-bottom: 0.5px solid rgba(0,0,0,0.07);
}
.pag-dpop-row { border-bottom: none; }
.pag-dpop-dt-lbl {
  font-size: 13px; color: var(--text-muted);
  font-weight: 400; width: 58px; flex-shrink: 0;
}
.pag-dpop-dt-group { display: flex; align-items: center; gap: 6px; }
.pag-detail-pop-rows {
  display: flex; flex-direction: column; gap: 0;
  background: rgba(0,0,0,0.03);
  border: 0.5px solid rgba(0,0,0,0.07);
  border-radius: 12px; overflow: hidden; margin-bottom: 8px;
}
.pag-detail-pop-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 14px; min-height: 44px;
  border-bottom: 0.5px solid rgba(0,0,0,0.07);
}
.pag-detail-pop-row:last-child { border-bottom: none; }
.pag-detail-pop-row--obs { align-items: center; min-height: 44px; height: auto; }
.pag-detail-pop-row--obs > .pag-dpop-field-obs { width: 100%; max-width: none; }
.pag-detail-pop-lbl {
  font-size: 13px; color: var(--text-muted);
  font-weight: 400; flex-shrink: 0;
}
.pag-detail-pop-row > .pag-dpop-value-btn,
.pag-detail-pop-row > .pag-dpop-field-obs { width: 178px; max-width: 178px; margin-left: auto; }
.pag-detail-pop-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 8px; border-top: 0.5px solid rgba(0,0,0,0.07);
}
.pag-detail-pop-footer-right { display: flex; align-items: center; gap: 4px; }

/* Campos do balão — espelha ag-dpop-field */
.pag-dpop-field { width: auto !important; }
.pag-dpop-field-title {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 600;
  letter-spacing: -0.24px;
  padding: 0 !important; background: transparent !important;
  border: none !important; box-shadow: none !important; outline: none !important;
  -webkit-appearance: none; color: var(--text); width: 100% !important;
}
.pag-dpop-field-title::placeholder { color: var(--text-muted); font-weight: 400; }
.pag-dpop-date-wrap {
  width: 120px; height: 32px; flex-shrink: 0;
  overflow: hidden; border: none; border-radius: 8px;
  background: rgba(0,0,0,0.05);
  display: flex; align-items: center;
}
.pag-dpop-time-wrap {
  width: 100px; height: 32px; flex-shrink: 0;
  overflow: visible; border: none; border-radius: 8px;
  background: rgba(0,0,0,0.05);
  display: flex; align-items: center;
}
.pag-dpop-field-date,
.pag-dpop-field-time {
  width: 100% !important; font-size: 12px;
  padding: 0 6px; height: 32px !important; margin-top: 0;
  box-sizing: border-box; border: none !important; border-radius: 0;
  background: transparent !important; box-shadow: none !important;
  color: var(--text); cursor: pointer; display: block; outline: none;
  line-height: 32px;
}
.pag-dpop-field-date::-webkit-date-and-time-value,
.pag-dpop-field-time::-webkit-date-and-time-value { text-align: center; }
.pag-dpop-field-date::-webkit-datetime-edit,
.pag-dpop-field-time::-webkit-datetime-edit {
  display: flex; align-items: center; justify-content: center; height: 32px; min-height: 0;
}
.pag-dpop-field-obs {
  flex: 1; min-width: 0; resize: none; font-size: 13px; color: var(--text);
  background: transparent !important; border: none !important;
  outline: none !important; box-shadow: none !important;
  appearance: none; -webkit-appearance: none;
  padding: 0 !important; overflow: hidden;
  transition: height 160ms ease; line-height: 1.4; height: 20px; min-height: 20px;
}
.pag-dpop-value-btn {
  font-size: 13px; color: var(--navy);
  font-weight: 400; background: none; border: none;
  padding: 0; cursor: pointer;
  text-align: right; white-space: nowrap;
}
.pag-dpop-value-btn:active { opacity: 0.6; }
.pag-dpop-cat-btn {
  display: flex; align-items: center; gap: 6px;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .pag-body .pag-row { grid-template-columns: 40px repeat(7, minmax(80px, 1fr)); }
  .pag-header { grid-template-columns: 40px repeat(7, minmax(80px, 1fr)); }
  .pag-calendar-wrap { overflow-x: auto; }
  .pes-tab-bar {
    margin: 12px 12px 0;
    padding: 22px 12px 8px;
  }
  .ptk-wrap {
    flex-direction: column;
    padding: 12px;
  }
  .ptk-sidebar {
    width: auto;
    align-self: auto;
  }
}

