/* =========================================
   Psico Help — Estilos Globais
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Paleta verde pastel suave */
  --primary:        #8DBFA0;  /* verde sage pastel */
  --primary-dark:   #6A9E82;  /* verde sage médio */
  --primary-light:  #E8F5EE;  /* verde quase branco */
  --primary-xlight: #F2FAF5;  /* verde ultra leve */

  --accent:         #B5D4C2;  /* verde mint claro */
  --accent-light:   #EAF5EF;  /* mint ultra leve */

  --rose:           #F0C4C4;
  --rose-light:     #FDF0F0;

  --mint:           #A8D4B8;  /* verde água */
  --mint-light:     #E5F5EC;

  --sand:           #E8DDD0;
  --sand-light:     #FAF7F4;

  --sky:            #B8D9C8;  /* verde azulado pastel */
  --sky-light:      #E8F5EE;

  /* Neutros levíssimos */
  --bg:          #F6FAF7;  /* fundo com leve toque verde */
  --surface:     #FFFFFF;
  --border:      #D8EAE0;
  --border-light:#EBF5EF;

  --text-primary:   #1E3328;
  --text-secondary: #4A6355;
  --text-muted:     #8AAA96;

  /* Feedback suave */
  --success: #6BA882;
  --warning: #D4A96A;
  --danger:  #D48A8A;
  --info:    #7AAEC8;

  /* Layout */
  --sidebar-w:  256px;
  --topbar-h:   60px;

  /* Shape */
  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  /* Shadow */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:  0 2px 8px rgba(0,0,0,.06);
  --shadow:     0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.10);

  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Inter', system-ui, sans-serif;
  --transition: all 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text-primary); line-height: 1.6; font-size: 15px; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Spin */
@keyframes spin { to { transform: rotate(360deg); } }
.fa-spin { animation: spin 1s linear infinite; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn .3s ease both; }

/* ===== LOADING ===== */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(255,255,255,.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; backdrop-filter: blur(4px);
}
.loading-spinner { text-align: center; }
.loading-spinner i { font-size: 2.2rem; color: var(--primary); }
.loading-spinner p { margin-top: .6rem; color: var(--text-secondary); font-size: .88rem; }

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-page {
  /* Tokens exatos do design system (só aplicados aqui, não afeta outras páginas) */
  --primary:        #22C55E;
  --primary-dark:   #16A34A;
  --primary-light:  #ECFDF3;
  --primary-xlight: #F5FBF7;

  --bg:           #FFFFFF;
  --surface:      #FFFFFF;
  --border:       #EEF2F5;
  --border-light: #F5F7FA;

  --text-primary:   #111827;
  --text-secondary: #6B7280;
  --text-muted:     #9CA3AF;

  --info:    #3B82F6;
  --warning: #F59E0B;
  --danger:  #EF4444;
  --success: #22C55E;

  --radius-sm: 12px;
  --radius:    18px;
  --radius-lg: 18px;

  --shadow-xs: 0 4px 24px rgba(0,0,0,.04);
  --shadow-sm: 0 4px 24px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 24px rgba(0,0,0,.04);
  --transition: all .2s ease;

  min-height: 100vh;
  background: #FFFFFF;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 1.5rem;
}

.login-container {
  width: 100%; max-width: 720px; position: relative; z-index: 1;
  margin: auto 0; /* centraliza verticalmente quando conteúdo é curto */
  padding: 1rem 0; /* espaço extra topo/base para conteúdos longos */
}
.login-brand {
  text-align: center; margin-bottom: 2rem;
}
.brand-name-login {
  font-size: 1.75rem; font-weight: 700; color: var(--text-primary); letter-spacing: -.02em;
}
.brand-name-login span { color: var(--primary-dark); }
.brand-tagline { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-top: .4rem; letter-spacing: .01em; }

/* Logo (imagem real, ícone + wordmark) */
.brand-logo { display: block; width: auto; align-self: flex-start; object-fit: contain; }
.brand-logo-sidebar { height: 26px; }
.brand-logo-login { height: 50px; margin: 0 auto; align-self: center; }

.login-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
  overflow: visible; /* permite que o conteúdo longo role com a página */
  max-width: 460px; margin: 0 auto;
  transition: box-shadow .2s ease;
}
.login-page .btn-primary:hover { box-shadow: 0 4px 14px rgba(34,197,94,.25); }
.login-page input:focus, .login-page select:focus, .login-page textarea:focus {
  box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}

.login-tabs {
  display: flex; background: var(--bg); border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1; padding: .85rem 1rem;
  background: none; color: var(--text-muted);
  font-size: .85rem; font-weight: 500;
  border-bottom: 2px solid transparent;
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  transition: var(--transition);
}
.tab-btn.active { color: var(--primary-dark); border-bottom-color: var(--primary-dark); background: var(--surface); }
.tab-btn:hover:not(.active) { color: var(--text-secondary); background: rgba(255,255,255,.6); }

.login-form { display: none; padding: 1.75rem; }
.login-form.active { display: block; }
.login-form h2 { font-family: var(--font-display); font-size: 28px; line-height: 1.25; font-weight: 700; color: var(--text-primary); letter-spacing: -.02em; }
.form-subtitle { color: var(--text-secondary); font-size: 15px; font-weight: 500; margin-top: .3rem; margin-bottom: 1.5rem; }

/* Efeito de dissolver entre a seleção e o formulário (mesma "tela") */
#login-step-selector, #login-step-form {
  transition: opacity .22s ease, transform .22s ease;
  opacity: 1; transform: translateY(0) scale(1);
}
#login-step-selector.login-fading-out, #login-step-form.login-fading-out {
  opacity: 0; transform: translateY(-6px) scale(.98);
}
#login-step-selector.login-fading-in, #login-step-form.login-fading-in {
  opacity: 0; transform: translateY(6px) scale(.98);
}

/* =========================================================
   PASSO 1 — SELEÇÃO DE ACESSO (Paciente / Profissional)
   ========================================================= */
.login-selector-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
  padding: 2.5rem 2.75rem 2.75rem;
  text-align: center;
  transition: box-shadow .2s ease;
}
.login-selector-card h2 { font-family: var(--font-display); font-size: 40px; line-height: 1.15; color: var(--text-primary); font-weight: 700; letter-spacing: -.02em; }
.login-selector-card .form-subtitle { margin-bottom: 2.5rem; font-size: 18px; font-weight: 500; color: var(--text-secondary); }

