/* ==========================================================================
   Consultório Nutri — estilo editorial, limpo e profissional
   Paleta: verde #4A7C59 · cinza escuro #2C2C2C
   Tipografia: Montserrat (títulos) · Lato (texto)
   ========================================================================== */
/* Fontes vendoradas (offline) — Montserrat (títulos) e Lato (texto) */
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 500; font-display: swap; src: url('/static/fonts/montserrat-500.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 600; font-display: swap; src: url('/static/fonts/montserrat-600.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/fonts/montserrat-700.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; font-display: swap; src: url('/static/fonts/lato-400.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; font-display: swap; src: url('/static/fonts/lato-700.woff2') format('woff2'); }

:root {
  --green: #4A7C59;
  --green-dark: #3C6649;
  --green-soft: #EAF1EC;
  --ink: #2C2C2C;
  --ink-soft: #5A5A5A;
  --paper: #F7F5F0;
  --white: #FFFFFF;
  --line: #E7E3DA;
  --line-soft: #EFEBE2;
  --danger: #B0413E;
  --warn: #C9893B;
  --gold: #C9893B;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(44,44,44,.04), 0 2px 10px rgba(44,44,44,.05);
  --shadow-lg: 0 10px 34px rgba(44,44,44,.12);
  --sidebar-w: 252px;
  --maxw: 1320px;
  font-family: 'Lato', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, .brand strong, .stat-value {
  font-family: 'Montserrat', system-ui, sans-serif;
  color: var(--ink);
  letter-spacing: -.1px;
}
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, #323230 0%, #292927 100%);
  color: #EDEAE3;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.05);
}
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 22px; padding: 4px; }
.brand-logo { width: 100%; max-width: 152px; height: auto; display: block; }
.brand-caption { font-family: 'Montserrat', sans-serif; font-size: 10.5px; letter-spacing: .4px; color: #9C968C; text-align: center; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(135deg, #5B9069, #3C6649); color: #fff;
  display: grid; place-items: center;
  font-family: 'Montserrat'; font-weight: 700; font-size: 21px;
  box-shadow: 0 3px 10px rgba(74,124,89,.4);
}
.brand-mark.big { width: 64px; height: 64px; font-size: 32px; border-radius: 16px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { color: #fff; font-size: 15px; letter-spacing: -.2px; }
.brand-text span { font-size: 11px; color: #9C968C; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; min-height: 0; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  color: #BDB8AE; padding: 10px 12px; border-radius: 10px;
  font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 13.5px;
  text-decoration: none; transition: background .15s, color .15s, transform .05s;
}
.nav a .ic { width: 18px; height: 18px; flex: 0 0 18px; opacity: .8; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a:hover .ic { opacity: 1; }
.nav a.active {
  background: linear-gradient(135deg, var(--green), var(--green-dark)); color: #fff;
  box-shadow: 0 3px 12px rgba(74,124,89,.38);
}
.nav a.active .ic { opacity: 1; }

.sidebar-footer { display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid rgba(255,255,255,.08); padding: 14px 6px 2px; font-size: 12.5px; }
.user-link { color: #EDEAE3; font-weight: 700; }
.user-link:hover { text-decoration: none; color: #fff; }
.logout { color: #9C968C; }
.logout:hover { color: var(--warn); text-decoration: none; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 40px; border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.85); backdrop-filter: saturate(1.4) blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 21px; font-weight: 700; }
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page { padding: 32px 40px; max-width: var(--maxw); width: 100%; }

/* ---------- Cards ---------- */
.card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; margin-bottom: 22px;
}
.card.no-pad { padding: 0; overflow: hidden; }
.card.narrow { max-width: 560px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.card-header h2, .card h2 { margin: 0; font-size: 16px; font-weight: 700; }
.card-header h2 { display: flex; align-items: center; gap: 8px; }
.ic-h { width: 17px; height: 17px; flex: 0 0 auto; color: var(--green); }
.btn .ic-sm { width: 15px; height: 15px; flex: 0 0 auto; }
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state h2 { margin-bottom: 6px; }
.empty-state .btn { margin-top: 8px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 13px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--white); color: var(--ink);
  text-decoration: none; transition: background .14s, border-color .14s, box-shadow .14s, transform .04s;
}
.btn:hover { background: #FBFAF7; border-color: #D9D4C9; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn.primary {
  background: linear-gradient(135deg, var(--green), var(--green-dark)); border-color: var(--green-dark);
  color: #fff; box-shadow: 0 2px 8px rgba(74,124,89,.28);
}
.btn.primary:hover { background: var(--green-dark); box-shadow: 0 4px 14px rgba(74,124,89,.36); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: rgba(44,44,44,.04); }
.btn.small { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #FBEAEA; border-color: #EBC9C8; }

.link { background: none; border: none; padding: 0; cursor: pointer;
  color: var(--green-dark); font: inherit; }
.link:hover { text-decoration: underline; }
.link.danger, .danger { color: var(--danger); }

/* ---------- Alertas ---------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.alert.error { background: #FBEAEA; color: var(--danger); border: 1px solid #EBC9C8; }
.alert.success { background: var(--green-soft); color: var(--green-dark); border: 1px solid #CADfCF; }
.alert.warn { background: #FBF1E2; color: #8A5A1E; border: 1px solid #EEDCBF; }
.alert.info { background: var(--green-soft); color: var(--green-dark); border: 1px solid #CADfCF; }
.backup-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.backup-banner .btn { background: var(--white); }
.backup-list li { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }

/* ---------- Stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { position: relative; display: flex; flex-direction: column; gap: 5px; margin: 0; padding-left: 24px; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: linear-gradient(180deg, #5B9069, var(--green-dark)); }
/* variante com ícone (dashboard) — sem a barra de acento */
.stat.kpi { flex-direction: row; align-items: center; gap: 14px; padding-left: 20px; }
.stat.kpi::before { display: none; }
.stat.kpi .stat-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-icon { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 13px; display: grid; place-items: center; background: var(--green-soft); color: var(--green-dark); }
.stat-icon .ic { width: 22px; height: 22px; }
.stat-icon.warn { background: color-mix(in srgb, var(--warn) 16%, var(--white)); color: var(--warn); }
.kpi-trend { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 11.5px; margin-top: 3px; }
.kpi-trend.up { color: var(--green-dark); }
.kpi-trend.down { color: var(--danger); }
.kpi-trend .muted { font-weight: 600; font-size: 10.5px; }
.stat-label { font-size: 11.5px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }
.stat-value { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat-value.entrada { color: var(--green-dark); }
.stat-value.saida { color: var(--danger); }

/* ---------- Listas / tabelas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 8px; margin: 0 -8px; border-radius: 8px; border-bottom: 1px solid var(--line-soft); transition: background .1s; }
.list li:hover { background: #FAF8F3; }
.list li:last-child { border-bottom: none; }
.list-title { font-weight: 700; color: var(--ink); }
.list-title:hover { color: var(--green-dark); }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-family: 'Montserrat'; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .6px; color: var(--ink-soft); padding: 11px 14px; background: #FAF8F3;
  border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #FAF8F3; }
.table.compact th, .table.compact td { padding: 8px 11px; }
tr.inactive { opacity: .55; }
.row-actions { text-align: right; white-space: nowrap; }
.scroll-x { overflow-x: auto; }

/* ---------- Badges / chips ---------- */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: .2px; }
.badge.stage { background: var(--green-soft); color: var(--green-dark); }
.badge.type { background: #EEEBE4; color: var(--ink); }
.muted-badge { background: #ECECEC; color: #777; margin-left: 6px; }

.tag-row { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  color: var(--c, var(--green-dark));
  border: 1px solid var(--c, var(--green));
  background: color-mix(in srgb, var(--c, var(--green)) 12%, white);
  white-space: nowrap;
}

/* ---------- Formulários ---------- */
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 700; font-size: 13px; color: var(--ink); margin-bottom: 14px; }
.form input[type=text], .form input[type=email], .form input[type=password],
.form input[type=search], .form input[type=date], .form input[type=datetime-local],
.form select, .form textarea {
  font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--white); color: var(--ink); width: 100%;
  transition: border-color .14s, box-shadow .14s;
}
.form input:hover, .form select:hover, .form textarea:hover { border-color: #D6D1C6; }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(74,124,89,.16);
}
.form textarea { resize: vertical; }
.form input[type=color] { padding: 2px; height: 40px; width: 48px; border-radius: 8px; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 18px; }
.span-2 { grid-column: 1 / -1; }
.span-3 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.form.bordered { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: #FCFBF8; margin-bottom: 18px; }
.inline-grid { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-grid input[type=text] { flex: 1; min-width: 160px; }
.inline-form { display: inline; }
.push-right { margin-left: auto; }

.tags-fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 18px; }
.tags-fieldset legend { font-family: 'Montserrat'; font-weight: 600; font-size: 13px; padding: 0 6px; }
.tag-checks { display: flex; flex-wrap: wrap; gap: 12px; }
.tag-check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin: 0; }
.tag-manage { list-style: none; margin: 0; padding: 0; }
.tag-manage li { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tag-manage li:last-child { border-bottom: none; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 220px; max-width: 360px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; }
.toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--white); color: var(--ink); }
.checkline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.danger-zone { display: flex; align-items: center; gap: 12px; margin-top: 4px; }

/* Indicador financeiro na lista */
.fin-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c, #ccc); margin-right: 7px; vertical-align: middle; }

/* Ordenação por coluna */
.sort-link { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.sort-link:hover { color: var(--green-dark); text-decoration: none; }
.sort-arrow { color: var(--green); font-size: 10px; }

/* Resumo clínico (topo da ficha) */
.summary-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 20px; box-shadow: var(--shadow);
}
.sum-item { background: var(--white); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.sum-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); font-weight: 700; }
.sum-value { font-family: 'Montserrat'; font-weight: 700; font-size: 15px; color: var(--ink); }
.sum-value.link { color: var(--green-dark); }
.sum-sub { font-size: 11px; color: var(--ink-soft); }

/* ---------- Ficha do paciente ---------- */
.patient-head .patient-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 0; }
.meta-grid dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); }
.meta-grid dd { margin: 2px 0 0; font-weight: 700; }
.patient-head .notes { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-soft); white-space: pre-wrap; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
/* Ficha do paciente em 2 colunas (multi-coluna, empacota por altura) */
.ficha-grid { column-count: 2; column-gap: 22px; }
.ficha-grid > section { break-inside: avoid; }
.ficha-grid > .fw { column-span: all; }
@media (max-width: 1000px) { .ficha-grid { column-count: 1; } }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { border-left: 3px solid var(--line); padding: 10px 0 14px 14px; margin-left: 4px; }
.timeline-item.type-anamnese { border-left-color: var(--green); }
.timeline-item.type-evolucao { border-left-color: var(--warn); }
.timeline-item.type-anotacao { border-left-color: #9AA0A6; }
.timeline-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.timeline-title { font-family: 'Montserrat'; font-size: 14px; }
.timeline-content { margin: 6px 0 0; white-space: pre-wrap; }

/* ---------- Feedback semanal ---------- */
.fb-history { list-style: none; margin: 0; padding: 0; }
.fb-history > li { padding: 12px 2px; border-bottom: 1px solid var(--line-soft); }
.fb-history > li:last-child { border-bottom: 0; }
.fb-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fb-resp { margin: 6px 0 0; padding: 8px 12px; background: var(--green-soft); border-radius: var(--radius-sm); color: var(--ink); font-size: 13.5px; }

/* ---------- Lançar recebimentos em lote ---------- */
.rec-table .rec-val-h { text-align: right; width: 200px; }
.rec-table td.rec-val { text-align: right; }
.rec-amount {
  width: 140px; padding: 8px 11px; text-align: right; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font: inherit; background: var(--white); color: var(--ink);
}
.rec-bar {
  position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-top: 16px; padding: 14px 18px;
  background: color-mix(in srgb, var(--white) 92%, transparent); backdrop-filter: saturate(1.2) blur(8px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.rec-total-label { font-size: 15px; }
.rec-total-label strong { font-family: 'Montserrat', sans-serif; font-size: 19px; color: var(--green-dark); }

/* ---------- Tela de pacientes (lista) ---------- */
.search-field { position: relative; flex: 1; min-width: 220px; }
.search-field .sf-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-soft); pointer-events: none; }
.search-field input { width: 100%; padding-left: 34px; }
.list-count { color: var(--ink-soft); font-size: 13px; margin: 2px 0 12px; }
.list-count strong { color: var(--ink); font-family: 'Montserrat', sans-serif; }
.patient-cell { display: flex; align-items: center; gap: 11px; }
.patient-avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--green-soft); color: var(--green-dark);
  font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 12.5px; letter-spacing: .3px;
}
.patient-cell-name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.patient-cell-name .muted { font-size: 12px; }
tr.inactive .patient-avatar { opacity: .5; }
.patient-avatar.muted { background: var(--line); color: var(--ink-soft); }

