/* ZoltraMed — design system v2 "Digital Vitality"
   Shell estilo clínica: header branco fixo (marca roxa) + rail de ícones com submenu no hover +
   menu gaveta. Roxo Zoltra, Manrope, cantos suaves, sombras tintadas. */
:root {
  --primary: #6b119f;          /* roxo base Zoltra */
  --primary-dark: #20083f;     /* beringela escuro (contraste) */
  --primary-soft: #f1e5f9;     /* lilás claro */
  --success: #00c853;
  --bg: #f8f6fb;               /* névoa lilás */
  --card: #ffffff;
  --text: #211a29;
  --muted: #6b6577;
  --border: #e7e2ee;
  --input-bg: #f4f1f8;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 8px 24px rgba(32, 8, 63, .08);
  --shadow-soft: 0 2px 10px rgba(32, 8, 63, .06);
  --appbar-h: 60px;
  --rail-w: 68px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Manrope", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
       background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.55; }
a { color: var(--primary); }
h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: var(--primary-dark); margin: 0 0 6px; }
h2 { font-size: 1.16rem; font-weight: 800; letter-spacing: -.01em; color: var(--primary-dark); }
h3 { font-size: 1.02rem; font-weight: 700; margin: 0 0 4px; color: var(--primary-dark); }
.page-sub { color: var(--muted); margin: 0 0 20px; font-size: .95rem; }

/* ícones SVG (sprite no base.html) */
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2;
       stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; display: inline-block;
       vertical-align: middle; }
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 26px; height: 26px; }

/* ================================================================ header fixo */
.appbar { position: fixed; top: 0; left: 0; right: 0; height: var(--appbar-h); z-index: 500;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 14px 0 10px; background: #fff; color: var(--primary);
  border-bottom: 1px solid var(--border); }
.appbar-left, .appbar-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none;
  color: var(--primary-dark); min-width: 0; }
/* dentro do header branco tudo vira roxo */
.appbar .brand { color: var(--primary); }
.appbar .icon-btn { color: var(--primary); }
.appbar .icon-btn:hover, .appbar .icon-btn:focus-visible { background: var(--primary-soft); }
.appbar .bell-badge { border-color: #fff; }
.appbar .avatar { background: var(--primary); color: #fff;
  box-shadow: inset 0 0 0 1.5px var(--primary); }
.appbar .btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.appbar .btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark);
  color: #fff; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-text { display: flex; align-items: center; line-height: 1.2; min-width: 0; }
.brand-text b { font-weight: 800; font-size: 1rem; letter-spacing: -.01em; white-space: nowrap; }
@media (max-width: 420px) { .brand-text { display: none; } }

.appbar-search { display: flex; align-items: center; gap: 8px; background: var(--input-bg);
  border: 1.5px solid transparent; border-radius: 999px; padding: 7px 16px; width: 300px;
  color: var(--muted); transition: border-color .15s, background .15s, width .2s; }
.appbar-search:focus-within { border-color: var(--primary);
  background: #fff; width: 340px; }
.appbar-search .ico { width: 18px; height: 18px; }
.appbar-search input { border: none; background: none; padding: 0; margin: 0; font-size: .92rem;
  font-family: inherit; color: var(--text); width: 100%; }
.appbar-search input::placeholder { color: var(--muted); }
.appbar-search input:focus { outline: none; }
@media (max-width: 860px) { .appbar-search { display: none; } }
.only-mobile { display: none !important; }
@media (max-width: 860px) { .only-mobile { display: inline-flex !important; } }

.search-row { position: fixed; top: var(--appbar-h); left: 0; right: 0; z-index: 490;
  display: none; align-items: center; gap: 10px; padding: 10px 16px; background: #fff;
  border-bottom: 1px solid var(--border); color: var(--muted); }
.search-row .ico { width: 18px; height: 18px; }
.search-row input { border: none; background: none; padding: 6px 0; margin: 0; font-size: 1rem;
  font-family: inherit; color: var(--text); width: 100%; }
.search-row input:focus { outline: none; }
body.search-open .search-row { display: flex; }
body.search-open .page { padding-top: calc(var(--appbar-h) + 54px); }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px;
  height: 40px; border-radius: 12px; border: none; background: transparent; color: var(--primary-dark);
  cursor: pointer; position: relative; text-decoration: none; transition: background .15s; padding: 0; }