.login-selector-options {
  display: flex; align-items: stretch; justify-content: center; gap: 1.5rem;
}
.login-option {
  flex: 1; max-width: 260px;
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  background: none; border: none; cursor: pointer;
  padding: .5rem;
  border-radius: var(--radius);
  transition: var(--transition);
}
.login-option:hover { background: var(--primary-xlight); transform: translateY(-2px); }
.login-option-icon {
  width: 110px; height: 110px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--surface));
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem; color: var(--primary-dark);
  margin-bottom: .6rem;
  position: relative;
  transition: var(--transition);
}
/* Arco decorativo em volta do círculo */
.login-option-icon::before {
  content: '';
  position: absolute; inset: -2px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--primary);
  border-right-color: var(--primary);
  transform: rotate(-45deg);
}
.login-option:hover .login-option-icon { border-color: var(--primary); box-shadow: 0 8px 22px rgba(106,158,130,.25); }
.login-option-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.login-option-desc { font-size: 13px; font-weight: 500; color: var(--text-muted); line-height: 1.5; }

.login-selector-divider {
  display: flex; align-items: center; justify-content: center;
  position: relative; width: 1px; background: var(--border);
  flex-shrink: 0;
}
.login-selector-divider span {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 50%; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; color: var(--text-muted); font-weight: 600;
}

/* Botão voltar (dentro do card de formulário) */
.login-back-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: .8rem; font-weight: 500;
  padding: 1rem 1.5rem 0;
  transition: var(--transition);
}
.login-back-btn:hover { color: var(--primary-dark); }

/* Rodapé de confiança */
.login-trust-footer {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  margin-top: 1.75rem; text-align: center;
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
}
.login-trust-footer i { color: var(--primary); font-size: 1.5rem; }
.login-trust-footer strong { display: block; color: var(--text-primary); font-size: 13px; font-weight: 700; }
.login-trust-footer span { color: var(--text-muted); font-size: 13px; font-weight: 500; }

@media (max-width: 640px) {
  .login-selector-card { padding: 1.75rem 1.25rem 2rem; }
  .login-selector-options { flex-direction: column; gap: .5rem; }
  .login-selector-divider { width: auto; height: 1px; margin: .5rem 2rem; }
  .login-option { max-width: none; }
  .login-option-icon { width: 88px; height: 88px; font-size: 1.7rem; }
}

.login-divider { text-align: center; margin: 1rem 0; position: relative; }
.login-divider::before { content:''; position:absolute; top:50%; left:0; right:0; height:1px; background:var(--border); }
.login-divider span { position:relative; background:var(--surface); padding:0 .75rem; color:var(--text-muted); font-size:.78rem; }

.login-demo-hint {
  margin-top: 1rem; padding: .65rem .85rem;
  background: var(--sand-light); border-radius: var(--radius-sm);
  font-size: .78rem; color: var(--text-secondary); line-height: 1.6;
  border-left: 3px solid var(--sand);
}

/* =====================================================
   DASHBOARD LAYOUT
   ===================================================== */
.dashboard-page { display: flex; min-height: 100vh; overflow-x: hidden; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); height: 100vh;
  background: #FFFFFF;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; z-index: 200;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 2px 0 12px rgba(106,158,130,.10);
}
.sidebar-brand {
  padding: 1.25rem 1.1rem 1rem;
  display: flex; align-items: center; gap: .6rem;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-text .name { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); letter-spacing: -.02em; }
.sidebar-brand-text .name span { color: var(--primary-dark); }
.sidebar-brand-text .tagline { font-size: .68rem; color: var(--text-muted); letter-spacing: .03em; margin-top: .1rem; }

.sidebar-section-label {
  padding: 1rem 1rem .35rem;
  font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
}
.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .9rem; color: var(--text-secondary);
  font-size: .85rem; font-weight: 400;
  transition: var(--transition);
  margin: 0 .5rem .05rem; border-radius: var(--radius-sm);
}
.nav-item:hover { color: var(--primary-dark); background: var(--primary-xlight); }
.nav-item.active { color: var(--primary-dark); background: var(--primary-light); font-weight: 500; }
.nav-item.active .nav-dot { background: var(--primary-dark); }
.nav-item i { width: 16px; text-align: center; font-size: .88rem; flex-shrink: 0; }
.nav-dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; margin-left: auto; transition: var(--transition); }

.sidebar-footer {
  padding: 1rem; border-top: 1px solid var(--border-light);
}
.sidebar-user-card {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .75rem; background: var(--bg);
  border-radius: var(--radius-sm); margin-bottom: .6rem;
  border: 1px solid var(--border-light);
}
.sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex-shrink: 0;
  overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-info .name { font-size: .82rem; color: var(--text-primary); font-weight: 600; }
.sidebar-user-info .role { font-size: .7rem; color: var(--text-muted); }
.btn-logout {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .5rem .75rem; background: none; color: var(--text-muted);
  border-radius: var(--radius-sm); font-size: .82rem;
  transition: var(--transition);
}
.btn-logout:hover { background: var(--rose-light); color: var(--danger); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 199;
}

/* Main */
.main-wrapper { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* Topbar */
.topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
  position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-xs);
}
.btn-menu-toggle {
  display: none; background: none; color: var(--text-secondary);
  font-size: 1.1rem; padding: .4rem; border-radius: var(--radius-sm);
  transition: var(--transition);
}
.btn-menu-toggle:hover { background: var(--border-light); }
.topbar-title { flex: 1; font-size: .95rem; font-weight: 600; color: var(--text-primary); }
.topbar-date { font-size: .78rem; color: var(--text-muted); }
.topbar-user { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--text-secondary); font-weight: 500; }
.topbar-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; overflow: hidden;
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

.content-area { flex: 1; padding: 1.75rem; overflow-y: auto; max-width: 1400px; min-height: 0; height: 0; /* flex trick: força scroll dentro do flex */ }
.section { display: none; animation: fadeIn .25s ease; }
.section.active { display: block; }
.section-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.section-header h2 { font-family: var(--font-display); font-size: 1.65rem; color: var(--text-primary); }
.section-subtitle { font-size: .83rem; color: var(--text-muted); margin-top: .15rem; }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn-primary {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem 1.2rem; background: var(--primary); color: #fff;
  border-radius: var(--radius-sm); font-size: .88rem; font-weight: 500;
  transition: var(--transition); border: none; white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(106,158,130,.35); }