/* ---------- Grid do dashboard (2 colunas) ---------- */
.dash-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px; align-items: start;
}
.dash-grid > section { margin-bottom: 0; }      /* o gap controla o espaçamento */
.dash-grid > .stats-grid { grid-column: 1 / -1; margin-bottom: 0; }  /* KPIs ocupam a largura toda */
@media (max-width: 520px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* ---------- Modo privado (ocultar valores, estilo app de banco) ---------- */
.priv { transition: filter .15s ease; }
[data-private="1"] .priv { filter: blur(8px); -webkit-filter: blur(8px); user-select: none; pointer-events: none; }
[data-private="1"] .priv-chart { filter: blur(7px); -webkit-filter: blur(7px); user-select: none; pointer-events: none; }
.icon-eye-off { display: none; }
[data-private="1"] #privacy-toggle .icon-eye { display: none; }
[data-private="1"] #privacy-toggle .icon-eye-off { display: inline; }
[data-private="1"] #privacy-toggle { color: var(--green-dark); border-color: var(--green); }

/* ---------- Banner de boas-vindas do dashboard ---------- */
.welcome-hero {
  position: relative; display: flex; align-items: flex-end;
  min-height: 440px; border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow-lg); margin-bottom: 22px; background: #1b241e;
}
.welcome-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 40%; display: block;
}
/* Conta sem foto própria: capa com gradiente da marca (não a foto de ninguém) */
.welcome-hero.no-photo {
  background: linear-gradient(135deg, #0f3b34 0%, #15695b 55%, #1c2b33 100%);
}
/* Personalização da área de início (aba Aparência) */
.brand-form .field, .brand-photo .field { display: block; margin-bottom: 12px; max-width: 520px; }
.brand-form .field > span, .brand-photo .field > span {
  display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 4px;
}
.brand-photo-preview {
  width: 100%; max-width: 520px; aspect-ratio: 16 / 6; border-radius: 12px;
  border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: var(--paper); margin-bottom: 12px;
}
.brand-photo-preview.has { border-style: solid; }
.brand-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.sep { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
/* Assinatura (Fase B) */
.sub-status { font-size: 15px; margin: 4px 0; }
.sub-status.ok, .sub-status.active { color: var(--green-dark); }
.sub-status.trial { color: #8A5A1E; }
.sub-status.danger { color: var(--danger); }
.sub-status.owner { color: var(--ink-soft); }
.plan-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.plan-card {
  flex: 1 1 200px; border: 1px solid var(--line); border-radius: 14px; padding: 20px;
  background: var(--paper); text-align: center;
}
.plan-card.featured { border-color: var(--green); box-shadow: 0 0 0 1px var(--green) inset; }
.plan-card h3 { margin: 0 0 6px; }
.plan-price { font-size: 30px; font-weight: 700; color: var(--ink); margin: 6px 0; }
.plan-price span { font-size: 14px; font-weight: 400; color: var(--ink-soft); }
.plan-save { color: var(--green-dark); font-size: 13px; margin: 0 0 12px; }
.plan-card form { margin-top: 10px; }
/* Banner de teste no dashboard */
.trial-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #FBF1E2; color: #8A5A1E; border: 1px solid #EEDCBF;
  border-radius: 10px; padding: 10px 16px; margin-bottom: 16px; font-size: 14px;
}
[data-theme="dark"] .trial-banner { background: rgba(215,162,78,.15); color: #E0B774; border-color: rgba(215,162,78,.32); }
/* Badges de status de assinatura (painel do operador) */
.sub-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); }
.sub-badge.active { background: var(--green-soft); color: var(--green-dark); border-color: #CADfCF; }
.sub-badge.trial { background: #FBF1E2; color: #8A5A1E; border-color: #EEDCBF; }
.sub-badge.trial_expired, .sub-badge.past_due, .sub-badge.canceled { background: #FBEAEA; color: var(--danger); border-color: #EBC9C8; }
.sub-badge.owner { background: var(--surface); color: var(--ink-soft); }
/* Showcase de serviços (página de assinatura) */
.benefits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 8px 0 12px; }
.benefit-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.benefit-card .ic { width: 22px; height: 22px; flex: none; color: var(--green); margin-top: 2px; }
.benefit-card strong { display: block; font-size: 14px; }
.benefit-card p { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }
/* Proposta de valor na capa do cadastro */
.login-cover-title { color: #fff; font-size: 26px; line-height: 1.2; margin: 8px 0 12px; max-width: 320px; }
.login-cover-list { list-style: none; padding: 0; margin: 0 0 14px; color: rgba(255,255,255,.92); }
.login-cover-list li { position: relative; padding-left: 22px; margin-bottom: 7px; font-size: 15px; }
.login-cover-list li::before { content: "✓"; position: absolute; left: 0; color: #6fe0b0; font-weight: 700; }
.login-cover-free { display: inline-block; background: rgba(255,255,255,.16); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.profile-initials { display: flex; align-items: center; justify-content: center; background: var(--green); color: #fff; font-size: 32px; font-weight: 700; }
.welcome-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(18,26,21,0) 38%, rgba(18,26,21,.20) 72%, rgba(18,26,21,.62) 100%),
    linear-gradient(90deg, rgba(18,26,21,.34) 0%, rgba(18,26,21,.05) 48%, transparent 72%);
}
.welcome-text {
  position: relative; z-index: 2; display: flex; flex-direction: column;
  padding: 30px 34px; color: #fff; max-width: 660px; text-shadow: 0 1px 3px rgba(0,0,0,.55), 0 2px 22px rgba(0,0,0,.5);
}
.welcome-eyebrow { font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: #cfe6d5; }
.welcome-text h2 { margin: 6px 0 0; font-size: 36px; font-weight: 700; letter-spacing: -.6px; line-height: 1.1; color: #fff; }
.welcome-date { margin: 5px 0 0; color: rgba(255,255,255,.86); font-size: 13.5px; text-transform: capitalize; }
.welcome-tagline { margin: 12px 0 18px; color: rgba(255,255,255,.92); font-size: 15px; }
.welcome-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.welcome-actions .btn:not(.primary) { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.42); color: #fff; backdrop-filter: blur(4px); }
.welcome-actions .btn:not(.primary):hover { background: rgba(255,255,255,.28); transform: translateY(-1px); }
.wave { display: inline-block; animation: wave 1.6s ease-in-out 1; transform-origin: 70% 70%; }
@keyframes wave { 0%,60%,100% { transform: rotate(0); } 15% { transform: rotate(16deg); } 30% { transform: rotate(-8deg); } 45% { transform: rotate(12deg); } }
@media (max-width: 680px) {
  .welcome-hero { min-height: 340px; }
  .welcome-text { padding: 22px 22px; max-width: 100%; }
  .welcome-text h2 { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) { .wave { animation: none; } }

/* ---------- Cabeçalho de perfil (Minha conta) ---------- */
.profile-header { display: flex; align-items: center; gap: 18px; max-width: 560px; }
.profile-photo {
  width: 84px; height: 84px; flex: 0 0 84px; border-radius: 50%;
  object-fit: cover; object-position: center 25%; border: 3px solid var(--green-soft);
}
.profile-info h2 { margin: 0 0 2px; font-size: 19px; }
.profile-info p { margin: 0; font-size: 13px; }
.profile-crn { color: var(--green-dark); font-weight: 700; margin-top: 3px !important; }

/* ---------- Login (capa em duas colunas) ---------- */
.login-body { margin: 0; }
.login-hero { display: grid; grid-template-columns: 1.15fr 0.85fr; min-height: 100vh; }
.login-cover {
  position: relative; background-size: cover; background-position: center 20%;
  background-repeat: no-repeat; min-height: 100vh;
}
.login-cover-text { position: absolute; left: 36px; bottom: 32px; right: 36px; }
.login-cover-tag {
  display: inline-block; color: #fff; font-family: 'Montserrat', sans-serif; font-weight: 700;
  font-size: 22px; letter-spacing: -.3px; text-shadow: 0 2px 14px rgba(0,0,0,.5); line-height: 1.25;
}
.login-panel {
  display: grid; place-items: center; padding: 32px;
  background: radial-gradient(900px 500px at 50% -10%, #34343a 0%, #2A2A28 55%, #232321 100%);
}
[data-theme="dark"] .login-panel { background: radial-gradient(900px 500px at 50% -10%, #26262c 0%, #1c1c20 60%, #161618 100%); }
.login-card {
  background: var(--white); border-radius: 20px; padding: 40px 36px; width: 100%; max-width: 380px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.06);
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo { width: 190px; max-width: 70%; height: auto; display: block; margin: 0 auto 6px; }
.login-brand p { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }
.login-card .btn.block { margin-top: 6px; padding: 11px 16px; font-size: 14px; }
.login-cover-switch { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 18px; }
.login-cover-switch a {
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px;
  border: 1px solid var(--line); color: var(--ink-soft); font-weight: 700; font-size: 12px; text-decoration: none;
}
.login-cover-switch a:hover { border-color: var(--green); color: var(--green-dark); }
.login-cover-switch a.on { background: var(--green); color: #fff; border-color: var(--green-dark); }
@media (max-width: 860px) {
  .login-hero { grid-template-columns: 1fr; }
  .login-cover { min-height: 34vh; background-position: center 25%; }
  .login-panel { min-height: 66vh; }
}

/* ---------- WhatsApp link ---------- */
.wa-link {
  display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 700;
  color: #fff; background: #25D366; padding: 1px 8px; border-radius: 999px; text-decoration: none;
}
.wa-link:hover { background: #1da851; text-decoration: none; }

/* ---------- Kanban ---------- */
.kanban {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: start;
  margin-bottom: 14px;
}
.kanban-col {
  background: #F1EEE7; border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 120px;
}
.kanban-col-head {
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'Montserrat'; font-weight: 600; font-size: 13px; color: var(--ink);
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.kanban-count {
  background: var(--green); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 1px 8px; min-width: 22px; text-align: center;
}
.kanban-list { padding: 10px; display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 60px; }
.kanban-card {
  background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--green);
  border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow); cursor: grab;
  display: flex; flex-direction: column; gap: 6px;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card-name { font-weight: 700; color: var(--ink); text-decoration: none; }
.kanban-card-name:hover { color: var(--green-dark); }
.kanban-next { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; }
.kanban-next-label { color: var(--ink-soft); }
.kanban-ghost { opacity: .45; border-left-color: var(--warn); background: var(--green-soft); }

/* ---------- Formulários / protocolos ---------- */
.field-list { list-style: none; margin: 0; padding: 0; }
.field-row { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.field-row:last-child { border-bottom: none; }
.field-main { display: flex; align-items: flex-start; gap: 12px; }
.field-pos { flex: 0 0 24px; height: 24px; border-radius: 7px; background: var(--green-soft);
  color: var(--green-dark); font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.field-actions { display: inline-flex; gap: 6px; align-items: center; }
.field-actions .link { font-size: 16px; line-height: 1; padding: 0 3px; }
.field-edit { grid-column: 1 / -1; }
.field-edit summary { cursor: pointer; color: var(--green-dark); font-size: 12.5px; font-weight: 700; width: max-content; }
.field-edit[open] summary { margin-bottom: 8px; }
.req { color: var(--danger); }

.fill-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.fill-date { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.fill-date input { width: auto; }
.fill-section { font-family: 'Montserrat'; font-weight: 700; font-size: 14px; color: var(--green-dark); text-transform: uppercase; letter-spacing: .4px; margin: 22px 0 2px; padding-bottom: 6px; border-bottom: 2px solid var(--green-soft); }
.fill-field { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.fill-field:last-of-type { border-bottom: none; }
.fill-label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.fill-help { margin-bottom: 6px; }
.check-group { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.scale-group { display: inline-flex; gap: 6px; }
.scale-opt { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 700; }
.scale-opt:hover { border-color: var(--green); background: var(--green-soft); }
.proto-select { max-width: 280px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--white); }

.answer-list { margin: 0; }
.answer { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.answer:last-child { border-bottom: none; }
.answer dt { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); font-weight: 700; }
.answer dd { margin: 3px 0 0; white-space: pre-wrap; }

/* ---------- Evolução fotográfica ---------- */
.photo-row { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.photo-row:last-child { border-bottom: none; }
.photo-date { font-family: 'Montserrat'; font-weight: 600; font-size: 13px; color: var(--green-dark); margin-bottom: 8px; }
.photo-set { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.photo-cell { margin: 0; text-align: center; position: relative; }
.photo-cell img { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #faf8f3; }
.photo-cell figcaption { font-size: 11.5px; color: var(--ink-soft); margin-top: 4px; }
.photo-empty { height: 150px; border-radius: 8px; border: 1px dashed var(--line); display: grid; place-items: center; color: #bbb; background: #faf8f3; }
.photo-del { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.85); border-radius: 6px; padding: 0 4px; }
@media (max-width: 700px) { .photo-set { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Plano alimentar (editor) ---------- */
.meta-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.meal-time { font-family: 'Montserrat'; color: var(--green-dark); }
.meal-subtotal { font-size: 12.5px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 10px; }
.add-item-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.qty-input { width: 70px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.measure-input { width: 150px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.food-picker { position: relative; flex: 1; min-width: 220px; }
.food-search { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.food-results {
  position: absolute; z-index: 20; left: 0; right: 0; top: 100%;
  background: var(--white); border: 1px solid var(--line); border-radius: 0 0 8px 8px;
  max-height: 260px; overflow-y: auto; box-shadow: var(--shadow);
}
.food-result { padding: 8px 10px; cursor: pointer; font-size: 13px; border-bottom: 1px solid var(--line); }
.food-result:last-child { border-bottom: none; }
.food-result:hover { background: var(--green-soft); }
.meal .card-header h2 { font-size: 15px; }
.meal-alt { border-left: 4px solid var(--gold); margin-left: 18px; background: #FCFAF6; }
.alt-badge { background: var(--gold); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 5px; vertical-align: middle; letter-spacing: .5px; }
.meal-notes { background: var(--green-soft); border-left: 3px solid var(--green); padding: 8px 12px; border-radius: 6px; font-size: 13px; color: var(--ink-soft); margin: 0 0 10px; }
.meal-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.meal-tools details summary { cursor: pointer; color: var(--green-dark); font-size: 12.5px; font-weight: 700; }
.analysis-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.analysis-data { flex: 1; min-width: 240px; }

/* ---------- Antropometria: resultados ---------- */
.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.result { background: #FCFBF8; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.r-label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); }
.r-value { font-family: 'Montserrat'; font-weight: 700; font-size: 18px; color: var(--green-dark); }
.r-sub { font-size: 11.5px; color: var(--ink-soft); }

/* Comparativo de avaliações */
.compare-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #FCFBF8; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 16px; }
.compare-title { font-size: 12px; color: var(--ink-soft); margin-right: 4px; }
.delta { font-weight: 700; font-size: 12.5px; padding: 2px 9px; border-radius: 999px; }
.delta.good { background: var(--green-soft); color: var(--green-dark); }
.delta.bad { background: #FBEAEA; color: var(--danger); }
.delta.flat { background: #ECECEC; color: #777; }

/* ---------- Dashboard / widgets ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box.small { height: 220px; }
.chart-box.tall { height: 360px; }
.spark { position: relative; height: 34px; margin-top: 10px; }
.layout-list { list-style: none; margin: 0 0 14px; padding: 0; }
.layout-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.layout-list li:last-child { border-bottom: none; }
.layout-move { display: inline-flex; gap: 2px; }
.layout-move .link { font-size: 16px; line-height: 1; padding: 0 4px; }

.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.task-list li:last-child { border-bottom: none; }
.task-list li.done .task-title { text-decoration: line-through; color: var(--ink-soft); }
.task-check { background: none; border: none; cursor: pointer; font-size: 18px; line-height: 1; color: var(--green); padding: 0; }
.task-title { flex: 0 1 auto; }

/* ---------- Financeiro ---------- */
.stat-value.entrada, td.entrada { color: var(--green-dark); }
.stat-value.saida, td.saida { color: var(--danger); }
.entrada-badge { background: var(--green-soft); color: var(--green-dark); }
.saida-badge { background: #FBEAEA; color: var(--danger); }
.alert-card { border-left: 4px solid var(--danger); }
.alert-card h2 { color: var(--danger); }

/* ---------- Agenda / FullCalendar ---------- */
#calendar { font-family: 'Lato', sans-serif; font-size: 14px; }
.fc .fc-toolbar-title { font-family: 'Montserrat'; font-size: 18px; color: var(--ink); }
.fc .fc-button-primary {
  background: var(--green); border-color: var(--green); font-family: 'Montserrat';
  font-weight: 600; font-size: 12.5px; text-transform: none;
}
.fc .fc-button-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--ink); border-color: var(--ink); }
.fc-event { cursor: pointer; font-size: 12px; border-width: 2px; }
.fc .fc-daygrid-day.fc-day-today { background: var(--green-soft); }

.legend { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0; }
.legend-title { font-family: 'Montserrat'; font-size: 12.5px; color: var(--ink-soft); margin-right: 4px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; }
.legend-swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legend-swatch.border { background: transparent; border: 3px solid #ccc; }

/* ---------- Carreira & gestão ---------- */
.nav-sep {
  margin: 12px 6px 3px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,.08);
}
.nav-sep.first { margin-top: 2px; padding-top: 0; border-top: 0; }
.nav-sep span {
  font-family: 'Montserrat', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: #8C877D;
}
.goal-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px; margin-top: 16px;
}
.goal-card {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 15px; background: var(--white); display: flex; flex-direction: column; gap: 7px;
}
.goal-card.done { background: var(--green-soft); border-color: #CADfCF; }
.goal-card.done h3 { text-decoration: line-through; color: var(--ink-soft); }
.goal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.goal-top h3 { font-family: 'Montserrat', sans-serif; font-size: 14.5px; margin: 0; line-height: 1.3; }
.goal-numbers { margin: 0; font-size: 15px; }
.goal-numbers strong { font-family: 'Montserrat', sans-serif; color: var(--green-dark); font-size: 18px; }
.goal-notes { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); white-space: pre-wrap; }
.goal-edit { margin-top: 4px; }
.goal-edit summary { cursor: pointer; }
.goal-edit .form { margin-top: 10px; }
.progress {
  height: 8px; background: var(--line-soft); border-radius: 99px; overflow: hidden;
}
.progress-bar {
  height: 100%; background: linear-gradient(90deg, #5B9069, var(--green-dark)); border-radius: 99px;
}
#project-board .kanban-card-name { font-family: 'Montserrat', sans-serif; font-weight: 700; color: var(--ink); }
#project-board .kanban-card { cursor: grab; }
.small { font-size: 12px; }
/* ---------- Confirmar consultas ---------- */
.confirm-list { list-style: none; margin: 0; padding: 0; }
.confirm-day {
  background: #FAF8F3; padding: 9px 16px; font-family: 'Montserrat', sans-serif;
  font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-soft); border-bottom: 1px solid var(--line-soft);
}
.confirm-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.confirm-row:last-child { border-bottom: 0; }
.confirm-time { font-family: 'Montserrat', sans-serif; font-weight: 700; color: var(--ink); min-width: 56px; }
.confirm-time.atraso { color: var(--danger); }

/* Agenda — grade semanal */
.week-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.week-range { font-family: 'Montserrat', sans-serif; font-weight: 700; color: var(--ink); margin-left: auto; }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.week-day { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-height: 150px; }
.week-day.today { border-color: var(--green); box-shadow: 0 0 0 2px rgba(74,124,89,.18); }
.week-day-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 8px; border-bottom: 1px solid var(--line-soft); margin-bottom: 8px; }
.wd-name { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); }
.wd-num { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 16px; color: var(--ink); }
.week-day.today .wd-num { color: var(--green-dark); }
.wd-add { margin-left: auto; width: 21px; height: 21px; border-radius: 6px; display: grid; place-items: center; color: var(--green-dark); background: var(--green-soft); font-weight: 700; line-height: 1; }
.wd-add:hover { background: var(--green); color: #fff; }
.week-appt { display: flex; flex-direction: column; gap: 1px; padding: 7px 9px; border-radius: 8px; border-left: 3px solid var(--green); margin-bottom: 7px; color: var(--ink); transition: filter .12s; }
.week-appt:hover { filter: brightness(.96); }
.week-appt.is-cancel { opacity: .55; text-decoration: line-through; }
.wk-time { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 12px; }
.wk-pac { font-size: 13px; font-weight: 600; }
.wk-type { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.week-empty { text-align: center; color: var(--line); margin: 16px 0; }
.legend-card { margin-top: 16px; }
@media (max-width: 900px) { .week-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .week-grid { grid-template-columns: 1fr; } }
.confirm-pac { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.confirm-actions { display: flex; align-items: center; gap: 8px; }
.wa-row.sent { opacity: .5; }
.wa-row.sent .wa-go { background: var(--ink-soft); border-color: var(--ink-soft); color: #fff; }
@media (max-width: 720px) {
  .confirm-row { flex-wrap: wrap; }
  .confirm-actions { width: 100%; }
}

/* ---------- Comparador de fotos ---------- */
.cmp-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.cmp-controls select { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--white); color: var(--ink); }
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cmp-col { display: flex; flex-direction: column; gap: 8px; }
.cmp-head { display: flex; align-items: center; gap: 8px; }
.cmp-tag {
  font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 11px; letter-spacing: .5px;
  text-transform: uppercase; padding: 2px 9px; border-radius: 99px;
  background: var(--green-soft); color: var(--green-dark);
}
.cmp-tag.depois { background: color-mix(in srgb, var(--gold) 18%, white); color: #8A5A1E; }
.cmp-date { flex: 1; padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--white); color: var(--ink); }
.cmp-frame {
  background: #0d0d0f; border: 1px solid var(--line); border-radius: var(--radius);
  display: grid; place-items: center; min-height: 280px; overflow: hidden;
}
.cmp-frame img { width: 100%; height: auto; max-height: 560px; object-fit: contain; display: block; }
@media (max-width: 640px) { .cmp-grid { grid-template-columns: 1fr; } }

/* ---------- Modelos de mensagem ---------- */
.msg-list { list-style: none; margin: 0; padding: 0; }
.msg-item { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.msg-item:last-child { border-bottom: 0; }
.msg-top { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.msg-top strong { font-family: 'Montserrat', sans-serif; font-size: 14.5px; }
.msg-body { margin: 0; color: var(--ink-soft); white-space: pre-wrap; font-size: 13.5px; }
.msg-quick { display: flex; flex-direction: column; gap: 10px; }
.msg-quick select, .msg-quick textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font: inherit; background: var(--white); color: var(--ink);
}
.msg-quick textarea { resize: vertical; }
.msg-quick select:focus, .msg-quick textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(74,124,89,.16); }
.msg-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Toast de feedback ---------- */
.toast-root {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 220px; max-width: 360px; padding: 12px 16px;
  background: var(--ink); color: #fff; border-radius: 10px;
  box-shadow: 0 8px 28px rgba(44,44,44,.28);
  font-size: 14px; font-weight: 600;
  opacity: 0; transform: translateY(10px) scale(.98);
  transition: opacity .22s ease, transform .22s ease;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-icon {
  width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center;
  border-radius: 50%; font-size: 13px; font-weight: 700; color: #fff;
}
.toast-ok .toast-icon { background: var(--green); }
.toast-err { background: #7d2c2a; }
.toast-err .toast-icon { background: var(--danger); }

/* ---------- Micro-polish ---------- */
.card { transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease; }
.card:hover { box-shadow: 0 4px 18px rgba(44,44,44,.09); }
.btn { transition: background .15s, border-color .15s, box-shadow .15s, transform .04s; }
.btn:active { transform: translateY(1px); }
.stat { transition: box-shadow .18s ease, transform .18s ease; }
.stat:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(44,44,44,.10); }
.table tbody tr { transition: background .12s ease; }
@media (prefers-reduced-motion: reduce) {
  .card, .btn, .stat, .toast, .table tbody tr { transition: none; }
}

/* ---------- Onboarding (primeiros passos) ---------- */
.onboarding { border-left: 4px solid var(--green); }
.onboard-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.onboard-list li { display: flex; align-items: center; gap: 11px; padding: 9px 4px; border-bottom: 1px solid var(--line-soft); }
.onboard-list li:last-child { border-bottom: 0; }
.onboard-list .ob-check {
  width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center;
  border-radius: 50%; font-size: 12px; font-weight: 700;
  background: var(--paper); color: var(--ink-soft); border: 1px solid var(--line);
}
.onboard-list li.done .ob-check { background: var(--green); color: #fff; border-color: var(--green-dark); }
.onboard-list .ob-label { font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 14px; color: var(--green-dark); }
.onboard-list li.done .ob-label { color: var(--ink-soft); text-decoration: line-through; }
.onboard-list .ob-go { margin-left: auto; color: var(--green); font-weight: 700; }

/* aniversariantes com ação de WhatsApp */
.bday-today { display: flex; flex-direction: column; gap: 8px; margin: 0 0 6px; }
.bday-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Estado vazio (com ícone) ---------- */
.empty-state .empty-ic { width: 46px; height: 46px; color: var(--green); opacity: .5; margin-bottom: 6px; }
.empty-state h3 { margin: 0 0 6px; font-size: 17px; }
.empty-state p { margin: 0 auto 16px; max-width: 420px; }

/* ---------- Sub-navegação da ficha do paciente ---------- */
.patient-subnav {
  position: sticky; top: 57px; z-index: 15;
  display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 9px 0; margin: -6px 0 16px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.patient-subnav .psub {
  flex: 0 0 auto; padding: 6px 13px; border-radius: 999px;
  font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 12.5px;
  color: var(--ink-soft); background: var(--white); border: 1px solid var(--line);
  text-decoration: none; transition: background .15s, color .15s, border-color .15s;
}
.patient-subnav .psub:hover { color: var(--green-dark); border-color: var(--green); text-decoration: none; }
.patient-subnav .psub.on { background: var(--green); color: #fff; border-color: var(--green-dark); }
#resumo, .page .card[id] { scroll-margin-top: 116px; }

/* ---------- Busca global (topbar) ---------- */
.global-search { position: relative; flex: 1; max-width: 360px; }
.global-search .gs-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-soft); pointer-events: none; }
#gs-input {
  width: 100%; padding: 9px 34px 9px 34px; border: 1px solid var(--line);
  border-radius: 999px; font: inherit; font-size: 14px; background: var(--white); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
#gs-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(74,124,89,.16); }
.gs-kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: 'Lato', sans-serif; font-size: 11px; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--paper);
}
#gs-input:focus ~ .gs-kbd { opacity: 0; }
.gs-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); overflow: hidden; max-height: 360px; overflow-y: auto;
}
.gs-item { display: flex; flex-direction: column; gap: 1px; padding: 9px 13px; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.gs-item:last-child { border-bottom: 0; }
.gs-item:hover, .gs-item.on { background: var(--green-soft); }
.gs-type { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--green-dark); }
.gs-name { font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 14px; color: var(--ink); }
.gs-sub { font-size: 12px; color: var(--ink-soft); }
.gs-empty { padding: 12px 13px; color: var(--ink-soft); font-size: 13px; }

.report-form { display: inline-flex; align-items: center; gap: 8px; }
.report-form input[type=month] { padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--white); color: var(--ink); }

/* badge de meta automática */
.badge.auto {
  display: inline-block; align-self: flex-start; font-size: 10.5px; font-weight: 700;
  letter-spacing: .3px; padding: 2px 8px; border-radius: 99px;
  background: var(--green-soft); color: var(--green-dark); border: 1px solid #CADfCF;
}
.progress.mini { height: 5px; flex: 1; }
.done-history { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.done-history > summary { cursor: pointer; font-weight: 700; }
.done-history .goal-grid { margin-top: 14px; }

/* checklist (marcos) dos projetos */
.proj-tasks { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.proj-tasks-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.proj-task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.proj-task-list li { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.proj-task-list li.done .proj-task-title { text-decoration: line-through; color: var(--ink-soft); }
.proj-task-title { flex: 1; }
.task-check.sm { font-size: 15px; }
.proj-add { margin-top: 8px; }
.proj-add input { width: 100%; padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--white); }
.proj-add input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(74,124,89,.16); }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .kanban { grid-template-columns: repeat(2, 1fr); }
}
/* Hambúrguer (só aparece em telas pequenas) + backdrop da gaveta */
.menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 9px;
  border: 1px solid var(--line); background: var(--white); color: var(--ink); cursor: pointer;
}
.menu-toggle:hover { background: var(--green-soft); color: var(--green-dark); }
.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(20,20,24,.5); z-index: 150;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

@media (max-width: 900px) {
  .two-col, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .layout { display: block; }
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; width: 264px; z-index: 200;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.45); }
  .page { padding: 22px 18px; }
  .topbar { padding: 12px 16px; }
}
@media (min-width: 901px) { .sidebar-backdrop { display: none; } }

/* ==========================================================================
   Botão de alternar tema (na sidebar)
   ========================================================================== */
.footer-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid rgba(255,255,255,.14); color: #BDB8AE;
  border-radius: 8px; padding: 4px 7px; cursor: pointer; line-height: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.theme-toggle:hover { color: #fff; background: rgba(255,255,255,.08); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .ic-sun { display: none; }
[data-theme="dark"] .theme-toggle .ic-moon { display: none; }
[data-theme="dark"] .theme-toggle .ic-sun { display: inline; }

/* ==========================================================================
   Tema escuro — sobrescreve as variáveis e as poucas cores fixas
   ========================================================================== */
:root[data-theme="dark"] {
  --paper: #16161A;
  --white: #202026;
  --ink: #E7E6E2;
  --ink-soft: #9D9C97;
  --line: #34343C;
  --line-soft: #292930;
  --green: #5E9A72;
  --green-dark: #79C08F;     /* links/realces positivos: mais claro no escuro */
  --green-soft: #1E2B23;
  --danger: #E2756F;
  --warn: #D7A24E;
  --gold: #D7A24E;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 12px rgba(0,0,0,.45);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* superfícies/realces que estavam fixos (não vinham de variáveis) */
[data-theme="dark"] body { background: var(--paper); }
[data-theme="dark"] .topbar { background: rgba(22,22,26,.86); }
[data-theme="dark"] .btn.primary,
[data-theme="dark"] .btn.primary:hover { background: linear-gradient(135deg, #4A7C59, #3C6649); }
[data-theme="dark"] .btn:hover { background: rgba(255,255,255,.06); border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .btn.ghost:hover { background: rgba(255,255,255,.06); }
[data-theme="dark"] .list li:hover,
[data-theme="dark"] .table th,
[data-theme="dark"] .table tbody tr:hover,
[data-theme="dark"] .confirm-day { background: rgba(255,255,255,.045); }
[data-theme="dark"] .form.bordered,
[data-theme="dark"] .result,
[data-theme="dark"] .compare-strip,
[data-theme="dark"] .meal-alt { background: rgba(255,255,255,.03); }
[data-theme="dark"] .kanban-col { background: #1B1B20; }
[data-theme="dark"] .badge.type { background: #34343B; color: var(--ink); }
[data-theme="dark"] .muted-badge,
[data-theme="dark"] .delta.flat { background: #31313A; color: #ABABA3; }
[data-theme="dark"] .alert.error,
[data-theme="dark"] .btn.danger:hover,
[data-theme="dark"] .delta.bad,
[data-theme="dark"] .saida-badge { background: rgba(226,117,111,.15); border-color: rgba(226,117,111,.32); }
[data-theme="dark"] .alert.warn { background: rgba(215,162,78,.15); color: #E0B774; border-color: rgba(215,162,78,.32); }
[data-theme="dark"] .alert.success,
[data-theme="dark"] .alert.info { border-color: rgba(121,192,143,.32); }
[data-theme="dark"] .badge.auto { border-color: rgba(121,192,143,.32); }
[data-theme="dark"] .toast { background: #2A2A33; }
[data-theme="dark"] .gs-kbd { background: #2A2A33; }
[data-theme="dark"] .chip { background: color-mix(in srgb, var(--c, var(--green)) 24%, var(--white)); }
[data-theme="dark"] .empty-state .empty-ic { opacity: .42; }

/* ==========================================================================
   Polimento visual & interativo
   ========================================================================== */
html { scroll-behavior: smooth; }

/* fade suave ao carregar/trocar de página (só opacidade — não quebra o sticky) */
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
.page { animation: pageIn .26s ease both; }

/* scrollbar discreta combinando com a paleta (adapta ao tema via variáveis) */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-soft); background-clip: padding-box; }

/* menu lateral: leve deslize + ícone ao passar o mouse */
.nav a { transition: background .15s, color .15s, transform .12s; }
.nav a:hover { transform: translateX(2px); }
.nav a:hover .ic { transform: scale(1.08); }
.nav a .ic { transition: transform .12s, opacity .15s; }

/* zebra sutil + cabeçalho destacado nas tabelas */
.table tbody tr:nth-child(2n) td { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.table tbody tr:hover td { background: var(--green-soft); }

/* foco visível consistente nos campos de filtro/period */
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(74,124,89,.16); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .page { animation: none; }
  .nav a:hover, .nav a:hover .ic { transform: none; }
}

/* ---------- Refino 2: campos, botões e títulos ---------- */
/* foco/transição unificados em TODOS os campos do app */
input:not([type=checkbox]):not([type=radio]):not([type=file]),
select, textarea {
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:not([type=checkbox]):not([type=radio]):not([type=file]):focus,
select:focus, textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(74,124,89,.16);
}

/* botões: leve elevação no hover, afunda no clique */
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }

/* títulos um pouco mais refinados */
.topbar h1 { letter-spacing: -.3px; }
.card-header h2, .card h2 { letter-spacing: -.2px; }

@media (prefers-reduced-motion: reduce) {
  .btn:hover, .btn:active { transform: none; }
}

/* ============================================================
   Interface & interatividade (ui.js)
   ============================================================ */

/* Barra de progresso no topo (navegação) */
.nprogress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, #5B9069, var(--green-dark));
  box-shadow: 0 0 8px rgba(74,124,89,.6); z-index: 9999; opacity: 0;
}

/* Overlay genérico (modal de confirmação, ajuda, paleta) */
.ui-overlay {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(28,28,32,.42); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .17s ease;
}
.ui-overlay.show { opacity: 1; pointer-events: auto; }

.ui-modal {
  background: var(--white); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 24px; width: min(92vw, 420px);
  text-align: center; transform: translateY(8px) scale(.98);
  transition: transform .17s ease;
}
.ui-overlay.show .ui-modal { transform: translateY(0) scale(1); }
.ui-modal-msg { font-size: 15px; margin: 4px 0 20px; line-height: 1.5; }
.ui-modal h3 { font-family: 'Montserrat'; font-size: 16px; }
.ui-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.kbd-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.kbd-row span { color: var(--ink-soft); font-size: 13.5px; }
kbd {
  font-family: 'Montserrat', monospace; font-size: 11px; font-weight: 700;
  background: var(--green-soft); color: var(--green-dark);
  border: 1px solid #CADfCF; border-radius: 6px; padding: 2px 7px; line-height: 1.4;
}

/* Paleta de comandos (Ctrl/Cmd+K) */
.cmdk-overlay { align-items: flex-start; }
.cmdk {
  margin-top: 11vh; width: min(94vw, 560px);
  background: var(--white); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden;
  transform: translateY(-8px); transition: transform .17s ease;
}
.cmdk-overlay.show .cmdk { transform: translateY(0); }
#cmdk-input {
  width: 100%; border: 0; border-bottom: 1px solid var(--line);
  padding: 16px 18px; font: inherit; font-size: 16px; background: transparent; color: var(--ink);
}
#cmdk-input:focus { outline: none; box-shadow: none; }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 9px; color: var(--ink); cursor: pointer;
}
.cmdk-item .ic-sm { color: var(--green); flex: 0 0 auto; }
.cmdk-item.on { background: var(--green-soft); color: var(--green-dark); }
.cmdk-item.on .ic-sm { color: var(--green-dark); }
.cmdk-sub { margin-left: auto; font-size: 11.5px; color: var(--ink-soft); }
.cmdk-empty { padding: 22px; text-align: center; color: var(--ink-soft); font-size: 14px; }
.cmdk-foot {
  display: flex; gap: 12px; align-items: center; justify-content: flex-end;
  padding: 8px 14px; border-top: 1px solid var(--line-soft);
  background: #FAF8F3; font-size: 11px; color: var(--ink-soft);
}
[data-theme="dark"] .cmdk-foot { background: rgba(255,255,255,.03); }

/* Tooltip de ajuda (data-tip) */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px);
  transform: translateX(-50%); white-space: nowrap; z-index: 50;
  background: var(--ink); color: #fff; font-size: 11.5px; font-weight: 500;
  padding: 5px 9px; border-radius: 7px; box-shadow: var(--shadow); pointer-events: none;
}
[data-tip]:hover::before {
  content: ""; position: absolute; left: 50%; bottom: calc(100% + 3px);
  transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--ink); z-index: 50;
}

/* Linha de tabela inteira clicável */
tr.row-link { cursor: pointer; }
tr.row-link:hover { background: var(--green-soft); }
[data-theme="dark"] tr.row-link:hover { background: rgba(255,255,255,.045); }

/* Chips de filtro (links que aplicam filtro) */
.chip-filters { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip-filter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  border: 1px solid var(--line); background: var(--white); color: var(--ink-soft);
  cursor: pointer; transition: all .12s;
}
.chip-filter:hover { border-color: var(--green); color: var(--green-dark); }
.chip-filter.on { background: var(--green); border-color: var(--green); color: #fff; }
.chip-filter.on:hover { color: #fff; }

/* Modal com formulário (cadastro rápido) */
.ui-modal.modal-form { text-align: left; width: min(94vw, 460px); }
.ui-modal.modal-form h3 { font-family: 'Montserrat'; font-size: 16px; margin: 0; }
.modal-body { margin-top: 14px; }
.modal-body label { margin-bottom: 14px; }
.modal-body .ui-modal-actions { margin-top: 4px; }
.modal-hint { margin-top: 10px; margin-bottom: 0; }

/* ============================================================
   Painel de Gestão (/gestao)
   ============================================================ */
.section-title {
  font-family: 'Montserrat'; font-size: 12.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .7px; color: var(--ink-soft);
  margin: 26px 0 12px;
}
.section-title:first-of-type { margin-top: 6px; }
.gestao-period { margin: 0 0 4px; }
.meta-card { padding: 16px 18px; }
.meta-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.meta-nums { font-family: 'Montserrat', sans-serif; font-size: 15px; }
.meta-nums .entrada { color: var(--green-dark); }
.meta-card .pbar { height: 12px; }
.meta-card .pbar > span.batida { background: linear-gradient(90deg, #5B9069, #C9893B); }
.meta-card.batida { border-color: #E2C089; box-shadow: 0 0 0 2px rgba(201,137,59,.18); }
.meta-foot { margin: 8px 0 0; }
.list.breakdown li { justify-content: space-between; }
.list.breakdown .badge { font-family: 'Montserrat'; font-weight: 700; }
.badge.entrada { background: var(--green-soft); color: var(--green-dark); }
.badge.saida { background: #FBEAEA; color: var(--danger); }
.gestao-note {
  margin-top: 20px; padding: 12px 15px; line-height: 1.55;
  background: var(--green-soft); color: var(--green-dark);
  border: 1px solid #CADfCF; border-radius: 10px;
}

/* Despesas fixas — card de situação/lançamento do mês */
.lancar-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.lancar-info { display: flex; flex-direction: column; gap: 2px; }
.lancar-info .stat-value { font-size: 24px; }
.lancar-info p { margin: 4px 0 0; }

/* ============================================================
   Organização (/organizacao)
   ============================================================ */
.add-block { margin-bottom: 16px; }
.add-block > summary { display: inline-flex; align-items: center; gap: 6px; list-style: none; cursor: pointer; }
.add-block > summary::-webkit-details-marker { display: none; }

/* Barra de progresso genérica */
.pbar { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 8px 0 4px; }
.pbar.sm { height: 5px; margin: 6px 0 2px; }
.pbar > span { display: block; height: 100%; background: linear-gradient(90deg, #5B9069, var(--green-dark)); border-radius: 6px; }

/* Metas — projeção por horizonte */
.horizon-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.horizon-chip {
  display: flex; flex-direction: column; align-items: center; min-width: 96px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--white);
}
.horizon-chip strong { font-family: 'Montserrat'; font-size: 22px; color: var(--ink); }
.horizon-chip span { font-size: 11px; color: var(--ink-soft); text-align: center; }
.horizon-chip.danger { border-color: #EBC9C8; background: #FBEAEA; }
.horizon-chip.danger strong { color: var(--danger); }

.goal-cat { margin: 18px 0 8px; }
.goal-item { border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: #FCFBF8; }
[data-theme="dark"] .goal-item { background: rgba(255,255,255,.03); }
.goal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.goal-title { font-weight: 700; color: var(--ink); }
.goal-actions { display: inline-flex; gap: 10px; }
.badge.goal-horizon { background: var(--green-soft); color: var(--green-dark); }
.badge.goal-horizon.h-atrasada { background: #FBEAEA; color: var(--danger); }
.goal-meta { margin-top: 2px; }
.milestones { list-style: none; margin: 10px 0 6px; padding: 0; }
.milestones li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.milestones li.done .ms-title { text-decoration: line-through; color: var(--ink-soft); }
.ms-check { background: none; border: 0; cursor: pointer; font-size: 16px; color: var(--green-dark); padding: 0; }
.ms-add input { width: 100%; max-width: 320px; padding: 6px 10px; border: 1px dashed var(--line); border-radius: 7px; font: inherit; font-size: 13px; }
.done-block { margin-top: 14px; }
.done-text { text-decoration: line-through; color: var(--ink-soft); }

/* Estudos — quadro */
.study-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 6px; }
@media (max-width: 800px) { .study-board { grid-template-columns: 1fr; } }
.study-col { background: #FAF8F3; border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px; }
[data-theme="dark"] .study-col { background: rgba(255,255,255,.03); }
.study-col-head { font-family: 'Montserrat'; font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); padding: 2px 4px 10px; }
.study-card { background: var(--white); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-bottom: 9px; box-shadow: var(--shadow); }
.study-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.study-title { font-weight: 700; font-size: 13.5px; }
.study-move { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: 12px; }
.study-empty { text-align: center; padding: 8px; }

/* Hábitos */
.habit-list { list-style: none; margin: 14px 0 6px; padding: 0; }
.habit-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.habit-check {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--line); background: var(--white); color: #fff; font-size: 15px; font-weight: 700;
  display: grid; place-items: center; transition: all .12s;
}
.habit-check.on { background: var(--green); border-color: var(--green); }
.habit-name { font-weight: 700; color: var(--ink); }
.habit-streak { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.habit-streak.hot { color: #C9893B; }
.habit-week { display: inline-flex; gap: 4px; }
.hw-dot { width: 13px; height: 13px; border-radius: 4px; background: var(--line); }
.hw-dot.on { background: var(--green); }
.habit-actions { display: inline-flex; gap: 10px; }

/* Prioridade nas tarefas */
.prio-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; background: var(--c, var(--line)); }

/* Navegação: rolagem suave + âncoras não ficam sob os cabeçalhos fixos */
html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 100px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Botão "voltar ao topo" */
.to-top {
  position: fixed; right: 22px; bottom: 22px; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--white); color: var(--green-dark);
  font-size: 20px; font-weight: 700; box-shadow: var(--shadow-lg); cursor: pointer;
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .2s, transform .2s, background .15s; z-index: 60;
}
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { background: var(--green); color: #fff; }
@media print { .to-top { display: none; } }

/* Acompanhamento periódico (ficha) */
.fu-add { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fu-add select { flex: 1 1 240px; }
.fu-every { color: var(--ink-soft, #555); font-size: 14px; white-space: nowrap; }
.fu-every input { width: 64px; }
.fu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.fu-item { border: 1px solid var(--border, #ececec); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.fu-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fu-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.fu-score { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 22px; color: var(--green-dark); }
.fu-chart { width: 100% !important; height: 58px; }
.fu-empty { margin: 2px 0; }
.fu-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }

/* Marca Zentro (logotipo wordmark — o "o" final é o alvo/hub) */
.brand-zentro, .login-zentro {
  display: inline-flex; align-items: center;
  font-family: 'Montserrat', sans-serif; font-weight: 800;
  letter-spacing: -.5px; line-height: 1; text-decoration: none;
}
.brand-zentro { font-size: 30px; color: #F4F1EA; }     /* sidebar (fundo escuro) */
.login-zentro { font-size: 42px; color: #12A594; }     /* card claro do login */
.bz-dot { width: .7em; height: .7em; margin-left: .015em; display: inline-block; color: #F2A541; }
.bz-life { color: #F2A541; font-weight: 600; margin-left: .16em; letter-spacing: -.3px; }

/* Ranking (origem dos pacientes / indicadores) */
.rank-list { list-style: none; margin: 10px 0 0; padding: 0; }
.rank-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border, #ececec); }
.rank-list li:last-child { border-bottom: none; }
.rank-name { font-weight: 600; }
.rank-val { white-space: nowrap; color: var(--ink-soft, #555); }

/* Widget de Notificações (dashboard) */
.notif-card .notif-count { display:inline-flex; align-items:center; justify-content:center; min-width:22px; height:22px; padding:0 6px; margin-left:8px; border-radius:11px; background:var(--green); color:#fff; font-size:12px; font-weight:700; vertical-align:middle; }
.notif-sub { font-family:'Montserrat',sans-serif; font-weight:700; font-size:12px; text-transform:uppercase; letter-spacing:.4px; color:var(--ink-soft,#6b6b6b); margin:14px 0 4px; }
.notif-sub:first-of-type { margin-top:2px; }
.notif-empty { padding:6px 0; }

/* Sinalizador de retorno pendente (ficha) */
.return-flag { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.return-set { display: inline-flex; align-items: center; gap: 6px; }
.return-set input[type=date] { padding: 4px 8px; font-size: 12px; max-width: 150px; }

/* Central "Hoje" — cards de pendência clicáveis */
.hoje-card { text-decoration: none; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.hoje-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

/* Aparência — paleta de cores de destaque */
.accent-grid { display: flex; flex-wrap: wrap; gap: 14px; }
.accent-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; padding: 8px 10px; border-radius: 12px; border: 2px solid transparent; transition: background .12s, border-color .12s; }
.accent-opt:hover { background: var(--green-soft); }
.accent-opt.on { border-color: var(--green); background: var(--green-soft); }
.accent-swatch { width: 52px; height: 52px; border-radius: 14px; box-shadow: var(--shadow); }
.accent-name { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 12.5px; color: var(--ink); }

/* Calculadoras */
.calc-result { margin-top: 10px; padding: 10px 12px; border-radius: 9px; background: var(--green-soft); color: var(--green-dark); font-size: 14px; }
.calc-result strong { font-family: 'Montserrat', sans-serif; }
.calc-warn { color: var(--danger); font-weight: 700; }

/* Arquivos (drive) */
.drive-list .file-ic { width: 20px; height: 20px; color: var(--green); flex: 0 0 auto; }
.drive-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.drive-meta { white-space: nowrap; }

/* Micro-animação ao marcar (hábito/marco/tarefa via AJAX) */
@keyframes checkpop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.pop { animation: checkpop .28s ease; }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; } }

/* Confete ao concluir 100% dos passos de uma meta */
.confetti-bit {
  position: fixed; width: 8px; height: 8px; border-radius: 2px;
  z-index: 9999; pointer-events: none; will-change: transform, opacity;
  animation: confettiFall 1.25s ease-out forwards;
}
@keyframes confettiFall {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(380deg); opacity: 0; }
}

/* Resumo de Organização no dashboard */
.org-radar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.org-radar .badge { font-weight: 700; }
.habit-list.compact { margin: 0; }
.habit-list.compact .habit-row { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.habit-list.compact .habit-row:last-child { border-bottom: 0; }
.habit-list.compact .habit-check { width: 26px; height: 26px; flex-basis: 26px; font-size: 13px; }

/* ============================================================
   Animações de entrada (cards) + microinterações
   ============================================================ */
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page .card, .welcome-hero { animation: cardIn .4s ease both; }
/* leve cascata nos 6 primeiros blocos da página */
.page > .card:nth-child(1), .page > .stats-grid:nth-child(1) > .stat:nth-child(1) { animation-delay: .02s; }
.page > .card:nth-child(2) { animation-delay: .06s; }
.page > .card:nth-child(3) { animation-delay: .10s; }
.page > .card:nth-child(4) { animation-delay: .14s; }
.dash-grid > .card { animation: cardIn .45s ease both; }
.dash-grid > .card:nth-child(2) { animation-delay: .06s; }
.dash-grid > .card:nth-child(3) { animation-delay: .12s; }
.dash-grid > .card:nth-child(4) { animation-delay: .18s; }
.stats-grid > .stat { animation: cardIn .4s ease both; }
.stats-grid > .stat:nth-child(2) { animation-delay: .05s; }
.stats-grid > .stat:nth-child(3) { animation-delay: .10s; }
.stats-grid > .stat:nth-child(4) { animation-delay: .15s; }
.stats-grid > .stat:nth-child(5) { animation-delay: .20s; }

/* cards de conteúdo com um leve realce de sombra ao passar o mouse */
.dash-grid > .card, .stats-grid > .stat { transition: box-shadow .18s ease, transform .18s ease; }
.dash-grid > .card:hover { box-shadow: var(--shadow-lg); }

@media (prefers-reduced-motion: reduce) {
  .page .card, .welcome-hero, .dash-grid > .card, .stats-grid > .stat { animation: none; }
}

/* ============================================================
   Estilo de impressão (Ctrl+P / Salvar como PDF)
   ============================================================ */
@page { margin: 1.4cm; }

@media print {
  /* paleta sempre clara no papel (mesmo se o app estiver no tema escuro) */
  :root, :root[data-theme="dark"] {
    --white: #fff; --paper: #fff; --ink: #1d1d1d; --ink-soft: #555;
    --line: #d8d8d8; --line-soft: #e8e8e8; --green-soft: #EAF1EC;
    --shadow: none; --shadow-lg: none;
  }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;
      animation: none !important; transition: none !important; }

  body { background: #fff; }
  /* tira a moldura do app */
  .sidebar, #toast-root, .nprogress, .ui-overlay, .welcome-hero,
  .global-search, .topbar-actions, .patient-subnav,
  .btn, .row-actions, .toolbar, .form.bordered, .inline-form,
  .add-block, .chip-filters, .backup-banner, .onboarding, #layout-editor,
  .theme-toggle, .footer-actions { display: none !important; }

  .layout { display: block; }
  .content { width: 100%; }
  .page { padding: 0; }
  .topbar { position: static; background: none; border: 0; padding: 0 0 8px; height: auto; }
  .topbar h1 { font-size: 20px; letter-spacing: 0; }

  /* cards limpos, sem sombra, sem quebrar no meio da página */
  .card, section.card, .stat, .goal-item, .study-card { box-shadow: none !important; border: 1px solid var(--line); }
  .card, section, .stat, table, tr, .goal-item, .study-card, .chart-box, .spark { break-inside: avoid; }

  /* gráficos empilham (largura cheia) e não cortam */
  .dash-grid { display: block; }
  .dash-grid > .card { margin-bottom: 14px; }
  .chart-box { height: 240px; }
  .chart-box.tall { height: 300px; }

  /* tipografia um pouco mais sóbria p/ papel */
  a { color: var(--ink); text-decoration: none; }
  h1, h2, h3 { color: #1d1d1d; }
}

/* ============================================================= */
/* Fluidez da plataforma                                          */
/* ============================================================= */

/* 1) Transições suaves entre páginas (View Transitions API).
   Sidebar/topbar são idênticos entre páginas → o crossfade do root é
   imperceptível; só o conteúdo (.page) desliza/fade. */
@view-transition { navigation: auto; }
.page { view-transition-name: page; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; }
::view-transition-old(page) { animation: vt-out .16s ease both; }
::view-transition-new(page) { animation: vt-in .28s cubic-bezier(.2,.7,.2,1) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 2) Barra de progresso de navegação (topo) */
.nav-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--green), var(--green-dark));
  box-shadow: 0 0 10px var(--green); border-radius: 0 2px 2px 0;
  z-index: 9999; opacity: 0; pointer-events: none;
  transition: width .18s ease, opacity .3s ease;
}
.nav-progress.active { opacity: 1; }

/* 3) Botão em estado "carregando" (spinner antes do texto) */
.btn.is-loading { pointer-events: none; opacity: .9; }
.btn.is-loading::before {
  content: ""; display: inline-block; width: 13px; height: 13px;
  margin-right: 7px; vertical-align: -2px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: btn-spin .6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* 4) Microinterações + foco visível */
a, button, .btn, .chip, .badge, .card.clickable, a.card, .hoje-card {
  transition: background-color .15s ease, color .15s ease, border-color .15s ease,
              box-shadow .18s ease, transform .12s ease;
}
.btn:active { transform: translateY(1px); }
a.card:hover, .hoje-card:hover, .card.clickable:hover {
  transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.09);
}
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }
html { scroll-behavior: smooth; }

/* Respeita quem prefere menos animação */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .nav-progress { transition: opacity .2s ease; }
  *, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