.icon-btn:hover, .icon-btn:focus-visible { background: var(--primary-soft); outline: none; }
.icon-btn.danger { color: #b91c1c; }
.icon-btn.danger:hover { background: #fee2e2; }

.bell-badge { position: absolute; top: 4px; right: 3px; background: #dc2626; color: #fff;
  border-radius: 999px; font-size: .64rem; font-weight: 800; padding: 1px 5px; line-height: 1.3;
  border: 2px solid #fff; }

/* popover de notificações (sino) */
.notif-wrap { position: relative; }
.notif-pop { position: absolute; top: calc(100% + 10px); right: -6px; width: min(360px, 92vw);
  background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  z-index: 700; overflow: hidden; }
.notif-pop::before { content: ""; position: absolute; top: -6px; right: 18px; width: 10px;
  height: 10px; background: #fff; border-left: 1px solid var(--border);
  border-top: 1px solid var(--border); transform: rotate(45deg); }
.notif-head { font-weight: 800; font-size: .9rem; color: var(--primary-dark);
  padding: 12px 16px 8px; }
#notif-list { max-height: 340px; overflow-y: auto; }
.notif-item { display: block; padding: 11px 16px; text-decoration: none; color: var(--text);
  font-size: .88rem; line-height: 1.4; border-top: 1px solid var(--border); }
.notif-item:hover { background: var(--primary-soft); }
.notif-item.is-new { background: #f9f3fd; }
.notif-item.is-new::before { content: ""; display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--primary); margin-right: 7px; vertical-align: 2px; }
.notif-item time { display: block; color: var(--muted); font-size: .74rem; margin-top: 2px; }
.notif-empty { padding: 14px 16px 18px; font-size: .88rem; }
.notif-foot { display: block; text-align: center; padding: 10px; font-size: .84rem;
  font-weight: 700; text-decoration: none; border-top: 1px solid var(--border); }
.notif-foot:hover { background: var(--primary-soft); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px;
  height: 36px; border-radius: 50%; background: var(--primary-dark); color: #fff;
  font-weight: 800; font-size: .95rem; flex-shrink: 0; user-select: none;
  border: none; padding: 0; font-family: inherit; }
.avatar-wrap { position: relative; }
button.avatar { cursor: pointer; }
.avatar-pop { position: absolute; top: calc(100% + 10px); right: -6px; width: min(240px, 86vw);
  background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  z-index: 700; overflow: hidden; }
.avatar-pop::before { content: ""; position: absolute; top: -6px; right: 14px; width: 10px;
  height: 10px; background: #fff; border-left: 1px solid var(--border);
  border-top: 1px solid var(--border); transform: rotate(45deg); }
.avatar-pop-email { padding: 12px 16px 10px; font-size: .82rem; color: var(--muted);
  border-bottom: 1px solid var(--border); word-break: break-all; }
.avatar-pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px;
  background: none; border: none; cursor: pointer; font: inherit; font-weight: 600;
  color: var(--text); text-align: left; text-decoration: none; }
.avatar-pop-item + .avatar-pop-item, .avatar-pop form { border-top: 1px solid var(--border); }
.avatar-pop-item:hover { background: var(--primary-soft); }
.avatar-pop-item.danger:hover { background: #fee2e2; color: #b91c1c; }
@media (max-width: 560px) {
  .notif-pop, .avatar-pop { position: fixed; top: calc(var(--appbar-h) + 6px); left: 10px;
    right: 10px; width: auto; }
  .notif-pop::before, .avatar-pop::before { display: none; }
}

/* tooltips dos botões gráficos */
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; top: calc(100% + 7px); left: 50%;
  transform: translateX(-50%) scale(.94); background: var(--primary-dark); color: #fff;
  font-size: .74rem; font-weight: 600; font-family: "Manrope", sans-serif; padding: 5px 10px;
  border-radius: 8px; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .12s ease, transform .12s ease; z-index: 700; letter-spacing: 0; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1;
  transform: translateX(-50%) scale(1); }

/* ================================================================ rail lateral */
.siderail { position: fixed; top: var(--appbar-h); left: 0; bottom: 0; width: var(--rail-w);
  z-index: 450; display: flex; flex-direction: column; justify-content: space-between;
  align-items: center; padding: 12px 0; background: #fff; border-right: 1px solid var(--border); }
.siderail nav { display: flex; flex-direction: column; gap: 4px; align-items: center; width: 100%; }
.rail-item { position: relative; width: 100%; display: flex; justify-content: center; }
.rail-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px;
  height: 44px; border-radius: 13px; color: var(--muted); border: none; background: transparent;
  cursor: pointer; position: relative; text-decoration: none; transition: background .15s, color .15s; }
.rail-item:hover .rail-btn, .rail-btn:focus-visible { background: var(--primary-soft);
  color: var(--primary-dark); outline: none; }
.rail-item.is-active .rail-btn { background: var(--primary-dark); color: #fff; }
.rail-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%;
  background: #dc2626; border: 2px solid #fff; }
.rail-item.is-active .rail-dot { border-color: var(--primary-dark); }
.rail-exit { margin-top: 8px; }
.rail-exit .rail-btn:hover { background: #fee2e2; color: #b91c1c; }

/* submenu flutuante no hover */
.rail-fly { position: absolute; left: calc(100% + 6px); top: 50%; transform: translateY(-50%);
  background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
  padding: 8px; min-width: 190px; display: none; z-index: 600; }
.rail-item:hover .rail-fly, .rail-item:focus-within .rail-fly { display: block; }
.rail-fly::before { content: ""; position: absolute; left: -10px; top: 0; bottom: 0; width: 12px; }
.rail-fly-title { font-weight: 800; font-size: .82rem; color: var(--primary-dark);
  padding: 6px 10px 6px; letter-spacing: -.01em; }
.rail-fly a { display: block; padding: 8px 10px; border-radius: 9px; text-decoration: none;
  font-size: .88rem; font-weight: 600; color: var(--text); }
.rail-fly a:hover { background: var(--primary-soft); color: var(--primary-dark); }
.rail-fly a[aria-current="page"] { background: var(--primary-dark); color: #fff; }
@media (max-width: 899px) { .siderail { display: none; } }

/* ================================================================ menu gaveta */
.scrim { position: fixed; inset: 0; z-index: 640; background: rgba(32, 8, 63, .5);
  backdrop-filter: blur(2px); }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; z-index: 650; width: min(320px, 88vw);
  background: #fff; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .22s ease; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); }
.drawer-nav { flex: 1; overflow-y: auto; padding: 12px; }
.drawer-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 700;
  font-size: .94rem; margin-bottom: 2px; }
.drawer-link .ico { color: var(--muted); }
.drawer-link:hover { background: var(--primary-soft); color: var(--primary-dark); }
.drawer-link:hover .ico { color: var(--primary-dark); }
.drawer-link.is-active { background: var(--primary-dark); color: #fff; }
.drawer-link.is-active .ico { color: #fff; }
.drawer-link .badge { margin-left: auto; }
.drawer-group { margin: 6px 0 2px; }
.drawer-group-label { display: flex; align-items: center; gap: 12px; padding: 11px 12px 5px;
  font-weight: 800; font-size: .94rem; color: var(--primary-dark); }
.drawer-group-label .ico { color: var(--muted); }
.drawer-sub { display: block; padding: 9px 12px 9px 46px; border-radius: 12px;
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; }
.drawer-sub:hover { background: var(--primary-soft); color: var(--primary-dark); }
.drawer-sub.is-active { background: var(--primary-dark); color: #fff; }
.drawer-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-top: 1px solid var(--border); }
.drawer-user { flex: 1; min-width: 0; font-size: .84rem; font-weight: 600; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================================================================ página */
.page { padding-top: var(--appbar-h); min-height: 100vh; display: flex; flex-direction: column; }
body.has-shell .page { margin-left: var(--rail-w); }
@media (max-width: 899px) { body.has-shell .page { margin-left: 0; } }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 26px 22px 40px; flex: 1; }
@media (max-width: 560px) { .container { padding: 18px 14px 32px; } }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  flex-wrap: wrap; max-width: 1120px; width: 100%; margin: 0 auto; color: var(--muted);
  font-size: .84rem; padding: 18px 22px 26px; }
.footer a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted);
  text-decoration: none; font-weight: 600; }
.footer a:hover { color: var(--primary); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .page-sub { margin: 2px 0 0; }

/* ================================================================ cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow-soft); }
@media (max-width: 560px) { .card { padding: 18px 16px; border-radius: var(--radius); } }
.card.narrow { max-width: 600px; margin-left: auto; margin-right: auto; }
.card.center { text-align: center; }
.card-dashed { border-style: dashed; text-align: center; box-shadow: none; background: transparent; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px;
  margin-bottom: 20px; }
.cards .card { margin-bottom: 0; transition: box-shadow .18s ease, transform .18s ease; }
.cards .card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
@media (max-width: 899px) { .card:has(> .table) { overflow-x: auto; } }

/* KPIs (dashboard) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 16px;
  margin: 0 0 20px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow-soft); }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.kpi-chip { display: inline-flex; align-items: center; justify-content: center; width: 46px;
  height: 46px; border-radius: 14px; }
.chip-navy { background: var(--primary-soft); color: var(--primary-dark); }
.chip-blue { background: #e0edff; color: #1d4ed8; }
.chip-green { background: #ddf7e5; color: #15803d; }
.chip-red { background: #fee2e2; color: #dc2626; }
.chip-teal { background: #d7f0ee; color: #0f766e; }
.chip-yellow { background: #fef3c7; color: #b45309; }
.kpi-delta { font-size: .76rem; font-weight: 800; background: #ddf7e5; color: #15803d;
  border-radius: 999px; padding: 3px 10px; }
.kpi-label { color: var(--muted); font-size: .86rem; font-weight: 600; display: block; }
.kpi-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; color: var(--primary-dark);
  line-height: 1.2; }

/* funil com barras */
.funnel { margin-top: 8px; }
.funnel-row { display: grid; grid-template-columns: minmax(130px, 200px) 1fr 52px; gap: 12px;
  align-items: center; padding: 9px 0; }
.funnel-row .fl { font-weight: 600; font-size: .9rem; }
.funnel-row .fn { text-align: right; font-weight: 800; color: var(--primary-dark);
  font-variant-numeric: tabular-nums; }
.bar { height: 9px; border-radius: 999px; background: var(--input-bg); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--primary); min-width: 2px; }
.bar-fill.green { background: var(--success); }
.bar-fill.dark { background: var(--primary-dark); }

/* lista de decisões (dashboard) */
.dec-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 14px; background: #f9f7fb; border: 1px solid var(--border); margin-bottom: 10px; }
.dec-item .kpi-chip { width: 40px; height: 40px; border-radius: 50%; }
.dec-item b { flex: 1; font-size: .96rem; }
.dec-pill { font-size: .8rem; font-weight: 800; border-radius: 999px; padding: 4px 12px; }

/* avatar de iniciais em tabelas */
.tavatar { display: inline-flex; align-items: center; justify-content: center; width: 38px;
  height: 38px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark);
  font-weight: 800; font-size: .82rem; flex-shrink: 0; }
.tperson { display: flex; align-items: center; gap: 11px; min-width: 0; }
.tperson .tp-name { font-weight: 700; color: var(--primary-dark); }
.tperson .tp-sub { font-size: .78rem; color: var(--muted); }

/* ================================================================ forms */
label { display: block; margin: 14px 0 4px; font-weight: 600; font-size: .9rem; color: var(--primary-dark); }
input, select, textarea { width: 100%; padding: 11px 14px; border: 1.5px solid transparent;
  background: var(--input-bg); border-radius: 11px; font-size: 1rem; margin-top: 4px;
  font-family: inherit; color: var(--text); transition: border-color .15s, background .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: #fff; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 14px 0; padding: 4px 16px 16px; }
legend { font-weight: 700; font-size: .92rem; padding: 0 6px; color: var(--primary-dark); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.field-hint { color: var(--muted); font-size: .8rem; font-weight: 500; margin: 4px 2px 0; }

.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 12px 0;
  color: var(--text); }
.check input { width: auto; margin-top: 4px; accent-color: var(--primary); }

/* ================================================================ botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 11px; border: 1.5px solid var(--border);
  background: #fff; color: var(--primary-dark); text-decoration: none; font-size: .93rem;
  font-weight: 700; font-family: inherit; cursor: pointer; margin: 4px 6px 4px 0;
  transition: border-color .15s, background .15s, box-shadow .15s; }
.btn .ico { width: 17px; height: 17px; }
.btn:hover { border-color: var(--primary); box-shadow: var(--shadow-soft); }
.btn-primary { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-primary:disabled { background: #b1a0bf; border-color: #b1a0bf; cursor: not-allowed; box-shadow: none; }
.btn-lg { padding: 14px 24px; font-size: 1.02rem; width: 100%; text-align: center; border-radius: 13px; }
.btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: 9px; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 1rem;
  font-family: inherit; font-weight: 600; padding: 0; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-ghost:hover { border-color: var(--primary); box-shadow: none; }
.login-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.btn-x { position: absolute; top: 6px; right: 6px; background: rgba(32, 8, 63, .72); color: #fff;
  border: none; border-radius: 50%; width: 26px; height: 26px; cursor: pointer; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; }
.btn-x .ico { width: 14px; height: 14px; }
.btn-x:hover { background: #dc2626; }
.inline { display: inline; }
.hidden { display: none; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.actions { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }

.small-btn { padding: 6px 12px; font-size: .84rem; border-radius: 9px; }
.btn-danger { color: #991b1b; }
.btn-danger:hover { border-color: #dc2626; background: #fef2f2; }

/* ================================================================ avisos e badges */
.alert { border-radius: 12px; padding: 13px 16px; margin: 12px 0; font-size: .95rem; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; }
.alert-ok { background: #ecfdf3; border: 1px solid #b7f0cd; color: #14532d; }
.alert-warn { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; }

.badge { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: .76rem;
  font-weight: 700; letter-spacing: .02em; }
.badge-gray { background: #eee9f3; color: #575163; }
.badge-blue { background: #e0edff; color: #1e40af; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-teal { background: #d7f0ee; color: #115e59; }
.badge-green { background: #ddf7e5; color: #157347; }
.badge-red { background: #fee2e2; color: #991b1b; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot-green { background: #16a34a; }
.dot-red { background: #dc2626; }
.dot-yellow { background: #d97706; }
.dot-gray { background: #94a3b8; }

/* ================================================================ tabelas */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }
.table th, .table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #faf6fc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.kv th { text-align: left; padding: 6px 14px 6px 0; color: var(--muted); font-weight: 600;
  vertical-align: top; white-space: nowrap; }
.kv td { padding: 6px 0; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--primary); }
th.sortable::after { content: " ↕"; color: #bdb2c9; font-size: .85em; }
th.sortable[data-sort="asc"]::after { content: " ↑"; color: var(--primary); }
th.sortable[data-sort="desc"]::after { content: " ↓"; color: var(--primary); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 16px 0; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; text-align: center; box-shadow: var(--shadow-soft); }
.stat-n { display: block; font-size: 1.6rem; font-weight: 800; color: var(--primary-dark);
  letter-spacing: -.02em; }
.stat-l { color: var(--muted); font-size: .84rem; font-weight: 600; }

/* ================================================================ fotos */
.photo-slot { border-top: 1px solid var(--border); padding: 16px 0; }
.photo-slot-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.photo-thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.thumb { position: relative; }
.thumb img { width: 108px; height: 108px; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--border); }
input[type="file"] { background: var(--input-bg); }
/* botão de upload custom (rótulo "Enviar foto" no lugar do "Escolher arquivo") */
.file-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.file-btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 11px 18px; border-radius: 12px; border: 1.5px solid var(--primary);
  background: var(--primary-soft); color: var(--primary-dark); font-weight: 700;
  font-size: .92rem; user-select: none; -webkit-tap-highlight-color: transparent; }
.file-btn:hover { background: var(--primary); color: #fff; }
.file-btn .ico { width: 18px; height: 18px; }
.file-names { display: block; margin-top: 6px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.photo-grid img { width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.photo-grid figure { margin: 0; }
.photo-grid figcaption { font-size: .82rem; color: var(--muted); margin-top: 4px; }

.info-i { display: inline-flex; align-items: center; justify-content: center; width: 22px;
  height: 22px; margin-left: 6px; border-radius: 50%; border: none;
  background: var(--primary-soft); color: var(--primary); cursor: pointer; vertical-align: middle;
  padding: 0; transition: background .15s, color .15s; }
.info-i .ico { width: 15px; height: 15px; }
.info-i:hover { background: var(--primary); color: #fff; }

/* ================================================================ pagamento */
.pix-qr { width: 240px; max-width: 80%; border: 1px solid var(--border); border-radius: 16px; padding: 10px;
  background: #fff; box-shadow: var(--shadow-soft); }
#pix-code { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
.decision-options .check { padding: 12px; border: 1.5px solid var(--border); border-radius: 12px;
  transition: border-color .15s, background .15s; }
.decision-options .check:has(input:checked) { border-color: var(--primary); background: #f9f3fd; }
.pay-list { list-style: none; padding: 0; margin: 8px 0; }
.pay-list li { padding: 2px 0; }

/* escolha do método (PIX x cartão de crédito) */
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
@media (max-width: 480px) { .pay-methods { grid-template-columns: 1fr; } }
.pay-method { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer;
  font-family: inherit; font-size: .93rem; color: var(--primary-dark); text-align: left;
  transition: border-color .15s, background .15s; }
.pay-method small { color: var(--muted); font-weight: 500; }
.pay-method:hover { border-color: var(--primary); }
.pay-method.is-active { border-color: var(--primary); background: #f9f3fd; }

/* campos seguros do CardForm (iframes do Mercado Pago) */
.mp-field { height: 46px; padding: 0 10px; margin-top: 8px; background: var(--input-bg);
  border: 1.5px solid transparent; border-radius: 11px; }
.mp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#card-form input { margin-top: 8px; }
#card-form .btn { width: 100%; margin-top: 12px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 8px; line-height: 1; border-radius: 9px;
  color: var(--muted); display: inline-flex; }
.pw-toggle:hover { color: var(--primary-dark); background: var(--primary-soft); }
.pw-toggle .ico { width: 19px; height: 19px; }

.card-actions { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 2px; }
.pay-select { border: 1.5px solid var(--border); border-radius: 12px; padding: 12px; background: #fbf8fd; }
.pay-select input { width: 18px; height: 18px; }
.paybar { position: sticky; bottom: 16px; z-index: 100; display: flex;
  justify-content: flex-end; margin: 14px 0 0; }
.btn-pay { border-radius: 999px; padding: 15px 28px; font-size: 1.02rem; margin: 0;
  box-shadow: 0 8px 24px rgba(32, 8, 63, .3); }
.btn-pay:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
/* no celular, centraliza para não sobrepor o botão flutuante do chat (canto direito) */
@media (max-width: 560px) { .paybar { justify-content: center; } }

.dash-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dash-filters select { margin: 0; }

/* ================================================================ modais */
dialog { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px;
  max-width: 640px; width: calc(100% - 32px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(32, 8, 63, .55); backdrop-filter: blur(2px); }
.sabbath-text { white-space: pre-line; line-height: 1.6; margin: 8px 0 18px; font-size: .96rem; }
.terms-text { white-space: pre-wrap; max-height: 60vh; overflow-y: auto; font-size: .92rem;
  border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin: 12px 0;
  background: var(--bg); }

/* ================================================================ etapas */
.steps { display: flex; gap: 8px; margin: 14px 0 18px; }
.steps .step { flex: 1; display: flex; align-items: center; gap: 8px; padding: 9px 14px;
  border: 1.5px solid var(--border); border-radius: 999px; color: var(--muted);
  font-size: .88rem; font-weight: 600; background: #fff; }
.steps .step-n { display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--input-bg);
  color: var(--text); font-weight: 800; font-size: .78rem; }
.steps .step.is-active { border-color: var(--primary); color: var(--primary-dark); }
.steps .step.is-active .step-n { background: var(--primary-dark); color: #fff; }
.steps .step.is-done { border-color: #b7f0cd; }
.steps .step.is-done .step-n { background: #ddf7e5; color: #157347; }
@media (max-width: 480px) { .steps .step { padding: 8px 10px; font-size: .8rem; } }

/* ================================================================ token de parceiro (discreto) */
.partner-line { display: flex; gap: 8px; align-items: center; max-width: 380px; margin: 26px 0 0; }
.partner-line input { flex: 1; margin-top: 0; text-transform: uppercase; font-size: .9rem;
  padding: 9px 13px; }
.partner-line .btn { margin: 0; white-space: nowrap; }
.partner-form { display: flex; gap: 8px; align-items: center; }
.partner-form input { flex: 1; margin-top: 0; }
.partner-form .btn { margin: 0; white-space: nowrap; }

/* ================================================================ hero / banners
   Box sempre na proporção padrão 1200×300 (4:1), com ou sem banner configurado. */
.hero-carousel { position: relative; overflow: hidden; border-radius: var(--radius-lg);
  margin-bottom: 26px; box-shadow: var(--shadow); aspect-ratio: 4 / 1; max-height: 300px; }
.hero-track { display: flex; transition: transform .5s ease; height: 100%; }
.hero-slide { flex: 0 0 100%; min-width: 100%; height: 100%; }
.hero-slide img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-slide a { display: block; height: 100%; }
.hero-welcome { display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 36px; height: 100%; overflow: hidden;
  background: linear-gradient(120deg, var(--primary-dark) 0%, var(--primary) 62%, #9a3fd0 100%);
  color: #fff; }
.hero-welcome .hero-text h2 { color: #fff; margin: 0 0 6px; font-size: clamp(1rem, 2.4vw, 1.45rem);
  font-weight: 800; letter-spacing: -.02em; }
.hero-welcome .hero-text p { margin: 0; color: #e7d6f3; max-width: 520px;
  font-size: clamp(.72rem, 1.6vw, .95rem); }
.hero-mark { height: 72%; max-height: 110px; width: auto; opacity: .35;
  filter: brightness(0) invert(1); }
@media (max-width: 560px) {
  .hero-carousel { aspect-ratio: 3 / 1; }
  .hero-welcome { padding: 12px 18px; }
  .hero-welcome .hero-text p { display: none; }
  .hero-mark { display: none; }
}
.hero-dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex;
  justify-content: center; gap: 8px; }
.hero-dot { width: 9px; height: 9px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .55); padding: 0; }
.hero-dot.is-on { background: #fff; width: 22px; border-radius: 999px; }

/* seletor de dispositivo do banner (admin) — cartões selecionáveis com ícone */
.device-picker { display: flex; gap: 10px; }
.device-picker .check { flex: 1; margin: 0; padding: 12px; align-items: center;
  border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer;
  transition: border-color .15s, background .15s; }
.device-picker .check:has(input:checked) { border-color: var(--primary); background: #f9f3fd; }

/* ================================================================ serviços */
.service-options { display: grid; gap: 12px; margin: 14px 0; }
.service-option { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer;
  font-weight: 400; background: #fff; transition: border-color .15s, box-shadow .15s; }
.service-option:hover { border-color: var(--primary); box-shadow: var(--shadow-soft); }
.service-option:has(input:checked) { border-color: var(--primary); background: #f9f3fd;
  box-shadow: var(--shadow-soft); }
.service-option input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--primary); }
.service-body { display: block; flex: 1; }
.service-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.service-head b { color: var(--primary-dark); font-size: 1.02rem; }
.service-price { color: var(--primary); font-weight: 800; white-space: nowrap; }

/* ================================================================ diversos */
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty .ico { width: 34px; height: 34px; opacity: .45; margin-bottom: 8px; }
.filters .check { margin: 10px 0; }

/* clique em labels/botões não pode selecionar texto ("piscada" ao marcar caixas) */
.check, .service-option, .pay-select, .btn, .icon-btn, .rail-btn, .drawer-link,
.drawer-sub, th.sortable, .steps .step, .hero-dot, .pw-toggle, .info-i {
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }

/* observações prontas do médico (pendente/inapto) */
.canned-box { margin: 10px 0 4px; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: 12px; background: #fbf8fd; }
.canned-box .check { margin: 8px 0; font-size: .93rem; }
.canned-title { font-weight: 700; font-size: .86rem; color: var(--primary-dark); margin: 0 0 2px; }

/* ================================================================ funil: cards de profissional + calendário */
.section-title { margin: 26px 0 12px; }
.svc-card { display: flex; flex-direction: column; gap: 6px; }
.svc-card h3 { margin: 6px 0 0; }
.svc-card .badge { align-self: flex-start; }
.svc-meta { list-style: none; padding: 0; margin: 6px 0 0; color: var(--muted); font-size: .86rem; }
.svc-meta li { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.svc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: auto; padding-top: 14px; }
.svc-foot .btn { margin: 0; }

.booking-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 18px;
  align-items: start; }
@media (max-width: 899px) { .booking-grid { grid-template-columns: 1fr; } }
.booking-profs { display: grid; gap: 12px; }
.prof-card { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 14px;
  background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius);
  cursor: pointer; font-weight: 400; transition: border-color .15s, box-shadow .15s; }
.prof-card:hover { border-color: var(--primary); box-shadow: var(--shadow-soft); }
.prof-card:has(input:checked) { border-color: var(--primary); background: #f9f3fd;
  box-shadow: var(--shadow-soft); }
.prof-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.prof-photo img, .prof-photo .tavatar { width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; display: block; }
.prof-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prof-body b { color: var(--primary-dark); }
.prof-council { color: var(--muted); font-size: .82rem; font-weight: 600; }
.prof-bio { color: var(--muted); font-size: .84rem; }
.prof-price { color: var(--primary); font-weight: 800; font-size: .9rem; margin-top: 4px; }

.booking-cal { margin-bottom: 0; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px; }
.cal-head b { color: var(--primary-dark); font-size: 1.02rem; text-transform: capitalize; }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; text-align: center; margin-bottom: 4px; }
.cal-cell { display: flex; align-items: center; justify-content: center; aspect-ratio: 1;
  border: 1.5px solid transparent; border-radius: 11px; background: var(--input-bg);
  color: var(--text); font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer;
  padding: 0; transition: border-color .15s, background .15s, color .15s; }
.cal-cell.is-empty { background: none; border: none; cursor: default; }
.cal-cell.is-off { background: none; color: #c9bed4; cursor: not-allowed; }
.cal-cell.has-slots { background: var(--primary-soft); color: var(--primary-dark); }
.cal-cell.has-slots:hover { border-color: var(--primary); }
.cal-cell.is-on { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }
.cal-tz { margin: 10px 0 0; }
.slot-panel { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.slot-title { font-weight: 700; font-size: .92rem; color: var(--primary-dark); margin-bottom: 10px; }
.slot-list { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { padding: 9px 16px; border: 1.5px solid var(--border); border-radius: 999px;
  background: #fff; color: var(--primary-dark); font: inherit; font-weight: 700;
  font-size: .88rem; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.slot:hover { border-color: var(--primary); }
.slot.is-on { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

/* ================================================================ fila do PA (paciente) */
.queue-card { padding: 30px 24px; }
.queue-label { display: block; color: var(--muted); font-size: .9rem; font-weight: 600; }
.queue-pos { display: block; font-size: 4rem; font-weight: 800; line-height: 1.1;
  letter-spacing: -.04em; color: var(--primary-dark); margin: 4px 0 10px; }

/* ================================================================ videochamada */
.video-card { padding: 0; overflow: hidden; }
.video-stage { position: relative; background: #1a0733; aspect-ratio: 16 / 9; }
.video-remote, .video-remote video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-wait { display: flex; align-items: center; justify-content: center; height: 100%;
  color: #dcc9ea; font-weight: 600; font-size: .95rem; }
.video-local { position: absolute; right: 14px; bottom: 14px; width: 26%; max-width: 200px;
  aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #2a1147;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.video-local video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 14px; }
.video-bar .btn { margin: 0; }
#video-error { padding: 0 14px 14px; text-align: center; color: #b91c1c; }
@media (max-width: 560px) { .video-local { width: 34%; right: 10px; bottom: 10px; } }

/* ================================================================ atendimento (prontuário) */
.enc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 18px;
  align-items: start; }
@media (max-width: 1023px) { .enc-grid { grid-template-columns: 1fr; } }
.enc-side .card { margin-bottom: 18px; }
.note { padding: 14px 0; border-top: 1px solid var(--border); }
.note:first-of-type { border-top: none; }
.note-head { margin-bottom: 6px; }
.note-body { white-space: pre-wrap; margin: 0; line-height: 1.6; }
.doc-item { padding: 16px 0; border-top: 1px solid var(--border); }
.doc-item:first-of-type { border-top: none; }
.doc-new { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.hist-item { display: flex; flex-direction: column; gap: 1px; padding: 10px 12px;
  border-radius: 11px; text-decoration: none; color: var(--text); }
.hist-item:hover { background: var(--primary-soft); }
.hist-item b { color: var(--primary-dark); font-size: .9rem; }

/* ================================================================ consulta por chat (janela central)
   O ZoltraChat (Chatwoot) injeta `.woot-widget-holder` fixo num canto e a bolha
   `.woot--bubble-holder`. Na página da consulta a bolha é escondida (a página
   inteira JÁ é o atendimento) e o holder é reposicionado como uma janela
   centralizada — de canto, o paciente confunde com a caixa de ajuda do site. */
.chat-stage { position: relative; min-height: min(78vh, 760px); margin-top: 6px; }
.chat-frame { position: absolute; inset: 0; border-radius: var(--radius-lg);
  border: 1px dashed var(--border); background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 24px; color: var(--muted); }
.chat-frame .ico { width: 30px; height: 30px; color: var(--primary); }
.chat-hint { display: flex; align-items: center; justify-content: center; gap: 8px;
  flex-wrap: wrap; margin-top: 14px; color: var(--muted); font-size: .9rem; }

body.chat-central .woot--bubble-holder,
body.chat-central .woot-widget-bubble,
body.chat-central .woot-widget-bubble.woot-widget--expanded { display: none !important; }

body.chat-central .woot-widget-holder {
  position: fixed !important;
  top: 50% !important; left: 50% !important;
  right: auto !important; bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  width: min(760px, 94vw) !important;
  height: min(78vh, 760px) !important;
  max-height: none !important; min-height: 0 !important;
  margin: 0 !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 28px 70px rgba(32, 8, 63, .30) !important;
  overflow: hidden !important;
  z-index: 520 !important;   /* acima do header fixo (500) */
}
body.chat-central .woot-widget-holder.woot--hide { display: none !important; }
body.chat-central .woot-widget-holder iframe { width: 100% !important; height: 100% !important; }

@media (max-width: 700px) {
  body.chat-central .woot-widget-holder {
    top: 0 !important; left: 0 !important;
    transform: none !important;
    width: 100vw !important; height: 100dvh !important;
    border: 0 !important; border-radius: 0 !important;
  }
  .chat-stage { min-height: 42vh; }
}

/* ================================================================ comissão por serviço (admin)
   Cada serviço habilitado do profissional tem seu próprio repasse: seletor
   %/R$ + o valor ao lado. Uma linha por serviço; empilha no mobile. */
.svc-comm { display: flex; flex-direction: column; gap: 2px; }
.svc-comm-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.svc-comm-row:first-child { border-top: none; }
.svc-comm-row .check { margin: 0; }
.svc-comm-fields { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; }
.svc-comm-fields select, .svc-comm-fields input { margin: 0; }
@media (max-width: 760px) {
  .svc-comm-row { grid-template-columns: 1fr; }
  .svc-comm-fields { padding-left: 30px; }
}