.btn-primary:active { transform: none; }
.btn-secondary {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem 1.2rem; background: var(--border-light); color: var(--text-secondary);
  border-radius: var(--radius-sm); font-size: .88rem; font-weight: 500;
  border: 1px solid var(--border); transition: var(--transition); white-space: nowrap;
}
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }
.btn-danger {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem 1.2rem; background: #FEF2F2; color: var(--danger);
  border-radius: var(--radius-sm); font-size: .88rem; font-weight: 500;
  border: 1px solid #FECACA; transition: var(--transition); white-space: nowrap;
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem 1.2rem; background: #ECFDF3; color: var(--success);
  border-radius: var(--radius-sm); font-size: .88rem; font-weight: 500;
  border: 1px solid #BBF7D0; transition: var(--transition); white-space: nowrap;
}
.btn-success:hover { background: var(--success); color: #fff; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .6rem 1.2rem; background: none; color: var(--text-secondary);
  border-radius: var(--radius-sm); font-size: .88rem; font-weight: 500;
  border: 1px solid transparent; transition: var(--transition);
}
.btn-ghost:hover { background: var(--border-light); border-color: var(--border); }
.btn-sm { padding: .4rem .85rem; font-size: .8rem; }
.btn-xs { padding: .3rem .65rem; font-size: .75rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }

/* =====================================================
   FORM ELEMENTS
   ===================================================== */
.form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.form-group label { font-size: .82rem; font-weight: 500; color: var(--text-secondary); }
.form-group label i { margin-right: .3rem; color: var(--primary); opacity: .8; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], input[type="date"],
input[type="url"], select, textarea {
  width: 100%; padding: .6rem .85rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-primary);
  font-size: .88rem; transition: var(--transition); outline: none;
  line-height: 1.5;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(141,191,160,.22);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238BA898' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2rem; }
