/* =====================================================================
   ESSENCE CLIN — Estilos do aplicativo
   Identidade: elegante, monocromatica (grafite) + acento champagne.
   Mobile-first. Estados base (oculto) definidos FORA de media queries.
   ===================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --bg:        #f4f3f1;   /* fundo geral (greige claro) */
  --surface:   #ffffff;
  --surface-2: #faf9f7;
  --ink:       #1f2024;   /* grafite / texto principal */
  --ink-soft:  #55575e;
  --muted:     #8a8d95;
  --line:      #e7e3dc;   /* bordas */
  --brand:     #1f2024;   /* botao primario (grafite) */
  --brand-600: #34363c;
  --accent:    #b08d57;   /* champagne / dourado suave */
  --accent-soft:#f0e7d8;
  --success:   #2e7d57;
  --success-bg:#e6f2ec;
  --danger:    #b4482e;
  --danger-bg: #f7e7e2;
  --warning:   #b7791f;
  --info:      #3a6ea5;

  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(24,24,27,.04), 0 8px 24px rgba(24,24,27,.06);
  --shadow-lg: 0 12px 40px rgba(24,24,27,.16);
  --sidebar-w: 256px;

  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
button { font-family: inherit; }

/* ---------- Splash / carregando ---------- */
.splash {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; background: var(--bg);
}
.splash__mark { width: 56px; height: 56px; color: var(--ink); opacity: .9; }
.splash__dots { display: flex; gap: 8px; }
.splash__dots span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: bounce 1s infinite ease-in-out;
}
.splash__dots span:nth-child(2) { animation-delay: .15s; }
.splash__dots span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,80%,100%{transform:translateY(0);opacity:.4} 40%{transform:translateY(-7px);opacity:1} }

/* =====================================================================
   AUTENTICACAO
   ===================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth__brand {
  display: none;
  background: linear-gradient(160deg, #26272c 0%, #17181b 100%);
  color: #eceae6; position: relative; overflow: hidden;
}
.auth__brand::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px 300px at 80% 10%, rgba(176,141,87,.20), transparent 60%);
}
.auth__brandInner { position: relative; z-index: 1; padding: 56px 48px; max-width: 440px; margin: auto 0; }
.brandmark { width: 64px; height: 64px; color: #e8e6e1; }
.brandmark__name { font-family: var(--serif); font-size: 40px; letter-spacing: .04em; margin-top: 18px; font-weight: 500; }
.brandmark__tag { color: var(--accent); letter-spacing: .4em; text-indent: .2em; text-transform: uppercase; font-size: 22px; margin-top: 6px; }
.auth__brandNote { margin-top: 28px; color: #b9b7b1; line-height: 1.7; max-width: 320px; }

.auth__panel { display: flex; align-items: center; justify-content: center; padding: 28px 20px; }
.auth__card { width: 100%; max-width: 400px; }
.auth__head { margin-bottom: 22px; }
.auth__head h2 { font-size: 26px; margin-top: 10px; }
.auth__head p { color: var(--muted); margin-top: 6px; }
.auth__foot { margin-top: 24px; text-align: center; color: var(--muted); font-size: 12px; }

/* =====================================================================
   FORMULARIOS
   ===================================================================== */
.form { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field__head-btn { flex: none; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.field > span em { font-weight: 400; color: var(--muted); font-style: normal; }
.field input, .field select {
  width: 100%; padding: 11px 13px; font-size: 15px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176,141,87,.15);
}

.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Botoes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s, transform .05s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--brand-600); }
.btn--ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn--success { background: var(--success); color: #fff; border-color: var(--success); }
.btn--success:hover:not(:disabled) { background: #256b49; }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: 13px; }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
}
.chip--gold { background: var(--accent-soft); border-color: #e6d6bd; color: #8a6a34; }

/* =====================================================================
   APP SHELL
   ===================================================================== */
.app { min-height: 100vh; }

/* --- Menu lateral: estado base OCULTO fora de media query (mobile) --- */
.sidebar {
  position: fixed; top: 0; left: 0; z-index: 40;
  width: var(--sidebar-w); height: 100vh;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(-100%);          /* base: escondido (mobile) */
  transition: transform .25s ease;
}
.sidebar--open { transform: translateX(0); }

.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; }
.sidebar__mark { width: 34px; height: 34px; color: var(--ink); flex: none; }
.sidebar__brandText { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar__brandText strong { font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: .03em; }
.sidebar__brandText small { color: var(--accent); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; }

.nav { flex: 1; overflow-y: auto; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; background: transparent; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: 14px; font-weight: 500; cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.nav__item:hover { background: var(--surface-2); color: var(--ink); }
.nav__item.is-active { background: var(--ink); color: #fff; }
.nav__item.is-active .nav__icon { color: var(--accent); }
.nav__icon { width: 19px; height: 19px; flex: none; display: inline-flex; }
.nav__icon svg { width: 100%; height: 100%; }
.nav__label { flex: 1; }
.nav__badge { font-size: 10px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: #8a6a34; font-weight: 600; }
.nav__item.is-active .nav__badge { background: rgba(255,255,255,.16); color: #e6d6bd; }
/* Badge de notificação (novidades não vistas): vermelho de alerta. */
.nav__badge--alert { background: #d64545; color: #fff; }
.nav__item.is-active .nav__badge--alert { background: #d64545; color: #fff; }

.sidebar__user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.sidebar__userInfo { flex: 1; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sidebar__userInfo strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__userInfo small { color: var(--muted); font-size: 12px; }

/* --- Avatar --- */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: #8a6a34; font-weight: 700; font-size: 14px;
}
.avatar--sm { width: 32px; height: 32px; font-size: 12px; }
.avatar--xs { width: 28px; height: 28px; font-size: 11px; }

/* --- Icon button --- */
.iconbtn {
  width: 38px; height: 38px; border-radius: var(--radius-sm); border: 0;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn--danger:hover { background: #fbeae4; color: #b4482e; }
.table .iconbtn { width: 32px; height: 32px; flex: none; }
.table .iconbtn svg { width: 17px; height: 17px; }
/* Coluna de ações da tabela: os ícones ficam SEMPRE na mesma linha. */
.nowrap { white-space: nowrap; }
.table td.nowrap { white-space: nowrap; width: 1%; }
.rowacts { display: flex; align-items: center; justify-content: flex-end; gap: 2px; flex-wrap: nowrap; }

/* --- Scrim (fundo escuro do menu no mobile) --- */
.scrim { position: fixed; inset: 0; background: rgba(20,20,22,.42); z-index: 39; }

/* --- Conteudo --- */
/* container-type: os layouts internos passam a responder ao ESPAÇO REAL
   disponível (que encolhe com o chat lateral), não só ao tamanho da janela. */
.content { min-height: 100vh; display: flex; flex-direction: column; container-type: inline-size; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: rgba(244,243,241,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-size: 17px; font-weight: 600; }
.topbar__spacer { flex: 1; }

.main { padding: 22px 16px 40px; max-width: 1080px; width: 100%; margin: 0 auto; }
.view { display: flex; flex-direction: column; gap: 20px; }
.view__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.view__head h2 { font-size: 22px; }
.muted { color: var(--muted); }
.txt-right { text-align: right; }
.txt-danger { color: #d64545; }

/* --- Saudacao / dashboard --- */
.hello h2 { font-size: 24px; }
.hello p { color: var(--ink-soft); margin-top: 6px; }

.kpis { display: grid; grid-template-columns: 1fr; gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px;
}
.kpi__label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi__value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.kpi__hint { font-size: 12px; color: var(--accent); }

/* --- Cards --- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.note h3 { font-size: 16px; }
.note p { color: var(--ink-soft); margin-top: 8px; }
.checklist { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.checklist li { position: relative; padding-left: 26px; color: var(--ink-soft); font-size: 14px; }
.checklist li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  color: var(--success); font-weight: 800;
}

/* --- Tabela --- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-inactive { opacity: .5; }
.cell-name { display: flex; align-items: center; gap: 10px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot--on { background: var(--success); }
.dot--off { background: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* --- "Em breve" (proximas fases) --- */
.soon {
  text-align: center; padding: 56px 20px; display: flex; flex-direction: column;
  align-items: center; gap: 12px;
}
.soon__icon { width: 46px; height: 46px; color: var(--accent); }
.soon__icon svg { width: 100%; height: 100%; }
.soon h2 { font-size: 22px; }
.soon p { color: var(--muted); max-width: 420px; }

/* =====================================================================
   MODAL — estado base OCULTO fora de media query
   ===================================================================== */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(20,20,22,.5); }
.modal__panel {
  position: relative; z-index: 1; width: 100%; max-width: 480px;
  background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg);
  padding: 20px; max-height: 92vh; overflow-y: auto;
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal__head h3 { font-size: 18px; }
.modal__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* =====================================================================
   TOAST
   ===================================================================== */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lg);
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; max-width: 90vw;
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast--success { background: var(--success); }
.toast--error { background: var(--danger); }

/* =====================================================================
   FASE 2 — AGENDA + SALAS
   ===================================================================== */
.field textarea {
  width: 100%; padding: 10px 13px; font-size: 15px; font-family: inherit; resize: vertical;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
}
.field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(176,141,87,.15); }

.kpi__value--sm { font-size: 22px; white-space: nowrap; }
.btn .ic { width: 16px; height: 16px; display: inline-flex; }
.btn .ic svg { width: 100%; height: 100%; }
.btn--danger-ghost { background: transparent; color: var(--danger); border-color: #ecccc2; }
.btn--danger-ghost:hover { background: var(--danger-bg); }

.dash-cta { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.dash-cta h3 { font-size: 16px; }

/* ---- Barra de ferramentas da agenda ---- */
.view--agenda { gap: 14px; }
.agenda__toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.agenda__nav { display: flex; align-items: center; gap: 6px; }
.agenda__nav .iconbtn { width: 34px; height: 34px; border: 1px solid var(--line); }
.agenda__date { display: flex; flex-direction: column; margin-left: 8px; }
.agenda__date strong { font-size: 14px; line-height: 1.1; }
.agenda__date input[type=date] { border: 0; padding: 0; font-size: 11px; color: var(--muted); background: transparent; }
.agenda__actions { display: flex; gap: 8px; }
.btn--ghost.is-today { border-color: var(--accent); color: #8a6a34; }

/* ---- Grade do dia ---- */
.agenda__wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.agenda__grid { display: flex; min-width: max-content; }
.agenda__times { flex: none; width: 52px; position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--line); padding-top: 34px; }
.agenda__hour { height: 56px; position: relative; }
.agenda__hour span { position: absolute; top: -7px; right: 7px; font-size: 11px; color: var(--muted); }

.agenda__col { flex: 1 0 150px; min-width: 150px; border-right: 1px solid var(--line); }
.agenda__col:last-child { border-right: 0; }
.agenda__colhead {
  height: 34px; display: flex; align-items: center; gap: 7px; padding: 0 10px;
  font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--surface-2); z-index: 2;
}
.agenda__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.agenda__colbody {
  position: relative; cursor: pointer;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 55px, var(--line) 55px, var(--line) 56px);
}

/* ---- Bloco de agendamento ---- */
.appt {
  position: absolute; left: 4px; right: 4px; overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--room, var(--accent));
  border-radius: 8px; padding: 4px 7px; box-shadow: 0 1px 2px rgba(24,24,27,.06);
  display: flex; flex-direction: column; gap: 1px; transition: box-shadow .12s, transform .05s;
}
.appt:hover { box-shadow: var(--shadow); }
.appt:active { transform: scale(.99); }
.appt__time { font-size: 10.5px; color: var(--ink-soft); font-weight: 600; }
.appt__name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt__svc  { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt--confirmado { background: #eef4fb; }
.appt--atendido   { background: #eaf3ee; }
.appt--faltou     { background: #fbeee9; }
.appt--cancelado  { opacity: .5; }
.appt--cancelado .appt__name { text-decoration: line-through; }
.agenda__hint { font-size: 12.5px; color: var(--muted); text-align: center; }

/* ---- Grids de formulário ---- */
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }

/* ---- Modal mais largo + ações divididas ---- */
.modal__panel--wide { max-width: 560px; }
/* Documento do paciente: a area util fica com a largura de uma folha A4,
   entao o que voce ve na tela e o que sai na impressao. */
/* 210mm = A4, + 40px do padding lateral, + 16px da barra de rolagem */
.modal__panel--doc { max-width: calc(210mm + 56px); }
.modal__panel--stkwide { max-width: 720px; }
.modal__panel--narrow { max-width: 400px; }
.modal__actions--split { justify-content: flex-start; }
.modal__actions--split .spacer { flex: 1; }

/* Botão "⋯" com menu de ações secundárias (evita fila enorme de botões) */
.btn--icon { padding-left: 12px; padding-right: 12px; font-size: 17px; line-height: 1; }
.btnmenu { position: relative; }
.btnmenu__pop { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 30;
  min-width: 250px; padding: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 4px 12px rgba(24,24,27,.10), 0 16px 40px rgba(24,24,27,.14); }
.btnmenu__it { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0;
  background: none; color: var(--ink); font-size: 14px; font-family: inherit; border-radius: 8px; cursor: pointer; }
.btnmenu__it:hover { background: var(--surface-2); }
.btnmenu__it--danger { color: #d64545; }
.btnmenu__it--danger:hover { background: #fbeaea; }

/* ---- Comunicação: modelos de mensagens ---- */
.wa-banner { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }
.wa-banner--on { border-left-color: var(--success); }
.wa-banner__ic { color: var(--success); display: flex; }
.wa-banner__ic svg { width: 22px; height: 22px; }
.msg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.msg-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.msg-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.msg-card__top strong { font-size: 14.5px; }
.msg-card__desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; margin: 8px 0 12px; flex: 1; }
.msg-card__chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.msg-edit { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 8px; }
.msg-edit__form { min-width: 0; }
.msg-vars { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 14px; }
.varchip { font-size: 12px; font-family: var(--mono, monospace); background: var(--accent-soft); color: #8a6a34; border: 1px solid #e6d6bd; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.varchip:hover { background: #efe4d2; }
.msg-test { display: flex; align-items: flex-end; gap: 10px; margin-top: 14px; }
.msg-preview { display: flex; justify-content: center; }
.msg-phone { width: 100%; max-width: 300px; background: #e7ddd1; border: 1px solid var(--line); border-radius: 16px; padding: 16px 12px; min-height: 160px; }
.msg-bubble { background: #d9fdd3; color: #1f2024; border-radius: 10px 10px 10px 2px; padding: 9px 12px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.msg-bubble--empty { background: #fff; color: var(--muted); font-style: italic; }
@media (min-width: 720px) { .msg-edit { grid-template-columns: 1.25fr 1fr; align-items: start; } }

/* ---- Estoque ---- */
.stk-thumb { width: 40px; height: 40px; flex: none; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); }
.stk-thumb img { width: 100%; height: 100%; object-fit: cover; }
.stk-thumb svg { width: 20px; height: 20px; }
.photo-up__preview--sq { border-radius: 12px; }
.photo-up__preview--sq svg { width: 34px; height: 34px; color: var(--muted); }

/* Aviso da taxa da operadora na tela de pagamento */
.co-fee { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); }

/* DRE — cascata do resultado */
.dre-regime { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.dre-card { padding: 6px 0; }
/* mínimos em 0 para a linha caber quando o chat lateral estreita o conteúdo;
   o valor (última coluna) fica em auto e nunca é espremido. */
.dre-line { display: grid; align-items: center; gap: 12px; padding: 11px 16px;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 44px auto; }
.dre-line__label { display: flex; align-items: center; gap: 6px; font-size: 14px; min-width: 0; }
.dre-line__label span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dre-line__chev { color: var(--muted); font-size: 11px; }
.dre-line__bar { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.dre-line__bar span { display: block; height: 100%; border-radius: 99px; background: #d6d3cd; }
.dre-line__pct { font-size: 12px; color: var(--muted); text-align: right; }
.dre-line__val { font-size: 14px; font-weight: 600; text-align: right; white-space: nowrap; }

/* Subtotais fecham um bloco; o resultado final é o destaque. */
.dre-line--total { border-top: 1px solid var(--line); background: var(--surface-2); }
.dre-line--total .dre-line__label { font-weight: 600; }
.dre-line--out .dre-line__label { color: var(--ink-soft); }
.dre-line--out .dre-line__bar span { background: #e6cec6; }
.dre-line--in .dre-line__bar span,
.dre-line--total .dre-line__bar span { background: #bfd8c9; }
.dre-line--final { border-top: 2px solid var(--ink); background: var(--surface-2); padding-top: 14px; padding-bottom: 14px; }
.dre-line--final .dre-line__label { font-weight: 700; font-size: 15px; }
.dre-line--final .dre-line__val { font-size: 18px; }

.dre-detail { padding: 4px 16px 12px; }
.dre-detail__row { display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
.dre-detail__row:last-child { border-bottom: 0; }
.dre-detail__row span { color: var(--ink-soft); }

@media (max-width: 640px) {
  .dre-line { grid-template-columns: 1fr auto; row-gap: 4px; }
  .dre-line__bar, .dre-line__pct { display: none; }
}

/* Contagem de estoque e itens abertos (parte 3) */
.cnt-input { width: 92px; text-align: right; }
.pick-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pick-list__row { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.pick-list__row:last-child { border-bottom: 0; }
.pick-list__row:hover { background: var(--surface-2); }

/* Linhas de itens da compra (estoque — parte 2) */
.buy-rows { display: flex; flex-direction: column; gap: 8px; }
.buy-row { display: grid; gap: 8px; align-items: center;
  grid-template-columns: minmax(0, 1fr) 84px 34px 100px 92px 30px; }
.buy-row input, .buy-row select { width: 100%; }
/* No checkout nao ha coluna de custo digitavel: item | qtd | total | remover */
.buy-row--co { grid-template-columns: minmax(0, 1fr) 84px 92px 30px; }
.buy-row__unit { font-size: 12px; color: var(--muted); }
.buy-row__total { font-size: 13px; font-weight: 600; text-align: right; white-space: nowrap; }
.buy-row .iconbtn { width: 28px; height: 28px; }
@media (max-width: 640px) {
  .buy-row, .buy-row--co { grid-template-columns: minmax(0, 1fr) 34px; grid-template-areas: "item del" "qty qty" "cost cost" "total total";
    padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
  .buy-row > select { grid-area: item; }
  .buy-row > input:nth-of-type(1) { grid-area: qty; }
  .buy-row > input:nth-of-type(2) { grid-area: cost; }
  .buy-row__unit { display: none; }
  .buy-row__total { grid-area: total; text-align: left; }
  .buy-row .iconbtn { grid-area: del; }
}

/* ---- Central de notificações ---- */
.notif-result { margin-top: 12px; padding: 10px 14px; background: var(--accent-soft); border-radius: 8px; font-size: 14px; color: var(--ink); }
.cron-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 4px; }
.cron-url { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; font-family: var(--mono, monospace); }
.notif-msg { max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); font-size: 13px; }

/* ---- Chat / Conversas ---- */
.tab__badge { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 4px; margin-left: 5px; font-size: 11px; font-weight: 700; border-radius: 9px; background: var(--danger); color: #fff; vertical-align: middle; }
.chat { display: grid; grid-template-columns: 1fr; gap: 12px; height: 60vh; min-height: 420px; }
.chat-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.chat-list__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.chat-list__body { flex: 1; overflow-y: auto; }
.chat-conv { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; }
.chat-conv:hover { background: var(--surface-2); }
.chat-conv.is-on { background: var(--accent-soft); }
.chat-conv__av { width: 38px; height: 38px; border-radius: 50%; flex: none; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--muted); }
.chat-conv__mid { flex: 1; min-width: 0; }
.chat-conv__top { display: flex; justify-content: space-between; gap: 8px; }
.chat-conv__name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-conv__top small { color: var(--muted); font-size: 11px; flex: none; }
.chat-conv__last { display: block; font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-conv__badge { flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--success); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
/* Botão de excluir a conversa (o "X") */
.chat-conv__del { flex: none; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: .55; }
.chat-conv__del svg { width: 15px; height: 15px; }
.chat-conv__del:hover { background: var(--danger-bg); color: var(--danger); opacity: 1; }
.chat-main { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; }
.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }
.chat-thread-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.chat-thread { flex: 1; overflow-y: auto; padding: 16px; background: #ece5db; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { display: flex; flex-direction: column; max-width: 78%; }
.chat-msg--in { align-self: flex-start; align-items: flex-start; }
.chat-msg--out { align-self: flex-end; align-items: flex-end; }
.chat-bubble { padding: 8px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.chat-msg--in .chat-bubble { background: #fff; color: #1f2024; border-radius: 10px 10px 10px 2px; }
.chat-msg--out .chat-bubble { background: #d9fdd3; color: #1f2024; border-radius: 10px 10px 2px 10px; }
.chat-meta { color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; }
.chat-start__results { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.chat-start__item { display: flex; flex-direction: column; text-align: left; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.chat-start__item:hover { background: var(--surface-2); }
.chat-start__item strong { font-size: 14px; }
@media (min-width: 720px) { .chat { grid-template-columns: 300px 1fr; } }

/* ---- Painel: profissionais na agenda (próximos dias) ---- */
.agp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 20px; }
.agp-card { position: relative; overflow: hidden; border-radius: 14px; padding: 15px 17px; background: linear-gradient(135deg, #8d5aff 0%, #6928fa 100%); }
.agp-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,0) 46%); pointer-events: none; }
.agp-card::after { content: ""; position: absolute; right: -20px; top: -24px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.16); filter: blur(26px); pointer-events: none; }
.agp-card__head { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.agp-avatar { width: 46px; height: 46px; border-radius: 50%; flex: none; overflow: hidden; background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.55); display: flex; align-items: center; justify-content: center; font-weight: 500; color: #fff; font-size: 15px; }
.agp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.agp-card__id { min-width: 0; }
.agp-card__id strong { display: block; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agp-card__id small { font-size: 12px; }
.agp-card .muted { color: rgba(255,255,255,.82); }
.agp-days { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.agp-day { font-size: 12px; font-weight: 600; background: rgba(255,255,255,.92); color: #5a23c8; border: 1px solid rgba(255,255,255,.5); padding: 4px 11px; border-radius: 20px; cursor: pointer; }
.agp-day:hover { background: #fff; }

/* ---- Ficha do profissional: agenda particular ---- */
.agd-day { margin-top: 12px; }
.agd-day:first-of-type { margin-top: 4px; }
.agd-day__head { font-size: 13px; font-weight: 700; color: var(--ink); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.agd-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.agd-row__time { font-weight: 700; color: var(--ink); width: 46px; flex: none; }
.agd-row__pac { font-weight: 600; }
.agd-row__svc { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.chip.s-agendado   { background: #eef0f2; color: #3a3c42; }
.chip.s-confirmado { background: #e9f1fb; color: #2c5c93; }
.chip.s-atendido   { background: #e6f3ec; color: #256b49; }
.chip.s-faltou     { background: #fbeae4; color: #a03d24; }
.chip.s-cancelado  { background: #eef0f2; color: #7a7d84; }

/* ---- Linha de tabela clicável (abre ficha) ---- */
.table tbody tr.row-link { cursor: pointer; }
.table tbody tr.row-link:hover { background: var(--surface-2); }

/* ---- Selo "pago" no card da agenda: ✓ no canto, visível em qualquer tamanho ---- */
.appt__paid {
  position: absolute; top: 3px; right: 3px; z-index: 2; margin: 0; padding: 0;
  width: 14px; height: 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 700; line-height: 1;
  background: var(--success); color: #fff;
}

/* ---- Rodapé de total em tabelas ---- */
.table tfoot .row-total td { border-top: 2px solid var(--line); font-weight: 700; background: var(--surface-2); }

/* ---- Checkout do atendimento ---- */
.co-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 4px; }
.co-summary > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.co-summary span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.co-summary strong { font-size: 14px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Calculadora de repasse ---- */
.calc-fat { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.calc-fat > span { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.calc-fat > strong { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.calc-res { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; border-top: 1px solid var(--line); padding-top: 12px; }
.calc-res > div { display: flex; flex-direction: column; gap: 1px; }
.calc-res small { font-size: 12px; color: var(--muted); }
.calc-res strong { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.calc-res span { font-size: 15px; color: var(--ink-soft); }
.card.calc-best { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.calc-insight { margin-top: 16px; background: var(--info-bg, #eef4fb); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-size: 14px; line-height: 1.6; display: flex; flex-direction: column; gap: 4px; }
.calc-insight strong { color: var(--ink); font-weight: 700; }
.calc-insight span { color: var(--ink-soft); }

/* ---- Total do fechamento de repasse ---- */
.settle-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; margin: 4px 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.settle-total span { color: var(--ink-soft); font-size: 14px; }
.settle-total strong { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--success); }

/* ---- Recibo ---- */
.receipt { border: 1px solid var(--line); border-radius: 12px; padding: 22px; text-align: center; }
.receipt__brand { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.receipt__title { font-size: 13px; color: var(--muted); margin-top: 2px; }
.receipt__meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-soft); margin: 14px 0 8px; border-top: 1px dashed var(--line); padding-top: 10px; }
.receipt__value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; color: var(--success); margin: 6px 0 14px; }
.receipt__list { display: flex; flex-direction: column; gap: 8px; text-align: left; border-top: 1px dashed var(--line); padding-top: 12px; }
.receipt__list > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.receipt__list dt { color: var(--muted); }
.receipt__list dd { font-weight: 600; color: var(--ink); text-align: right; }
.receipt__foot { font-size: 12px; color: var(--ink-soft); margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 12px; line-height: 1.5; }

/* ---- Uploads (logo/assinatura/carimbo) no modal do profissional ---- */
.upload-row { display: flex; gap: 14px; flex-wrap: wrap; }
.upload-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.upload-cell__prev { width: 96px; height: 60px; border: 1px dashed var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--surface-2); font-size: 11px; color: var(--muted); }
.upload-cell__prev img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---- Recibo oficial ---- */
.orec { position: relative; overflow: hidden; background: #fff; color: #1f2024; border: 1px solid var(--line); border-radius: 10px; padding: 30px 34px 26px; }
.orec__wm { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 0; }
.orec__wm img { width: 55%; max-width: 320px; opacity: .06; }
.orec__wm--text { font-size: 64px; font-weight: 700; letter-spacing: 2px; color: rgba(31,32,36,.05); transform: rotate(-18deg); white-space: nowrap; }
.orec__body { position: relative; z-index: 1; }
.orec__head { display: flex; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.orec__logo img { width: 54px; height: 54px; object-fit: contain; }
.orec__clinic { font-size: 17px; font-weight: 700; }
.orec__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.orec__title { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 0 6px; }
.orec__title > span:first-child { font-size: 19px; font-weight: 700; }
.orec__num { font-size: 13px; color: var(--ink-soft); }
.orec__text { font-size: 15px; line-height: 2; margin: 8px 0 0; }
.orec__ext { color: var(--ink-soft); }
.orec__place { font-size: 13px; color: var(--ink-soft); margin-top: 18px; }
.orec__sign { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: end; margin-top: 40px; }
.orec__sig { text-align: center; }
.orec__sig-img { height: 56px; display: flex; align-items: flex-end; justify-content: center; }
.orec__sig-img img { max-height: 56px; max-width: 100%; object-fit: contain; }
.orec__sig-line { border-top: 1px solid #1f2024; padding-top: 5px; font-size: 14px; font-weight: 600; }
.orec__sig-reg { font-size: 12px; color: var(--ink-soft); }
.orec__stamp { display: flex; align-items: center; justify-content: center; min-height: 80px; }
.orec__stamp img { max-height: 96px; max-width: 100%; object-fit: contain; }

/* ---- Impressão: só o recibo ---- */
/* O recibo é clonado para fora do modal (via printReceipt) para um #print-holder
   direto no body — assim não sofre com o modal fixo/scroll na hora de imprimir. */
#print-holder { display: none; }
@media print {
  body.printing > *:not(#print-holder) { display: none !important; }
  body.printing #print-holder { display: block !important; }
  #print-holder .no-print { display: none !important; }
  #print-holder .receipt, #print-holder .orec { border: none !important; box-shadow: none !important; }
  @page { margin: 12mm; }
}

/* ---- Barra de status rápido ---- */
.statusbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.statuschip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.statuschip.is-on.s-agendado   { background: #eef0f2; color: #3a3c42; border-color: #d9dce0; }
.statuschip.is-on.s-confirmado { background: #e9f1fb; color: #2c5c93; border-color: #cfe0f4; }
.statuschip.is-on.s-atendido   { background: #e6f3ec; color: #256b49; border-color: #c9e6d5; }
.statuschip.is-on.s-faltou     { background: #fbeae4; color: #a03d24; border-color: #f2d3c8; }
.statuschip.is-on.s-cancelado  { background: #eef0f2; color: #7a7d84; border-color: #d9dce0; }

/* ---- Autocomplete de paciente ---- */
.field--ac { position: relative; }
.ac {
  margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  box-shadow: var(--shadow); max-height: 210px; overflow-y: auto; background: var(--surface);
}
.ac__item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  text-align: left; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; cursor: pointer; font-size: 14px;
}
.ac__item:last-child { border-bottom: 0; }
.ac__item:hover { background: var(--surface-2); }
.ac__item small { color: var(--muted); }
.field__hint { color: #8a6a34; font-size: 12px; margin-top: 4px; }

/* ---- Abas ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab {
  border: 0; background: transparent; padding: 9px 13px; font-weight: 600; font-size: 14px;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.tab.is-on { color: var(--ink); border-bottom-color: var(--accent); }

/* ---- Linhas de lista (cadastros) ---- */
.listrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.listrow__main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.listrow__main small { color: var(--muted); font-size: 12.5px; }
.listrow.is-off { opacity: .55; }
.mt { margin-top: 14px; }
.input-color { width: 56px; height: 40px; padding: 2px; cursor: pointer; }

@media (max-width: 430px) { .hide-sm { display: none; } }

/* =====================================================================
   FASE 3 — PACIENTES + CRM
   ===================================================================== */
.mb { margin-bottom: 14px; }
.chip--ok   { background: var(--success-bg); border-color: #cbe6d6; color: #256b49; }
.chip--warn { background: #fbeee0; border-color: #f0dcbf; color: #8a6a34; }
.chip--sm   { padding: 1px 8px; font-size: 11px; }
.chip--over { background: var(--danger-bg); border-color: #ecccc2; color: var(--danger); }

.searchbar { margin-bottom: 16px; }
.searchbar input {
  width: 100%; padding: 11px 14px; font-size: 15px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink);
}
.searchbar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(176,141,87,.15); }

/* Ficha do paciente */
.ficha { display: flex; flex-direction: column; gap: 16px; }
.ficha__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.ficha__id { display: flex; gap: 14px; align-items: flex-start; }
.ficha__id h2 { font-size: 20px; }
.ficha__tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.card h3 { font-size: 16px; }
.cardhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

/* Pacotes */
.pkg { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pkg:first-of-type { border-top: 0; }
.pkg__info { display: flex; flex-direction: column; min-width: 150px; flex: 1; }
.pkg__info small { color: var(--muted); font-size: 12.5px; }
.pkg__prog { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.pkg__prog small { color: var(--muted); font-size: 12px; }
.progress { height: 7px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); }

/* Histórico */
.hist { display: flex; flex-direction: column; }
.hist__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.hist__date { width: 118px; color: var(--ink-soft); font-size: 13px; }
.hist__svc { flex: 1; min-width: 130px; }
.hist__val { color: var(--ink-soft); font-weight: 600; margin-left: auto; }

/* LGPD */
.lgpd { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.lgpd__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.consent { align-items: flex-start; }

/* CRM — recall / pendências */
.recall { border-left: 3px solid var(--warning); }
.recall h3 { font-size: 15px; margin-bottom: 6px; }
.recall__row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); cursor: pointer; }
.recall__row:hover { background: var(--surface-2); }
.recall__name { font-weight: 600; font-size: 14px; }
.recall__act { flex: 1; color: var(--ink-soft); font-size: 13px; min-width: 100px; }

/* CRM — quadro (kanban) */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kcol { flex: 1 0 220px; min-width: 220px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; }
.kcol__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--line); }
.kcol__count { background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.kcol__body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 1px 2px rgba(24,24,27,.05); }
.kcard:hover { box-shadow: var(--shadow); }
.kcard strong { font-size: 14px; }
.kcard__val { color: var(--success); font-weight: 600; font-size: 12.5px; }
.kcard__meta { display: flex; gap: 6px; flex-wrap: wrap; }
.kcard__next { color: var(--muted); font-size: 12px; }
.kcol__add { border: 1px dashed var(--line); background: transparent; color: var(--muted); border-radius: 10px; padding: 8px; font-size: 13px; cursor: pointer; }
.kcol__add:hover { background: var(--surface); color: var(--ink); }

/* =====================================================================
   FASE 4 — FINANCEIRO
   ===================================================================== */
.val-in  { color: var(--success); }
.val-out { color: var(--danger); }

.finbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.finbar__presets { display: flex; gap: 6px; flex-wrap: wrap; }
.finbar__range { display: flex; align-items: center; flex-wrap: wrap; min-width: 0; gap: 8px; color: var(--muted); font-size: 13px; }
.finbar__range input { flex: 1 1 116px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; color: var(--ink); }
.kpis--fin { margin-bottom: 18px; }

.finactions { display: flex; gap: 8px; margin-bottom: 14px; }

.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg__btn { flex: 1; border: 0; background: var(--surface); padding: 9px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg__btn.is-on { background: var(--ink); color: #fff; }

.reports { display: grid; gap: 16px; grid-template-columns: 1fr; }
.repline { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.repline:first-of-type { border-top: 0; }
.repline > span:first-child { flex: 1; }
.repline__q { color: var(--muted); font-size: 12.5px; }

/* =====================================================================
   FASE 5 — PAINEL COMPLETO
   ===================================================================== */
.sec-title { font-size: 14px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.sec-head .sec-title { margin: 0; }

.alerts { display: grid; gap: 10px; grid-template-columns: 1fr; }
.alert { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.alert__i { font-size: 18px; flex: none; }
.alert strong { display: block; font-size: 14px; }
.alert small { color: var(--muted); font-size: 12.5px; }
.alert--danger { border-left: 4px solid var(--danger); }
.alert--warn { border-left: 4px solid var(--warning); cursor: pointer; }
.alert--info { border-left: 4px solid var(--info); cursor: pointer; }
.alert--warn:hover, .alert--info:hover { background: var(--surface-2); }

.occ { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.occ:first-of-type { border-top: 0; }
.occ__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.occ__name { width: 88px; font-size: 14px; font-weight: 600; flex: none; }
.occ__bar { flex: 1; height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.occ__bar span { display: block; height: 100%; }
.occ__pct { width: 44px; text-align: right; font-size: 13px; color: var(--ink-soft); font-weight: 600; }

.kpis--period { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* =====================================================================
   FASE 6 — PROFISSIONAIS + CONFORMIDADE
   ===================================================================== */
.link { color: var(--info); text-decoration: underline; font-weight: 600; font-size: 13px; cursor: pointer; background: none; border: 0; }
.link:hover { color: var(--ink); }
.filerow { font-size: 13px; color: var(--ink-soft); padding: 2px 0 4px; }
.field input[type=file] { padding: 8px; font-size: 13px; background: var(--surface-2); }
.cell-name > div small { display: block; line-height: 1.1; }

/* =====================================================================
   AGENDA — layout de duas colunas (painel lateral + grade)
   ===================================================================== */
.agenda-layout { display: block; }
.agenda-main { min-width: 0; }

/* Agenda ocupa toda a largura disponível (sem o limite de 1080px). */
.main--wide { max-width: none; }

/* Painel lateral: base = gaveta oculta (mobile). Desktop vira coluna fixa. */
.agenda-side {
  position: fixed; top: 0; left: 0; z-index: 45;
  width: 284px; max-width: 86vw; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line); padding: 16px;
  transform: translateX(-100%); transition: transform .25s ease;
}
.agenda-side.is-open { transform: translateX(0); }
.scrim--side { z-index: 44; }

.minical { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); margin-bottom: 14px; }
.minical__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.minical__head strong { font-size: 13.5px; }
.minical__head .iconbtn { width: 28px; height: 28px; }
.minical__head .iconbtn svg { width: 16px; height: 16px; }
.minical__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.minical__dow { text-align: center; font-size: 10.5px; color: var(--muted); font-weight: 600; padding: 3px 0; }
.minical__day { border: 0; background: transparent; border-radius: 7px; height: 28px; padding: 0; font-size: 12px; color: var(--ink-soft); cursor: pointer; }
.minical__day:hover { background: var(--surface-2); }
.minical__day.is-out { color: var(--muted); opacity: .4; }
.minical__day.is-today { color: var(--accent); font-weight: 700; }
.minical__day.is-sel { background: var(--ink); color: #fff; }

.agenda-filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.agenda-filters__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.agenda-filters__head span { font-weight: 600; font-size: 14px; }
.agenda-filters .field { margin-bottom: 11px; gap: 5px; }
.agenda-filters .field:last-child { margin-bottom: 0; }
.agenda-filters .field > span { font-size: 12px; }
.agenda-filters select { padding: 8px 10px; font-size: 13px; }
.minical__day.is-week { background: var(--accent-soft); }
.minical__day.is-week.is-sel { background: var(--ink); }

/* Seletor Dia / Semana */
.agenda__viewsel { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }

/* Visão semanal — colunas por dia */
.agenda__col--day { flex: 1 0 96px; min-width: 96px; }
.agenda__colhead--day { justify-content: center; gap: 5px; }
.agenda__dow { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.agenda__daynum { font-size: 14px; font-weight: 700; }
.agenda__colhead--day.is-today, .agenda__colhead--day.is-today .agenda__dow { color: var(--accent); }

.appt--week { right: auto; }
.appt__room { display: flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--ink-soft); font-weight: 600; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt__roomdot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

/* =====================================================================
   PACIENTES — perfil com sub-abas (Contatos)
   ===================================================================== */
.pac-profile { display: block; }
.pac-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.pac-id { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 7px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.pac-avatar { width: 76px; height: 76px; border-radius: 50%; background: var(--accent-soft); color: #8a6a34; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 26px; }
.pac-id h2 { font-size: 18px; line-height: 1.2; }
.pac-sub { font-size: 13px; }
.pac-actions { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.btn--wa { background: var(--success); color: #fff; }
.btn--wa:hover { background: #256b49; }
.btn--wa .ic svg { width: 16px; height: 16px; }
.pac-submenu { display: flex; flex-direction: column; gap: 2px; padding-top: 14px; }
.pac-submenu button { text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: var(--ink-soft); cursor: pointer; }
.pac-submenu button:hover { background: var(--surface-2); color: var(--ink); }
.pac-submenu button.is-on { background: var(--ink); color: #fff; }
.pac-content { display: flex; flex-direction: column; gap: 16px; }

/* Lista de informações */
.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line); }
.info-row:first-child { border-top: 0; }
.info-ic { width: 20px; height: 20px; color: var(--muted); flex: none; margin-top: 1px; }
.info-ic svg { width: 100%; height: 100%; }
.info-row small { display: block; font-size: 12px; color: var(--muted); }
.info-row strong { font-size: 14px; font-weight: 600; word-break: break-word; }

/* Linha do tempo */
.tl { display: flex; flex-direction: column; }
.tl__item { display: flex; gap: 14px; padding: 4px 0 16px; position: relative; }
.tl__item::before { content: ""; position: absolute; left: 5px; top: 18px; bottom: -2px; width: 2px; background: var(--line); }
.tl__item:last-child::before { display: none; }
.tl__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; margin-top: 3px; z-index: 1; }
.tl--atendido .tl__dot { background: var(--success); }
.tl--confirmado .tl__dot { background: var(--info); }
.tl--faltou .tl__dot { background: var(--danger); }
.tl--agendado .tl__dot { background: var(--ink-soft); }
.tl--pkg .tl__dot { background: var(--accent); }
.tl__body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tl__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tl__head strong { font-size: 14px; }
.tl__head small { color: var(--muted); font-size: 12px; }
.tl__desc { color: var(--ink-soft); font-size: 13px; }
.tl__val { color: var(--ink-soft); font-weight: 600; font-size: 13px; }

/* Foto (avatares com imagem) */
.avatar img, .pac-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* Modal do paciente — foto + campos */
.pat-top { display: flex; gap: 16px; align-items: flex-start; }
.pat-top__fields { flex: 1; display: flex; flex-direction: column; gap: 15px; min-width: 0; }
.photo-up { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; width: 108px; }
.photo-up__preview { width: 96px; height: 96px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: var(--muted); overflow: hidden; }
.photo-up__preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-up .btn { width: 100%; }
.photo-up small { font-size: 11px; }

/* Telefone com DDI */
.phone-in { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.phone-in:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(176,141,87,.15); }
.phone-in__ddi { display: flex; align-items: center; padding: 0 10px; background: var(--surface-2); border-right: 1px solid var(--line); font-size: 13px; color: var(--ink-soft); white-space: nowrap; }
.phone-in input { border: 0 !important; box-shadow: none !important; border-radius: 0; flex: 1; }

/* Seções do formulário (Informações adicionais / Endereço) */
.form-sec { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.form-sec h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin: 0; }
.form-sec--toggle { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.form-sec__chev { width: 18px; height: 18px; color: var(--muted); transition: transform .2s; }
.form-sec__chev svg { width: 100%; height: 100%; }
.form-sec__chev.is-open { transform: rotate(90deg); }
.form-sec__body { display: flex; flex-direction: column; gap: 15px; margin-top: 12px; }

/* =====================================================================
   FASE 8 — MARKETING + PORTAL
   ===================================================================== */
.portalrow { display: grid; gap: 16px; grid-template-columns: 1fr; }
.portalrow small { display: block; }
.portalrow__val { display: flex; align-items: center; gap: 8px; margin: 3px 0 4px; flex-wrap: wrap; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.trunc { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }

/* =====================================================================
   FINANCEIRO NOVO — sub-menu + cadastros
   ===================================================================== */
.fin-layout { display: block; }
.fin-main { min-width: 0; }
.fin-side {
  position: fixed; top: 0; left: 0; z-index: 45; width: 280px; max-width: 86vw; height: 100vh;
  overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 16px;
  transform: translateX(-100%); transition: transform .25s ease;
}
.fin-side.is-open { transform: translateX(0); }
.fin-side__title { font-weight: 600; font-size: 15px; margin-bottom: 10px; }
.fin-submenu { display: flex; flex-direction: column; gap: 2px; }
.fin-submenu button { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: var(--ink-soft); cursor: pointer; }
.fin-submenu button:hover { background: var(--surface-2); color: var(--ink); }
.fin-submenu button.is-on { background: var(--ink); color: #fff; }
.fin-soon { font-size: 10px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: #8a6a34; font-weight: 600; }
.fin-submenu button.is-on .fin-soon { background: rgba(255,255,255,.16); color: #e6d6bd; }
.fin-submenu .fin-more { color: var(--muted); font-weight: 500; font-size: 13px; margin-top: 4px; }
.fin-submenu .fin-more:hover { background: var(--surface-2); color: var(--ink-soft); }
.fin-more__ic { width: 15px; height: 15px; transition: transform .2s; display: inline-flex; flex: none; }
.fin-more__ic svg { width: 100%; height: 100%; }
.fin-more__ic.is-open { transform: rotate(180deg); }
.form-more { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 0; color: #8a6a34; font-weight: 600; font-size: 13px; cursor: pointer; padding: 8px 0; margin-top: 2px; }
.form-more:hover { text-decoration: underline; }

/* Estoque v2 — semaforo de validade e linhas de entrada */
.stk-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.08); vertical-align: middle; }
.stk-dot--ok { background: #1d9e75; box-shadow: 0 0 0 1px #1d9e75; }
.stk-dot--vence90 { background: #e0c027; box-shadow: 0 0 0 1px #cbab16; }
.stk-dot--vence30 { background: #d69122; box-shadow: 0 0 0 1px #c07d15; }
.stk-dot--vencido { background: #cf5030; box-shadow: 0 0 0 1px #b4482e; }
.stk-entry-row { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(52px,.7fr) minmax(132px,1.1fr) minmax(56px,.6fr) minmax(72px,.85fr) auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.stk-entry-row .field { margin: 0; }
.stk-entry-del { align-self: center; margin-top: 14px; }
@container (max-width: 640px) { .stk-entry-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr); } .stk-entry-del { grid-column: 1 / -1; justify-self: end; margin-top: 0; } }
.stk-kit-row { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr) auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.stk-kit-row .field { margin: 0; }
.fin-sidetoggle { margin-bottom: 12px; border: 1px solid var(--line); }

/* Toggle pequeno (status) */
.switch--sm { display: inline-flex; }
.switch--sm > span { display: none; }
.switch--sm input { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch--sm input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch--sm input:checked { background: var(--success); }
.switch--sm input:checked::after { left: 16px; }

/* Checkboxes "disponível para" */
.chkrow { display: flex; gap: 14px; align-items: center; padding-top: 6px; flex-wrap: wrap; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); }

/* Categorias */
.catgrp { padding: 6px 0 10px; border-top: 1px solid var(--line); }
.catgrp:first-of-type { border-top: 0; }
.catrow { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.catrow__name { flex: 1; font-size: 14px; font-weight: 600; }
.catrow--sub { padding-left: 20px; }
.catrow--sub .catrow__name { font-weight: 400; color: var(--ink-soft); }
.catrow.is-off { opacity: .5; }
.catsub-add { margin-left: 20px; margin-top: 2px; color: var(--muted); }

/* Visão geral */
.ov-grid { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 16px; }
.chart-scroll { overflow-x: auto; padding-bottom: 4px; }
.chart-scroll svg { display: block; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--ink-soft); }
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.ovacct { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.ovacct:first-of-type { border-top: 0; }
.ovacct__ic { font-size: 18px; }
/* nome encolhe com reticências; o valor nunca é empurrado para fora */
.ovacct__name { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ovacct strong { font-weight: 700; flex: none; white-space: nowrap; }
.ovacct--total { border-top: 2px solid var(--line); }
.ovline { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ovline:first-of-type { border-top: 0; }
.ovline > span { color: var(--ink-soft); }
.ovline > strong { white-space: nowrap; }
.seg--mini { width: auto; display: inline-flex; }
.seg--mini .seg__btn { padding: 5px 10px; font-size: 12px; flex: none; }
.donut-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
/* flex-basis 140px = largura preferida, mas PODE encolher (min-width:0) —
   senão a legenda estoura a coluna quando o chat lateral está aberto. */
.donut-legend { flex: 1 1 140px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.donut-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.donut-item i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.donut-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-item strong { font-weight: 600; }

/* Detalhe da parcela + baixa */
.inst-info { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.inst-info small, .inst-paid small { display: block; font-size: 11px; }
.inst-info strong { font-size: 14px; }
.inst-net { display: flex; justify-content: space-between; align-items: center; padding: 12px 0 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.inst-net strong { font-size: 18px; }
.inst-paid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 12px 14px; background: var(--success-bg); border: 1px solid #cbe6d6; border-radius: var(--radius); }

/* Contas financeiras */
.acct-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin-bottom: 14px; }
.acct { cursor: pointer; display: flex; flex-direction: column; gap: 10px; }
.acct:hover { box-shadow: var(--shadow-lg); }
.acct.is-off { opacity: .55; }
.acct__head { display: flex; align-items: center; gap: 12px; }
.acct__type { font-size: 22px; }
.acct__bal { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.acct-total { display: flex; align-items: center; justify-content: space-between; }
.acct-total strong { font-size: 20px; }

/* =====================================================================
   RESPONSIVO — desktop (a partir de 900px)
   ===================================================================== */
@media (min-width: 900px) {
  .auth { grid-template-columns: 1.1fr 1fr; }
  .auth__brand { display: block; }

  .sidebar { transform: translateX(0); }        /* fixo no desktop */
  .content { margin-left: var(--sidebar-w); }
  .topbar__menu { display: none; }

  .main { padding: 30px 32px 48px; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis--period { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .reports { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .alerts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portalrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

  /* Paciente: painel de perfil vira coluna fixa à esquerda */
  .pac-profile { display: flex; gap: 18px; align-items: flex-start; }
  .pac-side { width: 264px; flex: none; position: sticky; top: 74px; margin-bottom: 0; }
  .pac-content { flex: 1; min-width: 0; }

  /* Financeiro: sub-menu vira coluna fixa à esquerda */
  .fin-layout { display: flex; gap: 24px; align-items: flex-start; }
  .fin-side { position: sticky; top: 74px; transform: none; z-index: auto; width: 210px; flex: none; height: auto; max-height: calc(100vh - 92px); border-right: 0; padding: 0; background: transparent; overflow-y: auto; }
  .fin-main { flex: 1; min-width: 0; }

  /* Telas com submenu: encostam na navegação em vez de flutuar no meio.
     O `margin: 0 auto` do .main centraliza a coluna de 1080px e, num monitor
     largo, abre um vão entre o menu lateral e o submenu — além de espremer
     a tabela do meio, que ainda perde 210px para o próprio submenu. */
  .main--sub { max-width: 1480px; margin-left: 0; margin-right: auto; }
  .fin-sidetoggle { display: none; }
  .acct-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .ov-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .ov-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  /* Agenda: painel lateral vira coluna fixa à esquerda */
  .agenda-layout { display: flex; gap: 18px; align-items: flex-start; }
  .agenda-side {
    position: sticky; top: 74px; transform: none; z-index: auto;
    width: 248px; flex: none; height: auto; max-height: calc(100vh - 92px);
    border-right: 0; padding: 0; background: transparent; overflow-y: auto;
  }
  .agenda-main { flex: 1; min-width: 0; }
  .agenda__filttoggle { display: none; }
  .scrim--side { display: none !important; }

  .modal { align-items: center; }
  .modal__panel { border-radius: 18px; }
}

/* ================= DOCUMENTOS (Parte 1) ================= */
/* Editor de modelo: paleta de variáveis à esquerda + textarea à direita. */
.tpl-editor { display: grid; gap: 14px; grid-template-columns: 1fr; }
.tpl-vars   { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tpl-vars__group + .tpl-vars__group { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.tpl-vars__title { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.tpl-vars__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-var {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 4px 10px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
}
.tpl-var:hover { background: var(--accent-soft); border-color: #e6d6bd; color: #8a6a34; }
.tpl-body textarea { font-family: ui-monospace, Consolas, "SF Mono", monospace; font-size: 13px; line-height: 1.5; }
@media (min-width: 900px) {
  .tpl-editor { grid-template-columns: 260px 1fr; }
}

/* Cabeçalho do documento aberto */
.doc-meta { display: flex; flex-wrap: wrap; gap: 18px; padding: 10px 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.doc-meta > div { display: flex; flex-direction: column; }
.doc-meta span { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.doc-meta strong { font-size: 14px; }

/* Corpo do documento — parece "papel" (bom no PDF e na tela) */
.doc-body { background: #fff; color: #1f2024; padding: 28px 32px; border: 1px solid var(--line);
  border-radius: 12px; line-height: 1.55; font-size: 14.5px; max-height: 60vh; overflow-y: auto; }
.doc-body h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -.01em; }
.doc-body h3 { font-size: 15px; margin: 18px 0 6px; }
.doc-body hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.doc-body p  { margin: 8px 0; }
.doc-body ul, .doc-body ol { padding-left: 22px; }

/* Impressão: quando o body ganha .printing-doc, esconde tudo e mostra só o clone */
@media print {
  body.printing-doc > *:not(#print-holder) { display: none !important; }
  body.printing-doc #print-holder { display: block !important; }
  body.printing-doc #print-holder .doc-body { border: 0 !important; padding: 0 !important; max-height: none !important; overflow: visible !important; }
}

/* ---- Quadro de assinatura (canvas) ---- */
.signpad { position: relative; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; height: 190px; overflow: hidden; touch-action: none; }
.signpad canvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.signpad__hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; pointer-events: none; letter-spacing: .02em; }
.signpad__base { position: absolute; left: 28px; right: 28px; bottom: 42px;
  border-bottom: 1px dashed #cfcbc3; pointer-events: none; }

/* Assinatura dentro do documento (tela e impressão) */
.doc-sign { background: #fff; border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 12px 12px; padding: 8px 32px 26px; text-align: center; }
.doc-sign img { max-width: 300px; max-height: 96px; display: block; margin: 0 auto -6px; }
.doc-sign__line { border-top: 1px solid #1f2024; width: 300px; margin: 0 auto 6px; }
.doc-sign__name { font-size: 14px; font-weight: 600; color: #1f2024; }
.doc-sign__meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

@media print {
  body.printing-doc #print-holder .doc-sign { border: 0 !important; padding: 8px 0 0 !important; }
}

/* ================= AJUDA DENTRO DO APP ================= */
/* Botão "?" na barra do topo */
.helpbtn {
  width: 30px; height: 30px; flex: none; margin-right: 10px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface);
  color: var(--muted); font-size: 15px; font-weight: 700; cursor: pointer; line-height: 1;
}
.helpbtn:hover { background: var(--accent-soft); border-color: #e6d6bd; color: #8a6a34; }

/* Item "Como usar" no menu lateral */
.nav__item--help { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Painel lateral */
.helpwrap { position: fixed; inset: 0; z-index: 90; display: flex; justify-content: flex-end; }
.helpwrap__backdrop { position: absolute; inset: 0; background: rgba(20, 20, 24, .34); }
.helppanel {
  position: relative; width: min(430px, 100%); height: 100%;
  background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; box-shadow: -8px 0 28px rgba(0, 0, 0, .10);
}
@keyframes hp-slide { from { transform: translateX(100%); } to { transform: translateX(0); } }
.hp-in { animation: hp-slide .22s ease-out; }

.helppanel__head {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 15px 16px; border-bottom: 1px solid var(--line);
}
.helppanel__head h3 { flex: 1; margin: 0; font-size: 16px; letter-spacing: -.01em; }
.helppanel__body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; font-size: 14.5px; line-height: 1.62; }
.helppanel__body p { margin: 10px 0; }
.helppanel__resume { margin-top: 0 !important; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.helppanel__body code {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px; font-size: 12.5px; font-family: ui-monospace, Consolas, monospace;
}

/* Índice de tópicos */
.helpitem {
  display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: left;
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
}
.helpitem:hover { background: var(--surface-2); border-color: #ddd8cf; }
.helpitem strong { font-size: 14.5px; }
.helpitem small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }

/* Passo a passo */
.helpsteps { margin: 14px 0; }
.helpsteps h4 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-soft); }
.helpsteps ol { margin: 0; padding-left: 20px; }
.helpsteps li { margin: 6px 0; }

/* Caixas de destaque */
.helpbox { display: flex; gap: 10px; padding: 12px 14px; margin: 14px 0; border-radius: 10px; font-size: 14px; }
.helpbox p { margin: 0; }
.helpbox strong { display: block; margin-bottom: 3px; }
.helpbox--tip  { background: var(--success-bg); border: 1px solid #cbe6d6; color: #256b49; }
.helpbox--warn { background: var(--danger-bg);  border: 1px solid #ecccc2; color: #8c3a24; }
.helpbox--why  { background: var(--surface-2);  border: 1px solid var(--line);
  border-left: 3px solid var(--accent); color: var(--ink-soft); flex-direction: column; gap: 0; }

@media (max-width: 560px) {
  .helppanel { width: 100%; border-left: 0; }
}

/* ================= MENU RECOLHÍVEL (rail) — só desktop ================= */
:root { --sidebar-rail: 68px; }

/* Botão de recolher, no rodapé da nav */
.rail-toggle {
  display: none;                 /* aparece só no desktop (media query abaixo) */
  align-items: center; gap: 12px; width: calc(100% - 24px); margin: 0 12px 8px;
  padding: 9px 12px; border: 0; background: transparent; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; text-align: left;
}
.rail-toggle:hover { background: var(--surface-2); color: var(--ink); }
.rail-toggle__ico { width: 19px; height: 19px; flex: none; display: inline-flex; }
.rail-toggle__ico svg { width: 100%; height: 100%; }

@media (min-width: 900px) {
  .rail-toggle { display: flex; }

  /* Estado recolhido: menu estreito, conteúdo acompanha */
  .app--railed .sidebar { width: var(--sidebar-rail); }
  .app--railed .content { margin-left: var(--sidebar-rail); }

  /* Some o texto, centraliza os ícones */
  .app--railed .nav__label,
  .app--railed .sidebar__brandText,
  .app--railed .sidebar__userInfo,
  .app--railed .nav__badge { display: none; }

  .app--railed .nav__item,
  .app--railed .rail-toggle,
  .app--railed .sidebar__brand,
  .app--railed .sidebar__user { justify-content: center; }

  .app--railed .nav__item,
  .app--railed .rail-toggle { padding-left: 0; padding-right: 0; gap: 0; }
  .app--railed .rail-toggle { width: auto; margin: 0 12px 8px; }
  .app--railed .sidebar__brand { padding: 20px 0 16px; }
  .app--railed .sidebar__user { padding: 14px 0; }
  .app--railed .sidebar__user .avatar { display: none; }    /* recolhido: mostra só o "Sair" */

  /* Transição suave ao recolher/expandir */
  .sidebar, .content { transition: width .2s ease, margin-left .2s ease; }
}

/* ================= CHAT ENCAIXÁVEL (dock à direita) ================= */
/* Botão de conversa na barra do topo */
.topchat { position: relative; width: 34px; height: 34px; flex: none; margin-right: 8px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface);
  color: var(--ink-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.topchat:hover { background: var(--surface-2); color: var(--ink); }
.topchat.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
/* Verdinho quando há mensagem para responder */
.topchat.has-unread { background: #e6f3ec; border-color: #bfe0cd; color: #1d9e75; }
.topchat.has-unread:hover { background: #d9ede2; }
.topchat.has-unread.is-on { background: #1d9e75; border-color: #1d9e75; color: #fff; }
.topchat__ic { width: 18px; height: 18px; display: inline-flex; }
.topchat__ic svg { width: 100%; height: 100%; }
.topchat__badge { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--surface); }

/* Painel — base (mobile: tela cheia) */
.chatdock { position: fixed; inset: 0; z-index: 45; background: var(--surface);
  display: flex; flex-direction: column; }
.chatdock__grip { display: none; }
.chatdock__inner { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chatdock__head { display: flex; align-items: center; gap: 8px; padding: 11px 12px; border-bottom: 1px solid var(--line); flex: none; }
.chatdock__head strong { font-size: 15px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatdock__head .btn--sm { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; flex: none; }
.chatdock__head .btn--sm svg { width: 15px; height: 15px; }
.chatdock__head .spacer { flex: 1; }
.chatdock__hint { display: flex; gap: 8px; align-items: flex-start; padding: 10px 14px; flex: none;
  background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.chatdock__hint svg { width: 18px; height: 18px; flex: none; color: #1d9e75; }
.chatdock__list { flex: 1; overflow-y: auto; padding: 6px; }
.chatdock__thread { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chatdock__input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); flex: none; }
.chatdock__input input { flex: 1; }

/* Desktop: coluna ajustável à direita, conteúdo se ajeita ao lado */
@media (min-width: 900px) {
  .chatdock { left: auto; right: 0; top: 0; bottom: 0; width: var(--chat-w, 380px);
    border-left: 1px solid var(--line); box-shadow: -6px 0 20px rgba(0,0,0,.06); }
  .chatdock__grip { display: block; position: absolute; left: -5px; top: 0; bottom: 0; width: 11px; cursor: col-resize; z-index: 2; }
  .chatdock__grip span { position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 42px; border-radius: 3px; background: #d6d3cd; transition: background .12s; }
  .chatdock__grip:hover span { background: var(--accent); }

  .app--chat .content { margin-right: var(--chat-w, 380px); transition: margin-right .18s ease; }
  body.is-resizing { cursor: col-resize; user-select: none; }
  body.is-resizing .content, body.is-resizing .chatdock { transition: none !important; }
}

/* ================= CONTATOS (aba do chat) ================= */
/* Abas Conversas | Contatos no cabeçalho do dock */
.chatdock__tabs { display: flex; gap: 2px; flex: 1; }
.chatdock__tabs button { border: 0; background: transparent; padding: 6px 10px; font-size: 14px; font-weight: 600;
  color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
.chatdock__tabs button.is-on { color: var(--ink); border-bottom-color: var(--accent); }

.chatdock__contacts { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.contacts-bar { flex: none; padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.contacts-search { width: 100%; }
.contacts-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.contacts-filters button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.contacts-filters button.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.contacts-filters em { font-style: normal; opacity: .7; margin-left: 2px; }
.qf--bom.is-on   { background: #1d9e75; border-color: #1d9e75; }
.qf--medio.is-on { background: #ba7517; border-color: #ba7517; }
.qf--ruim.is-on  { background: #b4482e; border-color: #b4482e; }

.contacts-list { flex: 1; overflow-y: auto; }
.contact-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.contact-row__mid { flex: 1; min-width: 0; cursor: pointer; }
.contact-row__name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-row__q { position: relative; margin-top: 3px; }
.contact-row__msg { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent;
  color: #1d9e75; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.contact-row__msg:hover { background: var(--success-bg); }
.contact-row__msg svg { width: 19px; height: 19px; }
.contact-row .chat-conv__av { cursor: pointer; }

/* Contatos como PÁGINA (mesma lista do chat, num cartão) */
.contacts-page { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; max-width: 720px; }
.contacts-page .contacts-bar { border-top-left-radius: 14px; border-top-right-radius: 14px; }
.contacts-page .contacts-list { overflow: visible; }
.contacts-page .contact-row:last-child { border-bottom: 0; }
.contact-row__tel { flex: none; color: var(--muted); font-size: 13px; white-space: nowrap; }
@media (max-width: 560px) { .contact-row__tel { display: none; } }

/* Chip de qualidade (clicável) */
.qchip { border: 1px solid transparent; border-radius: 999px; padding: 1px 10px; font-size: 11px; font-weight: 700; cursor: pointer; }
.qchip--som, .qchip--sem { background: var(--surface-2); border-color: var(--line); color: var(--muted); }
.qchip--bom   { background: #e6f3ec; border-color: #bfe0cd; color: #1d7a58; }
.qchip--medio { background: #fbeee0; border-color: #f0dcbf; color: #8a5a12; }
.qchip--ruim  { background: #fbeae4; border-color: #f2d3c8; color: #a03d24; }

/* Bolinha de qualidade (discreta na frente do cliente; nome no hover via title) */
.qdot { width: 15px; height: 15px; border-radius: 50%; padding: 0; flex: none; cursor: pointer;
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); transition: transform .1s ease; }
.qdot:hover { transform: scale(1.18); }
.qdot--bom   { background: #1d9e75; box-shadow: 0 0 0 1px #1d9e75; }
.qdot--medio { background: #d69122; box-shadow: 0 0 0 1px #c07d15; }
.qdot--ruim  { background: #cf5030; box-shadow: 0 0 0 1px #b4482e; }
.qdot--sem   { background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); }

/* Menuzinho para trocar a tag */
.qmenu { position: absolute; top: 22px; left: 0; z-index: 20; display: flex; gap: 9px; padding: 8px 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
.qmenu .qdot { width: 18px; height: 18px; padding: 0; }

/* Segmento de qualidade no modal */
.seg__btn--bom.is-on   { background: #e6f3ec; color: #1d7a58; }
.seg__btn--medio.is-on { background: #fbeee0; color: #8a5a12; }
.seg__btn--ruim.is-on  { background: #fbeae4; color: #a03d24; }

/* ================= VISÃO GERAL — cards de indicadores (aero) ================= */
.kpi-aero-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
/* 4 colunas fixas: os 8 cards menores sempre dividem par (4+4), sem sobrar
   um sozinho embaixo. Encolhe para 3 e 2 colunas via container query. */
.kpi-aero-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }

/* célula que segura o card + a telinha (a telinha escapa do card, que tem overflow:hidden) */
.kpi-cell { position: relative; display: flex; }
.kpi-cell > .kpi-aero { flex: 1; }
.kpi-cell.is-clickable { cursor: pointer; }
.kpi-cell.is-clickable .kpi-aero { transition: transform .12s ease, box-shadow .12s ease; }
.kpi-cell.is-clickable:hover .kpi-aero { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.14); }

.kpi-aero { position: relative; overflow: hidden; border-radius: 14px; padding: 15px 17px; color: #fff; }
.kpi-aero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,0) 46%); pointer-events: none; }
.kpi-aero::after { content: ""; position: absolute; right: -20px; top: -24px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.16); filter: blur(26px); pointer-events: none; }
.kpi-aero__c { position: relative; z-index: 1; }
.kpi-aero__l { font-size: 13px; opacity: .85; }
.kpi-aero__v { font-size: 20px; font-weight: 500; line-height: 1.2; margin-top: 2px; white-space: nowrap; }
.kpi-aero__h { font-size: 11px; opacity: .82; margin-top: 2px; }
.kpi-aero--big { padding: 17px 19px; }
.kpi-aero--big .kpi-aero__v { font-size: 26px; }
.kpi-aero--mid .kpi-aero__v { font-size: 24px; }

/* Uma cor (degradê) por indicador */
.kpi-aero--lucro       { background: linear-gradient(135deg, #16b588 0%, #0c6e51 100%); }
.kpi-aero--caixa       { background: linear-gradient(135deg, #4b93de 0%, #1f5895 100%); }
.kpi-aero--faturamento { background: linear-gradient(135deg, #74b934 0%, #3e6e18 100%); }
.kpi-aero--impostos    { background: linear-gradient(135deg, #e4564f 0%, #a02e2e 100%); }
.kpi-aero--prolabore   { background: linear-gradient(135deg, #e6a82e 0%, #a06e12 100%); }
.kpi-aero--custo       { background: linear-gradient(135deg, #ee7a48 0%, #c24a22 100%); }
.kpi-aero--fixas       { background: linear-gradient(135deg, #8d5aff 0%, #6928fa 100%); }
.kpi-aero--taxa        { background: linear-gradient(135deg, #de5a93 0%, #a32e63 100%); }
.kpi-aero--avulsas     { background: linear-gradient(135deg, #8a8984 0%, #5a5955 100%); }
.kpi-aero--receber     { background: linear-gradient(135deg, #17b0a8 0%, #0c7a73 100%); }
.kpi-aero--pagar       { background: linear-gradient(135deg, #b87e22 0%, #6e4810 100%); }

@media (max-width: 640px) { .kpi-aero-top { grid-template-columns: 1fr; } }

/* ============ Quando o espaço do conteúdo fica estreito (chat aberto em ============
   telas menores), os sub-menus laterais empilham em cima, liberando a largura toda
   para o conteúdo. Responde ao container .content, não à janela. */
@container (max-width: 700px) {
  .fin-layout, .pac-profile, .agenda-layout { display: block; }
  .fin-side, .pac-side, .agenda-side {
    position: static; width: auto; max-height: none; margin-bottom: 14px; overflow-y: visible;
  }
  .fin-main, .pac-content, .agenda-main { width: auto; }
  /* o submenu do financeiro vira uma faixa horizontal rolável em vez de coluna */
  .fin-submenu { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .fin-submenu button { flex: none; white-space: nowrap; }
  .fin-side__title { display: none; }
  /* cards de indicadores: os 3 grandes e o grid encolhem sem sobrar sozinho */
  .kpi-aero-top { grid-template-columns: minmax(0, 1fr); }
  .kpi-aero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-grid, .ov-grid--3 { grid-template-columns: minmax(0, 1fr); }
}
/* faixa intermediária: 3 grandes lado a lado ainda cabem, grid vai a 3 colunas */
@container (min-width: 701px) and (max-width: 980px) {
  .kpi-aero-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Telinha (popover) ao passar o mouse sobre um card de indicador */
.kpi-tip {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 8;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 11px 13px;
  overflow: hidden;
  opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .14s, transform .14s;
}
.kpi-cell:hover .kpi-tip { opacity: 1; transform: translateY(0); }
.kpi-tip__desc { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-soft); }
.kpi-tip__bar { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 9px 0 6px; }
.kpi-tip__bar span { display: block; height: 100%; border-radius: 99px; background: var(--accent); min-width: 2px; }
.kpi-tip__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 8px; font-size: 11px; color: var(--muted); }
.kpi-tip__go { color: var(--accent); font-weight: 600; }

/* ===== Prontuário de fotos (antes/depois) ===== */
.photocase { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-top: 12px; background: var(--surface); }
.photocase__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.photocase__actions { display: flex; align-items: center; gap: 6px; }
.photocols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.photocol__title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin-bottom: 8px; }
.photocol__title--after { color: #8a6a34; }
.photogrid { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.thumb__x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border: 0; border-radius: 50%; background: rgba(20,20,22,.62); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.thumb__x:hover { background: #d64545; }
.thumb--add { display: flex; align-items: center; justify-content: center; text-align: center; border: 1.5px dashed var(--line); color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; }
.thumb--add:hover { border-color: var(--accent); color: #8a6a34; }
@media (max-width: 560px) { .photocols { grid-template-columns: 1fr; } }

/* ===== Construtor de formulário (modelo de documento) ===== */
/* linha de opção de uma pergunta (usada na coluna de propriedades do editor) */
.fb-opt { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.fb-opt input { flex: 1; }
/* ===== Preencher documento (formulário) ===== */
.fill-form { display: flex; flex-wrap: wrap; align-items: flex-start; }
.fill-block { margin-bottom: 14px; width: 100%; box-sizing: border-box; padding-right: 14px; }
.fill-block--twothirds { width: 66.66%; }
.fill-block--half      { width: 50%; }
.fill-block--third     { width: 33.33%; }
.fill-block--quarter   { width: 25%; }
@media (max-width: 620px) { .fill-block, .fill-block--twothirds, .fill-block--half, .fill-block--third, .fill-block--quarter { width: 100%; padding-right: 0; } }
.fill-h { margin: 16px 0 6px; font-size: 16px; }
.fill-p { margin: 6px 0; color: var(--ink-soft); }
.fill-lbl { font-weight: 600; font-size: 14px; }
.fill-opts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 6px; }
.fill-opt { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.req { color: #d64545; margin-left: 3px; font-style: normal; font-weight: 700; }
.sigpad { width: 100%; height: 170px; border: 1.5px dashed var(--line); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
/* campo com unidade escrita ao lado (ex.: 40 U) */
.fill-suffix { display: flex; align-items: center; gap: 8px; }
.fill-suffix input { flex: 1; min-width: 0; }   /* min-width: nao deixa o sufixo (U, mL) vazar */
.fill-suffix em { font-style: normal; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.btn.is-rec { background: #fbeaea; border-color: #e8a0a0; color: #b13636; }
/* ===== Relatórios de formulário ===== */
.rep-filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.rep-q { margin-bottom: 12px; }
.rep-q__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.rep-bars { display: flex; flex-direction: column; gap: 10px; }
.rep-bar__top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 4px; }
.rep-bar__track { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.rep-bar__track span { display: block; height: 100%; border-radius: 99px; background: var(--accent); min-width: 2px; }
@media (max-width: 560px) { .rep-filters { grid-template-columns: 1fr; } }

/* =====================================================================
   CONSTRUTOR DE DOCUMENTOS — editor visual
   ===================================================================== */
.deditor { position: fixed; inset: 0; z-index: 120; background: var(--bg); display: flex; flex-direction: column; }
.deditor__top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.deditor__name { flex: 1 1 220px; min-width: 160px; font-size: 15px; font-weight: 600; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); }
.deditor__name:hover, .deditor__name:focus { border-color: var(--line); background: var(--surface-2); }
.deditor__save { font-size: 12px; color: var(--muted); white-space: nowrap; }
.deditor__save.is-ok { color: #2e7d57; }
.deditor__body { flex: 1; display: grid; grid-template-columns: 210px 1fr 310px; min-height: 0; }

.deditor__pal { border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 12px 10px 40px; }
.dedpal__hint { font-size: 11.5px; color: var(--muted); margin: 0 0 10px; }
.dedpal__group { margin-bottom: 14px; }
.dedpal__title { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.dedpal__item { display: block; width: 100%; text-align: left; padding: 8px 10px; margin-bottom: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); font-size: 13px; cursor: pointer; }
.dedpal__item:hover { border-color: var(--accent); color: #8a6a34; }

.deditor__canvas { overflow-y: auto; padding: 16px 16px 60px; background: var(--surface-2); min-width: 0; }
.dedpages { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; max-width: 794px; margin: 0 auto 12px; }
.dedpages__tab { padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink-soft); font-size: 12.5px; cursor: pointer; }
.dedpages__tab.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
.dedpages__add, .dedpages__del { padding: 6px 10px; border: 1px dashed var(--line); border-radius: 99px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.dedpages__del { color: #d64545; border-color: #f0c9c9; }

/* --pad-x/--pad-y: a margem da folha. O papel timbrado usa essas medidas
   com sinal negativo para vazar até a borda (sangria). */
.a4 { --pad-x: 48px; --pad-y: 40px;
  background: #fff; color: #1f2024; max-width: 794px; margin: 0 auto; min-height: 900px;
  padding: var(--pad-y) var(--pad-x); border-radius: 4px; overflow: hidden;
  box-shadow: 0 2px 6px rgba(24,24,27,.08), 0 12px 32px rgba(24,24,27,.10); display: flex; flex-direction: column; }
/* A folha do construtor acompanha o tamanho escolhido no modelo. */
.a4--a4 { max-width: 794px; min-height: 900px; }
.a4--a5 { max-width: 559px; min-height: 793px; }
.a4__head { border-bottom: 1px solid #e7e3dc; padding-bottom: 10px; margin-bottom: 18px; font-size: 12px; color: #55575e; }
.a4__foot { border-top: 1px solid #e7e3dc; padding-top: 8px; margin-top: 18px; font-size: 11px; color: #8a8d95; text-align: center; }
/* Com papel timbrado a linha de separação sai — quem separa é a própria arte.
   E a faixa sangra até a borda da folha, igual ao documento impresso. */
.a4__head--bg, .a4__foot--bg {
  display: flex; flex-direction: column; justify-content: center; position: relative;
  margin-left: calc(var(--pad-x) * -1); margin-right: calc(var(--pad-x) * -1);
  padding-left: var(--pad-x); padding-right: var(--pad-x);
}
.a4__head--bg { border-bottom: 0; margin-top: calc(var(--pad-y) * -1); }
.a4__foot--bg { border-top: 0; margin-bottom: calc(var(--pad-y) * -1); }

/* Régua: a borda da faixa vira alça de arraste, com a medida em mm ao lado. */
.bandruler { position: absolute; left: 0; right: 0; height: 12px; cursor: ns-resize; z-index: 3; }
.bandruler--bottom { bottom: -6px; }
.bandruler--top    { top: -6px; }
.bandruler::after {
  content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  margin-top: -1px; background: var(--accent); opacity: 0; transition: opacity .12s;
}
.bandruler:hover::after { opacity: .9; }
.bandruler__mm {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: var(--ink); color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 99px; opacity: 0; transition: opacity .12s; white-space: nowrap;
}
.bandruler:hover .bandruler__mm, body.is-bandresize .bandruler__mm { opacity: 1; }
/* Enquanto arrasta a faixa: cursor ↕ na tela toda, sem selecionar texto. */
body.is-bandresize, body.is-bandresize * { cursor: ns-resize !important; user-select: none !important; }

/* Seletor de cor do texto */
.colorpick { margin-top: 12px; }
.colorpick__ttl { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.colorpick__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.colorpick__in { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--line);
                 border-radius: 6px; background: var(--surface); cursor: pointer; }
.colorpick__sw { width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18);
                 cursor: pointer; padding: 0; flex: none; }
.colorpick__sw.is-on { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Régua deslizante da altura da faixa (coluna Documento) */
.ruler { width: 100%; accent-color: var(--accent); margin: 2px 0 0; cursor: pointer; }
.ruler__scale { display: flex; justify-content: space-between; margin: 0 0 6px; }
.ruler__scale i { font-style: normal; font-size: 10px; color: var(--muted); }

/* Bloco de envio do timbrado, na coluna Documento */
.hfbg { margin-top: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; }
.hfbg__ttl { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 8px; }
.hfbg__img { display: block; width: 100%; max-height: 90px; object-fit: contain;
             background: #faf8f4; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.hfbg__btn { display: inline-flex; align-items: center; cursor: pointer; margin-bottom: 6px; }
/* flex-wrap: os elementos com largura menor ficam lado a lado na folha */
.a4__body { flex: 1; min-height: 400px; display: flex; flex-wrap: wrap; align-content: flex-start; }

.dedel { position: relative; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px 8px 26px; margin-bottom: 4px; cursor: pointer;
         width: 100%; box-sizing: border-box; }
.dedel--twothirds { width: 66.66%; }
.dedel--half      { width: 50%; }
.dedel--third     { width: 33.33%; }
.dedel--quarter   { width: 25%; }
.dedel:hover { border-color: #e7e3dc; background: #fbfaf8; }
.dedel.is-sel { border-color: var(--accent); background: #fdfbf7; box-shadow: 0 0 0 2px rgba(176,141,87,.14); }
.dedel--ghost { opacity: .4; }
.dedel__grip { position: absolute; left: 6px; top: 10px; color: #c9c4bb; cursor: grab; font-size: 13px; line-height: 1; }
.dedel__tag { position: absolute; top: -8px; left: 22px; font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #8a6a34; background: #f0e7d8; padding: 1px 6px; border-radius: 99px; opacity: 0; transition: opacity .12s; }
.dedel:hover .dedel__tag, .dedel.is-sel .dedel__tag { opacity: 1; }
.dedel__req { position: absolute; top: -8px; right: 78px; font-size: 12px; font-weight: 700; color: #d64545; }
.dedel__cond { position: absolute; top: -8px; right: 96px; font-size: 9.5px; background: #e9f1fb; color: #2c5c93; padding: 1px 6px; border-radius: 99px; }
.dedel__acts { position: absolute; top: -10px; right: 4px; display: flex; gap: 1px; opacity: 0; transition: opacity .12s; background: #fff; border: 1px solid #e7e3dc; border-radius: 8px; padding: 1px; }
.dedel:hover .dedel__acts, .dedel.is-sel .dedel__acts { opacity: 1; }
.dedel__acts .iconbtn { width: 24px; height: 22px; font-size: 11px; color: #55575e; }
.dedempty { text-align: center; color: #a8a49c; padding: 50px 16px; border: 2px dashed #e7e3dc; border-radius: 10px; font-size: 13.5px; width: 100%; }

/* pré-visualização de cada elemento dentro da folha */
.dp-h1 { font-size: 19px; font-weight: 700; margin: 6px 0; }
.dp-h2 { font-size: 15px; font-weight: 600; margin: 6px 0; }
.dp-p { font-size: 13.5px; margin: 4px 0; color: #3d3f45; white-space: pre-wrap; }
.dp-hr { border: 0; border-top: 1px solid #d9d4cb; margin: 8px 0; }
.dp-spacer { border-left: 2px dotted #e0dbd2; }
.dp-break { text-align: center; font-size: 11px; color: #a8a49c; border-top: 1px dashed #c9c4bb; border-bottom: 1px dashed #c9c4bb; padding: 3px 0; letter-spacing: .04em; }
.dp-lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.dp-input { border: 1px solid #ddd8cf; border-radius: 6px; background: #faf9f7; min-height: 28px; padding: 5px 8px; font-size: 12.5px; color: #a8a49c; }
.dp-input--tall { min-height: 56px; }
.dp-opts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: #3d3f45; }
.dp-auto { color: #8a6a34; background: #f6efe3; padding: 0 5px; border-radius: 4px; font-size: 12.5px; }
.dp-box { border: 1.5px dashed #ddd8cf; border-radius: 8px; padding: 14px; text-align: center; font-size: 12px; color: #a8a49c; }
.dp-img { max-width: 200px; border-radius: 6px; display: block; }
.dp-sig { margin: 10px 0; }
.dp-sig__line { border-bottom: 1px solid #55575e; height: 34px; max-width: 300px; }
.dp-sig small { color: #8a8d95; font-size: 11px; }
.dp-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.dp-table td { border: 1px solid #ddd8cf; height: 22px; padding: 0; color: var(--ink); vertical-align: middle; }
/* Celula digitavel: parece a propria tabela, sem cara de formulario. */
.dp-cell {
  width: 100%; border: 0; background: transparent; padding: 4px 5px;
  font: inherit; color: inherit; border-radius: 0; min-width: 0;
}
.dp-cell:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: #fffdf8; }
.dp-cell::placeholder { color: #c3bfb6; }
.dp-td--head { background: #f4f1ea; }
.dp-td--head .dp-cell { font-weight: 700; }
/* Divisória arrastável: fica em cima da borda direita da célula. */
.dp-table td { position: relative; }
.dp-grab {
  position: absolute; top: 0; right: -4px; width: 9px; height: 100%;
  cursor: col-resize; z-index: 2; background: transparent;
}
.dp-grab::after {
  content: ''; position: absolute; top: 0; left: 3px; width: 3px; height: 100%;
  background: var(--accent); opacity: 0; transition: opacity .12s;
}
.dp-grab:hover::after { opacity: .85; }
/* Enquanto arrasta: cursor ↔ na tela toda e nada de seleção de texto. */
body.is-colresize, body.is-colresize * { cursor: col-resize !important; user-select: none !important; }

.deditor__props { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 12px 12px 60px; }
.dedprops__type { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); margin: 12px 0 8px; }
.dedprops .field { margin-bottom: 10px; }
.dedstyle { display: flex; gap: 4px; margin-bottom: 10px; }
.dedstyle__b { width: 34px; height: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--ink); cursor: pointer; }
.dedstyle__b.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }
/* Lista para inserir o dado automático (nome, CPF, telefone…) no texto */
.dedvarsel { border-color: var(--accent) !important; color: #8a6a34; }
.dedcond { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.dedcond__box { background: var(--surface-2); border-radius: 8px; padding: 10px; margin-top: 8px; }
.seg--sm .seg__btn { font-size: 12px; padding: 6px 8px; }

@media (max-width: 1100px) {
  .deditor__body { grid-template-columns: 170px 1fr 260px; }
  .a4 { --pad-x: 30px; --pad-y: 28px; }
}
@media (max-width: 820px) {
  .deditor__body { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .deditor__pal { border-right: 0; border-bottom: 1px solid var(--line); max-height: 130px; display: flex; gap: 6px; overflow-x: auto; padding: 8px; }
  .dedpal__hint { display: none; }
  .dedpal__group { margin: 0; min-width: 150px; }
  .deditor__props { border-left: 0; border-top: 1px solid var(--line); max-height: 45vh; }
  .a4 { padding: 20px; min-height: auto; }
}

/* =====================================================================
   DOCUMENTO RENDERIZADO (pré-visualização, tela e PDF) — folha A4
   ===================================================================== */
.doc-preview { background: var(--surface-2); padding: 14px; border-radius: 10px; max-height: 62vh; overflow-y: auto; }
/* Documento por formulário: as folhas (.docpage) já têm fundo e margem próprios. */
.doc-body--pages { background: none !important; border: 0 !important; padding: 0 !important; }
.docpage { --pad-x: 44px; --pad-y: 38px;
           background: #fff; color: #1f2024; max-width: 794px; margin: 0 auto 14px;
           padding: var(--pad-y) var(--pad-x); border-radius: 4px; overflow: hidden;
           box-shadow: 0 1px 3px rgba(24,24,27,.08); display: flex; flex-direction: column; min-height: 500px; }
/* Folha A5: metade da A4, mesma proporção de papel. */
.docpage--a5 { max-width: 559px; min-height: 793px; }
.docpage--a4 { max-width: 794px; }
.docpage__body { flex: 1; }
.doc-head { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #e7e3dc; padding-bottom: 10px; margin-bottom: 18px; font-size: 12px; color: #55575e; }
.doc-logo { max-height: 46px; max-width: 120px; }
.doc-foot { border-top: 1px solid #e7e3dc; padding-top: 8px; margin-top: 20px; font-size: 10.5px; color: #8a8d95; text-align: center; }

/* ---- Papel timbrado: faixa com imagem de fundo no cabeçalho/rodapé ----
   A faixa SANGRA: sai da margem da folha e encosta nas bordas, como um
   papel timbrado de verdade. O conteúdo dentro dela volta para a margem. */
.doc-band {
  display: flex; flex-direction: column; justify-content: center;
  margin-left: calc(var(--pad-x) * -1); margin-right: calc(var(--pad-x) * -1);
  padding-left: var(--pad-x); padding-right: var(--pad-x);
}
.doc-band--head { margin-top: calc(var(--pad-y) * -1); margin-bottom: 18px; }
.doc-band--foot { margin-top: 20px; margin-bottom: calc(var(--pad-y) * -1); }
/* Com imagem de fundo, as linhas de separação viram ruído visual. */
.doc-band .doc-head { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.doc-band .doc-foot { border-top: 0; padding-top: 0; margin-top: 0; }
/* Colunas: elementos lado a lado na mesma linha (o HTML é gerado sem espaços
   entre as colunas, então as porcentagens fecham exatamente). */
.doc-col { display: inline-block; vertical-align: top; width: 100%; box-sizing: border-box; padding-right: 14px; }
.doc-col:last-child, .doc-col--full { padding-right: 0; }
.doc-col--twothirds { width: 66.66%; padding-right: 14px; }
.doc-col--half     { width: 50%;    padding-right: 14px; }
.doc-col--third    { width: 33.33%; padding-right: 14px; }
.doc-col--quarter  { width: 25%;    padding-right: 14px; }
.doc-col > *:first-child { margin-top: 0; }
.doc-h1 { font-size: 19px; margin: 10px 0 8px; }
.doc-h2 { font-size: 15px; margin: 14px 0 6px; }
.doc-p  { font-size: 13.5px; margin: 6px 0; line-height: 1.6; }
.doc-f  { font-size: 13.5px; margin: 9px 0; line-height: 1.6; }
.doc-hr { border: 0; border-top: 1px solid #ddd8cf; margin: 12px 0; }
.doc-blank { color: #a8a49c; }
.doc-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.doc-imgs img { border-radius: 6px; border: 1px solid #e7e3dc; }
.doc-sigbox { margin: 26px 0 10px; max-width: 340px; }
.doc-sigimg { max-height: 70px; display: block; }
.doc-sigline { border-bottom: 1px solid #1f2024; margin-top: 2px; }
.doc-sigcap { font-size: 11px; color: #55575e; margin-top: 3px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 8px 0; }
.doc-table th, .doc-table td { border: 1px solid #ccc7be; padding: 5px 7px; text-align: left; }
.doc-table th { background: #f4f2ee; font-weight: 600; }

/* Impressão: cada .docpage vira uma folha A4.
   Página NOMEADA sem margem: só as .docpage usam essa folha, então o papel
   timbrado alcança a borda. Os outros impressos do sistema continuam com
   a margem de 12mm de sempre. A margem do documento vira padding da folha. */
@page { size: A4; margin: 12mm; }
@page essencedoc  { size: A4; margin: 0; }
@page essencedoc5 { size: A5; margin: 0; }
@media print {
  body.printing-doc #print-holder .doc-preview { background: none !important; padding: 0 !important; max-height: none !important; overflow: visible !important; }
  /* padding SEM !important: assim a margem escolhida no modelo (que vem no
     style da folha) manda, e os documentos antigos continuam com 12mm. */
  body.printing-doc #print-holder .docpage { page: essencedoc;
                                             --pad-x: 12mm; --pad-y: 12mm; padding: 12mm;
                                             box-shadow: none !important; border-radius: 0 !important; margin: 0 !important;
                                             overflow: visible !important;
                                             max-width: none !important; min-height: auto !important; page-break-after: always; break-after: page; }
  /* Folha A5 usa a sua propria pagina nomeada. */
  body.printing-doc #print-holder .docpage--a5 { page: essencedoc5; }
  /* Arte de fundo: sai no papel só se o modelo mandar. Quem usa papel já
     impresso na gráfica deixa desligado — aí a arte fica só na tela. */
  body.printing-doc #print-holder .docpage--bgprint {
    -webkit-print-color-adjust: exact; print-color-adjust: exact; color-adjust: exact;
  }
  body.printing-doc #print-holder .docpage--bgtela { background-image: none !important; }
  body.printing-doc #print-holder .docpage:last-child { page-break-after: auto; break-after: auto; }
  body.printing-doc #print-holder .doc-imgs img, body.printing-doc #print-holder .doc-sigimg { page-break-inside: avoid; break-inside: avoid; }
  body.printing-doc #print-holder .doc-f, body.printing-doc #print-holder .doc-sigbox { page-break-inside: avoid; break-inside: avoid; }
  /* Sem isto o navegador NÃO imprime a imagem de fundo — o timbrado sumiria do papel. */
  body.printing-doc #print-holder .doc-band {
    -webkit-print-color-adjust: exact; print-color-adjust: exact; color-adjust: exact;
    page-break-inside: avoid; break-inside: avoid;
  }
}

/* =====================================================================
   ESSENCE TV — painel
   ===================================================================== */
.tvcard { margin-bottom: 12px; }
.tvcard__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tvcard__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.tvcard__grid small { display: block; color: var(--muted); font-size: 11.5px; }
.tvcard__grid strong { font-size: 14px; }
.tvcard__acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tvstat { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; padding: 4px 10px; border-radius: 99px; }
.tvstat__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tvstat.is-on  { background: #e7f4ec; color: #2e7d57; }
.tvstat.is-off { background: #fbeaea; color: #b13636; }

.tvgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tvitemcard { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.tvitemcard.is-off { opacity: .55; }
.tvitemcard__thumb { height: 110px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; }
.tvitemcard__thumb img { width: 100%; height: 100%; object-fit: cover; }
.tvitemcard__ic { font-size: 34px; }
.tvitemcard__body { padding: 10px; }
.tvitemcard__body strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.tvitemcard__acts { display: flex; gap: 2px; margin-top: 8px; }

.tvitem { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.tvitem:last-child { border-bottom: 0; }
.tvitem.is-off { opacity: .5; }
.tvitem--ghost { opacity: .4; }
.tvitem__grip { color: var(--muted); cursor: grab; font-size: 15px; }
.tvitem__n { width: 22px; text-align: center; color: var(--muted); font-size: 12px; }
.tvitem__ic { font-size: 18px; }
.tvitem__name { flex: 1; min-width: 0; }
.tvitem__name strong { display: block; font-size: 14px; }
.tvitem__dur { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.tvitem__dur input { width: 62px; }
.tvitem__acts { display: flex; gap: 2px; }

.tvup { border: 1.5px dashed var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 10px; background: var(--surface-2); }
.tvup img, .tvup video { width: 100%; max-height: 240px; object-fit: contain; display: block; background: #000; }
.tvup__empty { padding: 34px; text-align: center; color: var(--muted); font-size: 13px; }

.tvpick { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.tvpick__it { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.tvpick__it.is-sel { border-color: var(--accent); background: var(--accent-soft, #f6efe3); }
.tvpick__ic { font-size: 18px; }
.tvpick__nm { display: flex; flex-direction: column; }
.tvpick__nm small { font-size: 11.5px; }

.tvlink { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.tvlink__row { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.tvlink__qr { width: 130px; height: 130px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 10px; }
.tvlink__txt { flex: 1; min-width: 220px; }
.tvlink__txt code { font-size: 12px; word-break: break-all; }

/* prévia da TV (16:9, fundo preto como na televisão) */
.tvprev { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; }
.tvprev img, .tvprev video { position: absolute; inset: 0; width: 100%; height: 100%; }
.tvprev__aviso { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; padding: 6% 8%; background: #0d0d0f; }
.tvprev__aviso h2 { font-family: Georgia, serif; font-weight: 500; font-size: 3vw; margin: 0 0 .4em; }
.tvprev__aviso p { font-size: 2vw; margin: 0; opacity: .92; white-space: pre-wrap; }
@media (max-width: 900px) { .tvprev__aviso h2 { font-size: 26px; } .tvprev__aviso p { font-size: 17px; } }
/* prévia: QR, promoção e institucional */
.tvprev__qr { width: 26%; max-width: 150px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 10px; margin: 6px 0; }
.tvprev__lista { display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: center; margin-top: 10px; max-width: 90%; }
.tvprev__lista span { font-size: 1.35vw; color: #fff; background: rgba(194,168,120,.16); border: 1px solid rgba(194,168,120,.45); padding: 4px 12px; border-radius: 99px; }
.tvprev__promo { position: absolute; inset: 0; background: #0d0d0f; }
.tvprev__promo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tvprev__veu { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,8,10,.94) 0%, rgba(8,8,10,.86) 42%, rgba(8,8,10,.15) 100%); }
.tvprev__promoin { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 6% 5%; max-width: 64%; gap: 8px; color: #fff; }
.tvprev__promoin.is-center { max-width: 100%; align-items: center; text-align: center; }
.tvprev__promoin h2 { font-family: Georgia, serif; font-weight: 500; font-size: 3.2vw; margin: 0; line-height: 1.08; }
.tvprev__promoin p { font-size: 1.6vw; margin: 0; color: #ddd8d0; }
.tvprev__preco { align-self: flex-start; background: #c2a878; color: #1f2024; font-weight: 700; font-size: 1.6vw; padding: 6px 16px; border-radius: 99px; margin-top: 6px; }
.tvprev__promoin.is-center .tvprev__preco { align-self: center; }
@media (max-width: 900px) {
  .tvprev__lista span { font-size: 12px; }
  .tvprev__promoin h2 { font-size: 26px; } .tvprev__promoin p, .tvprev__preco { font-size: 15px; }
}
.tvprev__horas { display: flex; flex-wrap: wrap; gap: 8px 10px; justify-content: center; margin-top: 10px; max-width: 92%; }
.tvprev__horas span { font-size: 1.8vw; font-weight: 600; color: #1f2024; background: #c2a878; padding: 5px 14px; border-radius: 8px; }
@media (max-width: 900px) { .tvprev__horas span { font-size: 15px; } }

/* Código curto de pareamento da TV (digitado no controle remoto) */
.tvpair { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.tvpair__code {
  display: inline-block; font-family: "Courier New", monospace; font-weight: 700;
  font-size: 30px; letter-spacing: .22em; padding: 10px 18px 10px 24px;
  background: var(--ink); color: #fff; border-radius: 12px;
}

/* Precificação: alerta de margem apertada */
.txt-warn { color: #b4772e; }

/* Planilha de simulação: célula digitável, com cara de planilha */
.simtab td { padding: 4px 6px; vertical-align: middle; }
.simcell {
  width: 100%; min-width: 84px; text-align: right; padding: 7px 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-size: 14px;
}
.simcell--txt { text-align: left; min-width: 130px; }
.simcell:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: #fffdf8; }
.simcell__hint { display: block; text-align: right; font-size: 11px; margin-top: 2px; }
.simtab__tot td { border-top: 2px solid var(--line); background: var(--surface-2); }
.simcell--qtd { min-width: 56px; }

/* =====================================================================
   METAS DO MES (Financeiro > Metas)
   ===================================================================== */

/* seletor de mes */
.meta-month { display: flex; align-items: center; gap: 8px; }
.meta-month strong { min-width: 150px; text-align: center; }
/* so a primeira letra: "capitalize" viraria "Agosto De 2026" */
.meta-month strong::first-letter { text-transform: uppercase; }

/* chip de aviso / simulacao */
.meta-chip {
  display: inline-block; font-style: normal; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; margin-left: 6px; white-space: nowrap;
}
.meta-chip--warn { background: var(--danger-bg); color: var(--danger); }
.meta-chip--sim  { background: var(--accent-soft); color: #7a5c23; }

/* formulario da meta */
.meta-form {
  display: grid; gap: 14px; margin-top: 4px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.meta-form .field small { line-height: 1.4; }
.meta-form .field a { color: var(--accent); font-weight: 600; text-decoration: none; }
.meta-form .field a:hover { text-decoration: underline; }

/* resultados calculados */
.meta-out {
  display: grid; gap: 12px; margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.meta-out__item { display: flex; flex-direction: column; gap: 2px; }
.meta-out__l { font-size: 12px; color: var(--muted); font-weight: 600; }
.meta-out__item strong { font-size: 18px; }
.meta-out__item--big strong { font-size: 26px; letter-spacing: -.02em; }
.meta-out__item small { font-size: 11px; }

/* grafico em cascata */
.meta-wf { width: 100%; min-width: 560px; height: auto; display: block; }
.meta-wf__bar--in  { fill: var(--success); }
.meta-wf__bar--out { fill: var(--danger); }
.meta-wf__bar--mid { fill: var(--info); }
.meta-wf__bar--neg { fill: var(--danger); }
.meta-wf__val { font-size: 12px; font-weight: 700; fill: var(--ink); }
.meta-wf__lab { font-size: 11px; fill: var(--muted); }

/* regua: realizado x equilibrio x meta */
.meta-ruler { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.meta-ruler__bar {
  position: relative; height: 16px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); overflow: visible;
}
.meta-ruler__fill {
  position: absolute; inset: 0 auto 0 0; border-radius: 999px;
  transition: width .25s ease;
}
.meta-ruler__fill.is-low { background: var(--warning); }
.meta-ruler__fill.is-ok  { background: var(--success); }
.meta-ruler__mark { position: absolute; top: -5px; width: 2px; height: 26px; border-radius: 2px; }
.meta-ruler__mark--eq   { background: var(--danger); }
.meta-ruler__mark--meta { background: var(--info); }
.meta-ruler__legend {
  display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px;
  font-size: 12px; color: var(--muted);
}
.meta-ruler__legend strong { color: var(--ink); margin-left: 4px; }

/* ponto de equilibrio — o card de destaque da tela */
.meta-be { border-left: 3px solid var(--accent); }
.meta-be__val { font-size: 15px; margin: 0 0 10px; }
.meta-be__val strong { font-size: 20px; }
.meta-be__src { font-size: 12px; margin-top: 10px; }
.meta-frase {
  background: var(--accent-soft); border-radius: var(--radius-sm);
  padding: 14px 16px; margin: 0 0 10px; font-size: 15px; line-height: 1.55;
}
.meta-frase strong { font-weight: 700; }
.meta-frase--alt { background: var(--surface-2); border: 1px solid var(--line); }
.meta-done {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.meta-done strong { color: var(--ink); }

/* tabela da meta de atendimentos */
.meta-table td small { display: block; font-size: 11px; }
.meta-in {
  width: 88px; text-align: right; padding: 7px 8px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); font: inherit; font-size: 13px;
}
.meta-in--wide { width: 110px; }
.meta-in:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.meta-table tfoot th { border-top: 2px solid var(--line); background: var(--surface-2); }

.meta-check {
  margin: 14px 0 0; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
}
.meta-check.is-ok  { background: var(--success-bg); color: var(--success); }
.meta-check.is-off { background: var(--danger-bg);  color: var(--danger); }

@media (max-width: 640px) {
  .meta-out__item--big strong { font-size: 22px; }
  .meta-month strong { min-width: 120px; font-size: 14px; }
}

/* card de progresso da meta (Painel e Visao geral) */
.meta-prog { cursor: pointer; transition: box-shadow .15s ease; }
.meta-prog:hover { box-shadow: var(--shadow-lg); }
.meta-prog__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.meta-prog__head h3 { margin: 0; font-size: 15px; }
.meta-prog__pct { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.meta-prog .meta-ruler__legend { margin-top: 14px; }

/* ---- Assistente de margem de contribuicao (Metas) ---- */
.mc-wiz {
  margin-top: 18px; padding: 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
}
.mc-wiz h4 { margin: 0 0 4px; font-size: 14px; }
.mc-wiz > p { margin: 0 0 14px; }

/* o botao do regime de nota fiscal */
.mc-nf {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color .15s ease;
}
.mc-nf.is-on { border-color: var(--accent); background: var(--accent-soft); }
.mc-nf strong { display: block; font-size: 13px; }
.mc-nf small { display: block; margin-top: 2px; line-height: 1.4; }
.mc-switch {
  flex: 0 0 auto; width: 46px; height: 26px; border-radius: 999px; cursor: pointer;
  background: var(--line); border: none; padding: 3px; transition: background .18s ease;
}
.mc-switch.is-on { background: var(--success); }
.mc-switch__dot {
  display: block; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .18s ease;
}
.mc-switch.is-on .mc-switch__dot { transform: translateX(20px); }

.mc-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.mc-res { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.mc-res__line {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline;
  gap: 4px 12px; padding: 6px 0;
}
.mc-res__line small { grid-column: 1 / -1; font-size: 11px; }
.mc-res__line strong { font-size: 15px; }
.mc-res__final {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px; margin-top: 12px; padding: 12px 14px;
  border-radius: var(--radius-sm); background: var(--accent-soft);
}
.mc-res__final span { font-weight: 600; font-size: 13px; }
.mc-res__final small { display: block; font-weight: 400; }
.mc-res__final strong { font-size: 26px; letter-spacing: -.02em; margin-left: auto; }

/* "E se fosse só um serviço?" — a leitura do equilíbrio em atendimentos */
.solo { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.solo h4 { margin: 0 0 2px; font-size: 14px; }
.solo > p { margin: 0 0 12px; }
.solo-table td small { display: block; font-size: 11px; }
.solo-table td strong { font-size: 15px; }

/* Meta de aluguéis de sala */
.rent-goal { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.rent-goal h4 { margin: 0 0 2px; font-size: 14px; }
.rent-goal > p { margin: 0 0 12px; }
.rent-table td small { display: block; font-size: 11px; margin-top: 2px; }
.rent-table td strong { font-size: 15px; }
.rent-table tfoot th { border-top: 2px solid var(--line); background: var(--surface-2); }
.rent-effect {
  margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--accent-soft); font-size: 13px; line-height: 1.55;
}
.rent-effect.is-ok { background: var(--success-bg); color: var(--success); }