.input-password { position: relative; }
.input-password input { padding-right: 2.5rem; }
.input-password button { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); background: none; color: var(--text-muted); padding: .2rem; transition: var(--transition); }
.input-password button:hover { color: var(--primary); }
.form-error { padding: .6rem .8rem; background: #FEF2F2; color: var(--danger); border: 1px solid #FECACA; border-radius: var(--radius-sm); font-size: .82rem; display: flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }

/* Photo upload */
.photo-upload-area {
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
  padding: 1.25rem; border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--border-light); cursor: pointer; transition: var(--transition);
}
.photo-upload-area:hover { border-color: var(--primary); background: var(--primary-xlight); }
.photo-preview {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; overflow: hidden; border: 3px solid var(--primary-light);
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-upload-area input[type="file"] { display: none; }
.photo-upload-label { font-size: .82rem; color: var(--text-muted); text-align: center; }
.photo-upload-label span { color: var(--primary); font-weight: 500; }

/* =====================================================
   KPI CARDS
   ===================================================== */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 1.15rem 1.25rem; display: flex; align-items: center; gap: .9rem;
  border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  transition: var(--transition); cursor: default;
}
.kpi-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.kpi-icon { width: 46px; height: 46px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.kpi-green       .kpi-icon { background: var(--primary-light); color: var(--primary-dark); }
.kpi-teal   .kpi-icon { background: var(--mint-light); color: #4A8A6A; }
.kpi-orange .kpi-icon { background: var(--sand-light); color: #B87F4A; }
.kpi-blue   .kpi-icon { background: var(--sky-light); color: #4A8A6A; }
.kpi-red         .kpi-icon { background: var(--rose-light); color: var(--danger); }
.kpi-bonificado  .kpi-icon { background: #FFE4F0; color: #C0507A; }

/* Botão "Não Cobrar" / bonificado */
.btn-bonificado {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .28rem .6rem;
  background: #FFE4F0; color: #C0507A;
  border: 1px solid #F4B8D0;
  border-radius: var(--radius-xs);
  font-size: .75rem; font-weight: 500;
  transition: var(--transition);
}
.btn-bonificado:hover { background: #C0507A; color: #fff; }

/* Linha bonificada na tabela financeiro */
.fin-row-bonificado td { opacity: .7; }
.fin-row-bonificado td:first-child { opacity: 1; }
.kpi-purple .kpi-icon { background: var(--accent-light); color: var(--primary-dark); }
.kpi-info { flex: 1; min-width: 0; }
.kpi-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; margin-top: .1rem; }
.kpi-sub   { font-size: .75rem; color: var(--text-muted); margin-top: .1rem; }
.kpi-sm    { font-size: 1rem !important; }

/* Today highlight card */
.today-card {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-light) 100%);
  border: 1.5px solid var(--primary);
}
.today-card .kpi-icon { background: var(--primary); color: #fff; }
.today-card .kpi-label { color: var(--primary-dark); font-weight: 700; }
.today-card .kpi-value { color: var(--text-primary); font-size: 2.2rem; }
.today-card .kpi-sub   { color: var(--text-secondary); }

/* =====================================================
   CARD BASE
   ===================================================== */
.card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  overflow: hidden; margin-bottom: 1.25rem;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.25rem; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: .6rem;
}
.card-header h3 { font-size: .95rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.card-body { padding: 1.25rem; }

/* =====================================================
   TABLE
   ===================================================== */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table th {
  padding: .65rem 1rem; text-align: left;
  background: var(--bg); color: var(--text-muted);
  font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  white-space: nowrap; border-bottom: 1px solid var(--border);
}
.data-table td { padding: .8rem 1rem; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg); }

/* =====================================================
   BADGES
   ===================================================== */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .65rem; border-radius: 99px;
  font-size: .73rem; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-agendada   { background: var(--primary-light); color: var(--primary-dark); }
.badge-confirmada { background: var(--mint-light); color: #3A7A58; }
.badge-realizada  { background: var(--accent-light); color: var(--primary-dark); }
.badge-cancelada  { background: var(--rose-light); color: var(--danger); }
.badge-remarcada  { background: var(--sand-light); color: #A07040; }
.badge-pago        { background: var(--mint-light); color: #3A7A58; }
.badge-pendente    { background: var(--sand-light); color: #A07040; }
.badge-atrasado    { background: var(--rose-light); color: var(--danger); }
.badge-aguardando  { background: var(--primary-light); color: var(--primary-dark); }
.badge-parcial     { background: #FEF3C7; color: #B45309; }
.badge-faltou      { background: #FFF7ED; color: #C2410C; }
.badge-bonificado  { background: #FFE4F0; color: #C0507A; font-weight: 600; }
.badge-presencial { background: var(--mint-light); color: #3A7A58; }
.badge-online     { background: var(--sky-light); color: var(--primary-dark); }

/* =====================================================
   CHARTS
   ===================================================== */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.chart-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.25rem; box-shadow: var(--shadow-xs); }
.chart-card-title { font-size: .88rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .85rem; }

/* =====================================================
   FILTER BAR
   ===================================================== */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .75rem;
  background: var(--surface); padding: .85rem 1rem;
  border-radius: var(--radius); border: 1px solid var(--border);
  margin-bottom: 1rem; box-shadow: var(--shadow-xs); align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: .25rem; min-width: 130px; }
.filter-group label { font-size: .73rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.filter-group input, .filter-group select { font-size: .83rem; padding: .5rem .75rem; }

/* =====================================================
   PATIENTS GRID
   ===================================================== */
.patients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.patient-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 1.15rem;
  box-shadow: var(--shadow-xs); transition: var(--transition);
}
.patient-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); border-color: var(--primary); }
.patient-card-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .9rem; }
.patient-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700; flex-shrink: 0;
  border: 2px solid var(--primary-light); overflow: hidden;
}
.patient-avatar img { width: 100%; height: 100%; object-fit: cover; }
.patient-card-name { font-weight: 600; font-size: .92rem; }
.patient-card-email { color: var(--text-muted); font-size: .77rem; }
.patient-card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .75rem 0; }
.stat-chip { background: var(--bg); border-radius: var(--radius-sm); padding: .4rem .65rem; text-align: center; }
.stat-chip .num { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-chip .lbl { font-size: .68rem; color: var(--text-muted); margin-top: .1rem; }
.patient-valor-badge { display: flex; align-items: center; justify-content: space-between; padding: .45rem .65rem; background: var(--primary-xlight); border-radius: var(--radius-sm); margin-bottom: .75rem; font-size: .8rem; }
.patient-valor-badge .lbl { color: var(--text-muted); }
.patient-valor-badge .val { font-weight: 700; color: var(--primary); }
.patient-card-footer { display: flex; gap: .4rem; padding-top: .75rem; border-top: 1px solid var(--border-light); flex-wrap: wrap; }

/* =====================================================
   PACIENTE INATIVO
   ===================================================== */
.patient-card-inativo {
  opacity: .72;
  border-style: dashed;
  border-color: var(--border);
  background: var(--bg);
}
.patient-card-inativo:hover { opacity: 1; }

/* Botões ativar / inativar */
.btn-inativar {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .38rem .72rem;
  background: #fff0f1; color: var(--danger);
  border: 1px solid #f4c0bb; border-radius: var(--radius-xs);
  font-size: .78rem; font-weight: 500;
  cursor: pointer; transition: var(--transition);
}
.btn-inativar:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ativar {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .38rem .72rem;
  background: #f0faf4; color: var(--success);
  border: 1px solid #a8ddb9; border-radius: var(--radius-xs);
  font-size: .78rem; font-weight: 500;
  cursor: pointer; transition: var(--transition);
}
.btn-ativar:hover { background: var(--success); color: #fff; border-color: var(--success); }

/* =====================================================
   TOGGLE SWITCH ATIVO/INATIVO (modal paciente)
   ===================================================== */
.toggle-status-row {
  display: flex; align-items: center; gap: .75rem;
  margin-top: .35rem; margin-bottom: .1rem;
}
.toggle-switch {
  position: relative; display: inline-block;
  width: 44px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 99px;
  transition: background .25s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .25s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
.toggle-status-label { font-size: .88rem; color: var(--text-secondary); }

/* =====================================================
   BOTÃO PDF (sessões prontuário — versão card pequeno)
   ===================================================== */
.btn-pdf {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .6rem;
  background: #fff0f0; color: #c0392b;
  border: 1px solid #f4c0bb; border-radius: var(--radius-xs);
  font-size: .75rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-pdf:hover { background: #c0392b; color: #fff; border-color: #c0392b; }
.btn-pdf.btn-xs { padding: .22rem .48rem; font-size: .7rem; }

/* Botão PDF no rodapé do modal — versão maior e com estilo */
.btn-pdf-modal {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .55rem 1.1rem;
  background: #fff0f0; color: #c0392b;
  border: 1.5px solid #f4c0bb; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 500;
  cursor: pointer; transition: var(--transition);
  white-space: nowrap;
}
.btn-pdf-modal:hover { background: #c0392b; color: #fff; border-color: #c0392b; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(192,57,43,.25); }
.btn-pdf-modal:active { transform: none; }

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 2.5rem; margin-bottom: .6rem; opacity: .35; display: block; }
.empty-state p { font-size: .9rem; margin-bottom: .85rem; }

/* =====================================================
   CONFIG
   ===================================================== */
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.config-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.4rem; box-shadow: var(--shadow-xs); }
.config-card-title { display: flex; align-items: center; gap: .5rem; font-size: .88rem; font-weight: 600; color: var(--primary); margin-bottom: 1.1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--border-light); }
.config-actions { display: flex; justify-content: flex-end; margin-top: 1.25rem; }

/* ─── Grade de atendimento — novo sistema de turnos ─── */
.schedule-builder { display: flex; flex-direction: column; gap: .75rem; }
.schedule-day-row {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: .75rem .9rem;
  background: var(--bg);
  transition: var(--transition);
}
.schedule-day-row:has(input[type=checkbox]:checked) {
  border-color: var(--primary);
  background: var(--primary-xlight);
}
.day-toggle { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.day-toggle input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; flex-shrink:0; }
.day-toggle span { font-size: .88rem; font-weight: 600; color: var(--text-primary); min-width: 85px; }

/* Preview rápido no cabeçalho do dia */
.sdr-preview {
  display: inline-flex; align-items: center;
  font-size: .72rem; color: var(--primary-dark);
  background: var(--primary-light); border-radius: 99px;
  padding: .18rem .65rem; font-weight: 500;
}

/* Turnos */
.schedule-turnos { display: flex; flex-direction: column; gap: .5rem; }
.schedule-turno {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
}
.turno-inputs {
  display: flex; align-items: flex-end; gap: .65rem; flex-wrap: wrap;
}
.turno-field { display: flex; flex-direction: column; gap: .22rem; }
.turno-label { font-size: .7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.turno-inputs input[type="time"],
.turno-inputs input[type="number"] {
  width: auto; padding: .38rem .65rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .85rem; background: var(--surface); color: var(--text-primary);
}
.turno-inputs input[type="number"] { width: 80px; }
.turno-del { align-self: flex-end; }

/* Preview dos slots gerados */
.turno-preview { margin-top: .45rem; min-height: 1.2em; }
.turno-slots-preview {
  display: flex; flex-wrap: wrap; gap: .3rem;
  font-size: .72rem; color: var(--primary-dark);
  font-weight: 500; line-height: 1.8;
}
.turno-slots-preview::before { content: ''; }

/* Chips legado (mantidos para compat.) */
.time-chips { display: flex; flex-wrap: wrap; gap: .4rem; padding-left: 1.25rem; }
.time-chip {
  padding: .3rem .7rem; border-radius: 99px; font-size: .78rem; font-weight: 500;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
}
.time-chip:hover { border-color: var(--primary); color: var(--primary); }
.time-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.time-chip.disabled { opacity: .35; cursor: not-allowed; }

/* Código ativação */
.activation-code-box {
  display: flex; align-items: center; gap: .75rem;
  background: linear-gradient(135deg, var(--primary-xlight), var(--accent-light));
  border: 1.5px solid var(--primary); border-radius: var(--radius);
  padding: 1rem 1.25rem; margin-bottom: 1.25rem;
}
.activation-code-box .code { font-size: 1.6rem; font-weight: 700; color: var(--primary); letter-spacing: .12em; font-family: 'Courier New', monospace; }
.activation-code-box .label { font-size: .78rem; color: var(--text-muted); margin-bottom: .2rem; }
.btn-copy { padding: .4rem .85rem; background: var(--primary); color: #fff; border-radius: var(--radius-sm); font-size: .8rem; border: none; cursor: pointer; transition: var(--transition); }
.btn-copy:hover { background: var(--primary-dark); }

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 1rem; backdrop-filter: blur(3px);
  animation: fadeIn .15s ease;
}
.modal-box {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto;
}
.modal-lg  { max-width: 720px; }
.modal-xl  { max-width: 900px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-header h3 { font-size: .98rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; color: var(--text-primary); }
.modal-header-actions { display: flex; align-items: center; gap: .5rem; }
.modal-close { width: 30px; height: 30px; border-radius: 50%; background: var(--bg); color: var(--text-muted); display: flex; align-items: center; justify-content: center; font-size: .85rem; transition: var(--transition); }
.modal-close:hover { background: #FEE2E2; color: var(--danger); }
.modal-body { padding: 1.4rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: .65rem; padding: 1rem 1.4rem; border-top: 1px solid var(--border); background: var(--bg); }

/* =====================================================
   CONSULTA CARDS (paciente)
   ===================================================== */
.consulta-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 1.1rem 1.25rem;
  margin-bottom: .75rem; display: flex; align-items: flex-start; gap: 1rem;
  flex-wrap: wrap; transition: var(--transition); box-shadow: var(--shadow-xs);
}
.consulta-card:hover { box-shadow: var(--shadow-sm); border-color: var(--primary); }
.consulta-date-block {
  min-width: 68px; text-align: center; background: var(--primary-light);
  border-radius: var(--radius-sm); padding: .6rem .5rem; flex-shrink: 0;
}
.consulta-date-block .day   { font-size: 1.6rem; font-weight: 700; color: var(--primary); line-height: 1; }
.consulta-date-block .month { font-size: .7rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .05em; }
.consulta-date-block .year  { font-size: .68rem; color: var(--text-muted); margin-top: .1rem; }
.consulta-info { flex: 1; min-width: 0; }
.consulta-info h4 { font-weight: 600; font-size: .92rem; margin-bottom: .2rem; }
.consulta-info p  { color: var(--text-secondary); font-size: .8rem; }
.consulta-actions { display: flex; gap: .4rem; align-items: flex-start; flex-wrap: wrap; }

/* Meet link badge */
.meet-link { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; background: var(--mint-light); color: var(--primary-dark); border-radius: 99px; font-size: .75rem; font-weight: 500; text-decoration: none; transition: var(--transition); }
.meet-link:hover { background: var(--accent-light); color: var(--primary-dark); text-decoration: none; }

/* Meet com destaque — usado nos cards de Hoje e no card de paciente */
.meet-link-destaque {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem 1rem;
  background: #1a73e8;          /* azul Google Meet */
  color: #fff !important;
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(26,115,232,.25);
  transition: var(--transition);
  margin-top: .35rem;
}
.meet-link-destaque:hover {
  background: #1558b0;
  color: #fff !important;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(26,115,232,.35);
  transform: translateY(-1px);
}
.meet-link-destaque i { font-size: .85rem; }

/* Botão Meet compacto para tabelas */
.meet-link-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .65rem;
  background: #e8f0fe;
  color: #1a73e8 !important;
  border-radius: 6px;
  font-size: .73rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.meet-link-btn:hover { background: #1a73e8; color: #fff !important; text-decoration: none; }

/* Proxima destaque */
.proxima-destaque {
  padding: 1.25rem; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.proxima-destaque .big-date {
  text-align: center; background: var(--primary-light); color: var(--primary-dark);
  border-radius: var(--radius); padding: .85rem 1rem; min-width: 80px;
  border: 1.5px solid var(--primary);
}
.proxima-destaque .big-date .day   { font-size: 2.2rem; font-weight: 700; line-height: 1; color: var(--primary-dark); }
.proxima-destaque .big-date .month { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.proxima-destaque .info { flex: 1; }
.proxima-destaque .info h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: .35rem; }
.proxima-destaque .info p  { color: var(--text-secondary); font-size: .83rem; margin-bottom: .2rem; }

/* =====================================================
   PAGAMENTO CARDS
   ===================================================== */
.pagamento-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 1.1rem 1.25rem;
  margin-bottom: .75rem; display: flex; align-items: center; gap: 1rem;
  flex-wrap: wrap; box-shadow: var(--shadow-xs); transition: var(--transition);
}
.pagamento-card:hover { box-shadow: var(--shadow-sm); }
.pag-status-icon { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.status-pago     .pag-status-icon { background: var(--mint-light); color: #4A8A6A; }
.status-pendente .pag-status-icon { background: #FFF7ED; color: #F97316; }
.status-atrasado .pag-status-icon { background: #FEF2F2; color: var(--danger); }
.status-aguardando .pag-status-icon { background: #EFF6FF; color: #2563EB; }
.pagamento-info { flex: 1; }
.pagamento-info h4 { font-weight: 600; font-size: .9rem; }
.pagamento-info p  { color: var(--text-secondary); font-size: .78rem; margin-top: .1rem; }
.pagamento-valor { font-size: 1.15rem; font-weight: 700; }

/* Comprovante upload */
.comprovante-area {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 1rem; text-align: center; cursor: pointer;
  transition: var(--transition); background: var(--bg);
}
.comprovante-area:hover { border-color: var(--primary); background: var(--primary-xlight); }
.comprovante-area.has-file { border-color: var(--primary); background: var(--primary-xlight); border-style: solid; }
.comprovante-area input[type="file"] { display: none; }
.comprovante-preview { display: flex; align-items: center; gap: .6rem; font-size: .82rem; }
.comprovante-preview i { color: var(--primary); font-size: 1.2rem; }

/* =====================================================
   BOOKING (agendamento paciente)
   ===================================================== */
.booking-container { display: grid; grid-template-columns: 1fr 300px; gap: 1.25rem; align-items: start; }
.booking-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.5rem; box-shadow: var(--shadow-xs); }
.booking-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1.25rem; display: flex; align-items: center; gap: .5rem; }

.modalidade-selector { display: flex; gap: .75rem; }
.radio-card {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem;
  padding: .75rem; border: 2px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition); font-size: .82rem; font-weight: 500; color: var(--text-secondary);
}
.radio-card input { display: none; }
.radio-card i { font-size: 1.2rem; }
.radio-card.active { border-color: var(--primary); background: var(--primary-xlight); color: var(--primary); }

.horarios-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.horario-chip {
  padding: .4rem .9rem; border: 1.5px solid var(--border); border-radius: 99px;
  font-size: .82rem; font-weight: 500; cursor: pointer;
  transition: var(--transition); color: var(--text-secondary); background: var(--surface);
}
.horario-chip:hover:not(.occupied) { border-color: var(--primary); color: var(--primary); background: var(--primary-xlight); }
.horario-chip.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.horario-chip.occupied { opacity: .4; cursor: not-allowed; background: var(--bg); text-decoration: line-through; }

.psi-info-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.5rem; box-shadow: var(--shadow-xs); text-align: center; position: sticky; top: calc(var(--topbar-h) + 1rem); }
.psi-avatar-lg {
  width: 72px; height: 72px; border-radius: 50%; background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 1.8rem;
  margin: 0 auto .85rem; border: 3px solid var(--primary-light); overflow: hidden;
}
.psi-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.psi-info-card h3 { font-family: var(--font-display); font-size: 1.1rem; margin-bottom: .3rem; }
.crp-badge { display: inline-block; padding: .2rem .65rem; background: var(--primary-xlight); color: var(--primary); border-radius: 99px; font-size: .75rem; font-weight: 600; margin-bottom: 1rem; }
.info-list { text-align: left; display: flex; flex-direction: column; gap: .6rem; }
.info-list-item { display: flex; align-items: center; gap: .6rem; font-size: .83rem; color: var(--text-secondary); }
.info-list-item i { color: var(--primary); width: 16px; text-align: center; flex-shrink: 0; }

/* =====================================================
   TODAY LIST (lista de pacientes do dia)
   ===================================================== */
.today-patient-row {
  display: flex; align-items: center; gap: 1rem; padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--border-light); transition: var(--transition);
  flex-wrap: wrap;
}
.today-patient-row:last-child { border-bottom: none; }
.today-patient-row:hover { background: var(--bg); }
.today-time { font-size: .88rem; font-weight: 700; color: var(--primary); min-width: 48px; }
.today-patient-info { flex: 1; }
.today-patient-info .name { font-weight: 600; font-size: .9rem; }
.today-patient-info .detail { font-size: .78rem; color: var(--text-muted); }
.today-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

/* =====================================================
   RECIBO
   ===================================================== */
.recibo-print { font-family: var(--font); max-width: 640px; margin: 0 auto; }
.recibo-header { text-align: center; padding-bottom: 1.25rem; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.recibo-brand { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: .5rem; }
.recibo-brand .icon { width: 38px; height: 38px; background: var(--primary); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1rem; color: #fff; }
.recibo-brand .name { font-family: var(--font-display); font-size: 1.5rem; color: var(--text-primary); font-style: italic; }
.recibo-header h4 { font-size: 1rem; color: var(--text-secondary); font-weight: 500; }
.recibo-header .num { font-size: .82rem; color: var(--text-muted); }
.recibo-section { margin-bottom: 1.25rem; }
.recibo-section-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: .65rem; padding-bottom: .35rem; border-bottom: 1px solid var(--border-light); }
.recibo-row { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: .4rem; }
.recibo-row span:first-child { color: var(--text-secondary); }
.recibo-row span:last-child { font-weight: 500; }
.recibo-total { background: linear-gradient(135deg, var(--primary-light), var(--accent-light)); color: var(--text-primary); border: 1.5px solid var(--primary); border-radius: var(--radius); padding: .9rem 1.25rem; display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.recibo-total .label { font-size: .88rem; font-weight: 500; }
.recibo-total .value { font-size: 1.25rem; font-weight: 700; }
.recibo-note { text-align: center; color: var(--text-muted); font-size: .75rem; margin-top: 1.25rem; }

@media print {
  .modal-header, .modal-footer, .topbar, .sidebar, button, .sidebar-overlay { display: none !important; }
  .modal-box { box-shadow: none !important; max-height: none !important; }
  body { background: #fff !important; }
}

/* Impressão do relatório financeiro detalhado do paciente */
@media print {
  body.printing-rel-paciente > *:not(#rel-paciente-print-area) { display: none !important; }
  body.printing-rel-paciente #rel-paciente-print-area {
    position: fixed; top: 0; left: 0; width: 100%; padding: 20px;
  }
  body.printing-rel-paciente .rel-paciente-no-print { display: none !important; }
  body.printing-rel-paciente .rel-paciente-print-header { display: block !important; margin-bottom: 20px; }
  body.printing-rel-paciente .rel-paciente-print-header h2 { font-size: 20px; margin-bottom: 4px; }
  body.printing-rel-paciente .rel-paciente-print-header p { color: #666; font-size: 13px; }
}

/* Impressão do relatório de atendimento (Exportar PDF via impressão do navegador) */
@media print {
  body.printing-atend-paciente > *:not(#atend-paciente-print-area) { display: none !important; }
  body.printing-atend-paciente #atend-paciente-print-area {
    position: fixed; top: 0; left: 0; width: 100%; padding: 20px;
  }
  body.printing-atend-paciente .atend-paciente-no-print { display: none !important; }
  body.printing-atend-paciente .atend-paciente-print-header { display: block !important; margin-bottom: 20px; }
  body.printing-atend-paciente .atend-paciente-print-header h2 { font-size: 20px; margin-bottom: 4px; }
  body.printing-atend-paciente .atend-paciente-print-header p { color: #666; font-size: 13px; }
}

/* =====================================================
   TOAST
   ===================================================== */
.toast-container { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9999; display: flex; flex-direction: column; gap: .4rem; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: .65rem;
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); font-size: .85rem; font-weight: 500;
  min-width: 260px; max-width: 360px; pointer-events: all;
  animation: slideInToast .25s ease;
}
@keyframes slideInToast { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-success { background: var(--primary-light); color: var(--primary-dark); border-left: 3px solid var(--primary); }
.toast-error   { background: #FEF2F2; color: #991B1B; border-left: 3px solid var(--danger); }
.toast-info    { background: #EFF6FF; color: #1E40AF; border-left: 3px solid #3B82F6; }
.toast-warning { background: #FFF7ED; color: #92400E; border-left: 3px solid #F97316; }
.toast-close   { margin-left: auto; background: none; color: inherit; opacity: .6; font-size: .75rem; pointer-events: all; }

/* =====================================================
   DETALHES PACIENTE MODAL
   ===================================================== */
.detalhe-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 1.1rem; gap: .25rem; }
.detalhe-tab-btn { padding: .55rem .9rem; background: none; color: var(--text-muted); font-size: .83rem; font-weight: 500; border-bottom: 2px solid transparent; transition: var(--transition); }
.detalhe-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.detalhe-tab-content { display: none; }
.detalhe-tab-content.active { display: block; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin-bottom: .85rem; }
.info-field label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; }
.info-field span { font-size: .88rem; font-weight: 500; display: block; margin-top: .1rem; }

/* =====================================================
   UTILITIES
   ===================================================== */
.text-green  { color: var(--primary) !important; }
.text-orange { color: #F97316 !important; }
.text-red    { color: var(--danger) !important; }
.text-blue   { color: #3B82F6 !important; }
.text-muted  { color: var(--text-muted) !important; }
.font-bold   { font-weight: 700 !important; }
.text-sm     { font-size: .82rem; }
.text-xs     { font-size: .73rem; }
.mt-1  { margin-top: .5rem; }
.mt-2  { margin-top: 1rem; }
.gap-2 { gap: .5rem; }
.flex  { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1100px) {
  .charts-row { grid-template-columns: 1fr; }
  .booking-container { grid-template-columns: 1fr; }
  .psi-info-card { position: static; }
}

/* =====================================================
   TABLET (≤ 900px) — grids de KPI com mais folga
   ===================================================== */
@media (max-width: 900px) {
  .kpi-grid, .adm-grid-kpi { grid-template-columns: repeat(2, 1fr) !important; }
  .patients-grid { grid-template-columns: 1fr !important; }
  .adm-grid-2, .adm-grid-2-even { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px) !important; width: 260px !important; }
  .sidebar.open { transform: translateX(0) !important; }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0 !important; }
  .btn-menu-toggle { display: flex; }
  .content-area { padding: 1rem; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .topbar-date { display: none; }
  .kpi-grid, .adm-grid-kpi { grid-template-columns: 1fr 1fr !important; }
  .config-grid { grid-template-columns: 1fr; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .section-header > *:last-child { width: 100%; }
  .section-header .btn-primary { width: 100%; justify-content: center; }
  .filter-bar { flex-direction: column; align-items: stretch !important; }
  .filter-group { min-width: 0; width: 100%; }

  /* Topbar: esconde busca/extras, mantém essencial */
  .adm-topbar-search { display: none !important; }
  .topbar-title { font-size: .85rem; }
  .topbar { padding: 0 .85rem; gap: .5rem; }
  .topbar-user span { display: none; } /* mantém só o avatar, some o nome */

  /* Section headers das telas internas (Painel Geral, Agenda, etc.) */
  .section-header h2 { font-size: 1.35rem !important; }

  /* Quick filters da agenda: permite rolagem horizontal em vez de quebrar */
  .quick-filters { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: .3rem; }
  .qf-btn { flex-shrink: 0; }

  /* Cards de paciente/psicólogo em lista: empilha os blocos internos */
  .patient-row, .psi-adm-card { flex-wrap: wrap; }
  .patient-row-stats, .psi-adm-actions { width: 100%; justify-content: space-between; }
}

/* =====================================================
   CELULAR (≤ 640px)
   ===================================================== */
@media (max-width: 640px) {
  .kpi-grid, .adm-grid-kpi { grid-template-columns: 1fr !important; }
  .modal-box { border-radius: var(--radius); }
  .charts-row { grid-template-columns: 1fr; }

  /* Evita zoom automático do iOS Safari em qualquer campo de formulário */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="tel"], input[type="number"], input[type="date"],
  input[type="url"], select, textarea {
    font-size: 16px !important;
  }

  /* Tabelas: reduz densidade, mantém rolagem horizontal suave e visível */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
    position: relative;
  }
  .data-table { font-size: .78rem; }
  .data-table th, .data-table td { padding: .55rem .65rem; }
  .data-table th { font-size: .68rem; }

  /* Cards/KPIs: reduz padding para caber melhor */
  .kpi-card { padding: 1rem 1.1rem !important; }
  .kpi-value { font-size: 1.4rem !important; }

  /* Modais: quase full-screen, com margem mínima */
  .modal-overlay { padding: .6rem; }
  .modal-box { max-width: 100% !important; max-height: 94vh; }
  .modal-header { padding: 1rem 1.1rem; }
  .modal-body, .card-body { padding: 1rem !important; }

  /* Botões de ação em linhas de tabela: empilha ao invés de espremer */
  .data-table td div[style*="display:flex"] { flex-wrap: wrap; }

  /* Estatísticas em grade (prontuário, financeiro etc.) — 2 colunas em vez de 3+ */
  .pront-stats-grid, .stat-chip-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Sidebar ocupa quase toda a largura da tela em telas bem pequenas */
  .sidebar { width: min(260px, 84vw); transform: translateX(-100%); }

  /* Botões de topo de seção sempre com largura total, mais fácil de tocar */
  .btn-primary, .btn-secondary { min-height: 40px; }
}

/* Alvos de toque confortáveis (Apple HIG: mínimo 44px) em qualquer largura de tela sensível ao toque */
@media (hover: none) and (pointer: coarse) {
  .nav-item { min-height: 44px; }
  .btn-icon, .btn-xs.btn-icon { min-width: 32px; min-height: 32px; }
  .tab-btn { min-height: 44px; }
}


/* No prontuário mobile: sobe o toast para não ficar atrás da navbar bottom */
@media (max-width: 860px) {
  body.dashboard-page .toast-container {
    bottom: calc(72px + env(safe-area-inset-bottom, 8px));
  }
}

/* =====================================================
   ADM — Painel Administrativo
   ===================================================== */
.admin-page {
  min-height: 100vh;
  background: linear-gradient(150deg, #E4F2EA 0%, #F2FAF5 60%, #EAF0E8 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.admin-login-wrap { width: 100%; max-width: 420px; }
.admin-login-brand { text-align: center; margin-bottom: 1.5rem; }
.admin-login-brand .brand { font-size: 1.7rem; font-weight: 700; color: var(--text-primary); letter-spacing: -.02em; }
.admin-login-brand .brand span { color: var(--primary-dark); }
.admin-login-brand .sub { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }
.admin-badge {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--primary-light); color: var(--primary-dark);
  border: 1px solid var(--primary); border-radius: 99px;
  font-size: .72rem; font-weight: 700; padding: .25rem .75rem;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: .75rem;
}

/* Sidebar ADM — acento levemente diferente para distinguir */
.sidebar-adm .sidebar-brand-text .name span { color: var(--primary-dark); }
.sidebar-adm .sidebar-brand-text .tagline  { color: var(--warning); font-weight: 600; font-size: .7rem; }

/* Psicólogo card no ADM */
.psi-adm-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  flex-wrap: wrap; box-shadow: var(--shadow-xs);
  transition: var(--transition); margin-bottom: .6rem;
}
.psi-adm-card:hover { box-shadow: var(--shadow-sm); border-color: var(--primary); }
.psi-adm-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; font-weight: 700; flex-shrink: 0;
  border: 2px solid var(--primary); overflow: hidden;
}
.psi-adm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.psi-adm-info { flex: 1; min-width: 0; }
.psi-adm-info .nome { font-weight: 600; font-size: .95rem; color: var(--text-primary); }
.psi-adm-info .meta { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; }
.psi-adm-code {
  display: flex; align-items: center; gap: .4rem;
  background: var(--primary-light); border-radius: var(--radius-sm);
  padding: .3rem .7rem; font-family: 'Courier New', monospace;
  font-size: .85rem; font-weight: 700; color: var(--primary-dark);
  letter-spacing: .08em; white-space: nowrap;
}
.psi-adm-actions { display: flex; gap: .4rem; flex-shrink: 0; }
.badge-ativo    { background: var(--mint-light); color: #3A7A58; }
.badge-inativo  { background: var(--rose-light); color: var(--danger); }

/* Stats ADM topo */
.adm-stat-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .85rem; margin-bottom: 1.5rem;
}
.adm-stat {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 1rem 1.2rem;
  box-shadow: var(--shadow-xs);
}
.adm-stat .num { font-size: 1.8rem; font-weight: 700; color: var(--primary-dark); line-height: 1; }
.adm-stat .lbl { font-size: .73rem; color: var(--text-muted); margin-top: .2rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }

/* =====================================================
   LICENÇAS — Painel Admin
   ===================================================== */
.lic-badge-premium {
  display:inline-flex; align-items:center; gap:.3rem;
  background:#ede9fe; color:#6d28d9;
  padding:.22rem .65rem; border-radius:99px;
  font-size:.75rem; font-weight:600;
}
.lic-badge-ativa {
  display:inline-flex; align-items:center; gap:.3rem;
  background:#d1fae5; color:#065f46;
  padding:.22rem .65rem; border-radius:99px;
  font-size:.75rem; font-weight:600;
}
.lic-badge-alerta {
  display:inline-flex; align-items:center; gap:.3rem;
  background:#fef3c7; color:#b45309;
  padding:.22rem .65rem; border-radius:99px;
  font-size:.75rem; font-weight:600;
}
.lic-badge-vencida {
  display:inline-flex; align-items:center; gap:.3rem;
  background:#fee2e2; color:#b91c1c;
  padding:.22rem .65rem; border-radius:99px;
  font-size:.75rem; font-weight:600;
}
.lic-badge-sem {
  display:inline-flex; align-items:center; gap:.3rem;
  background:#f3f4f6; color:#6b7280;
  padding:.22rem .65rem; border-radius:99px;
  font-size:.75rem; font-weight:600;
}

/* =====================================================
   MENSAGENS ADMIN — exibição no dashboard psicólogo
   ===================================================== */
.admin-msg-banner {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius);
  padding: .85rem 1.1rem;
  margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: .85rem;
}
.admin-msg-banner .msg-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: #3b82f6; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0;
}
.admin-msg-banner .msg-body { flex: 1; min-width: 0; }
.admin-msg-banner .msg-titulo { font-weight: 600; font-size: .88rem; color: #1e3a8a; }
.admin-msg-banner .msg-texto  { font-size: .82rem; color: #1e40af; margin-top: .2rem; line-height: 1.5; }
.admin-msg-banner .btn-msg-fechar {
  background: none; border: none; cursor: pointer;
  color: #93c5fd; font-size: 1rem; padding: .2rem;
  transition: color .2s; flex-shrink: 0;
}
.admin-msg-banner .btn-msg-fechar:hover { color: #1e3a8a; }
