:root {
  --bg: #f4f6f8; --surface: #fff; --ink: #0f1b2d; --muted: #5b6576; --line: #e3e7ec; --line-2: #d5dbe3;
  --accent: #0b5fd6; --accent-dark: #0847a6; --accent-soft: #e3eeff; --accent-ink: #0a4aa8;
  --warn-bg: #fff4e5; --warn-line: #f5d3a8; --warn: #8a4300; --danger: #b42318; --wa: #128c4a;
  --nav: #071430; --nav-2: #0d2047; --nav-line: #1f3566; --nav-ink: #c9d2de; --nav-muted: #9fb0c6;
  --radius: 12px;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, h3 { font-family: Manrope, Inter, sans-serif; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }

/* Layout */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.nav { flex: 1 1 232px; max-width: 100%; min-width: 220px; background: var(--nav); color: var(--nav-ink); padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: Manrope, sans-serif; font-weight: 800; flex: none; }
.brand-name { font-family: Manrope, sans-serif; font-weight: 800; font-size: 18px; letter-spacing: .08em; color: #fff; }
.clinic-box { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--nav-line); background: var(--nav-2); }
.clinic-box small { display: block; font-size: 11px; color: var(--nav-muted); }
.clinic-box strong { font-size: 13px; color: #fff; }
.nav-links { display: flex; flex-direction: column; gap: 4px; }
.nav-links a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--nav-ink); text-decoration: none; font-size: 14px; }
.nav-links a:hover { background: var(--nav-2); color: #fff; }
.nav-links a[aria-current="page"] { background: #13306b; color: #fff; font-weight: 600; }
.nav-links svg { width: 18px; height: 18px; flex: none; }
.badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.nav-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px; border-top: 1px solid var(--nav-line); }
.nav-user .who { display: flex; flex-direction: column; font-size: 13px; color: #fff; font-weight: 600; min-width: 0; }
.nav-user .who small { color: var(--nav-muted); font-weight: 400; font-size: 12px; }
.nav-user #my-password { margin-left: auto; padding: 0 8px; display: inline-flex; align-items: center; }
.nav-user #my-password svg { width: 16px; height: 16px; }
.nav-user #logout { margin-left: 0; }
.pw-card { max-width: 440px; }
.readonly-banner { margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; background: #fff4e5; color: #8a4b00; border: 1px solid #f3c98b; font-size: 14px; }
.tag.off { background: #fde8e8; color: #9b1c1c; }
.clinic-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-user button { margin-left: auto;background: none; border: 1px solid var(--nav-line); color: var(--nav-ink); border-radius: 8px; min-height: 36px; padding: 0 10px; cursor: pointer; font-size: 12px; }
.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 640px) { .main { padding: 20px 16px; } .nav { padding: 16px; gap: 14px; } .nav-user { margin-top: 0; } }

/* Peças */
.avatar { width: 36px; height: 36px; border-radius: 999px; background: var(--nav-line); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; background: var(--accent-soft); color: var(--accent-ink); }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; background: var(--accent-soft); color: var(--accent-ink); font-family: Manrope, sans-serif; font-weight: 800; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: #b8c1cd; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; cursor: pointer; }
.chip[aria-pressed='true'] { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); font-weight: 600; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: #eef1f5; color: #3b4657; }
.tag.blue { background: #e0eeff; color: #1e4e8c; }
.tag.teal { background: var(--accent-soft); color: var(--accent-ink); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.card h2 { font-size: 16px; font-weight: 700; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.stat span { font-size: 13px; color: var(--muted); }
.stat strong { font-family: Manrope, sans-serif; font-size: 26px; font-weight: 800; }
.stat.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.stat.warn span, .stat.warn strong { color: var(--warn); }
.search { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; min-width: min(320px, 100%); }
.search input { border: 0; outline: none; flex: 1; background: transparent; font-size: 14px; min-width: 0; }
.search svg { width: 18px; height: 18px; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; padding: 24px; text-align: center; }

/* Formulários */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.field input, .field select, .field textarea { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; font-size: 14px; font-weight: 400; background: #fff; }
.field textarea { padding: 10px 12px; resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset { border: 1px solid var(--line-2); border-radius: 10px; padding: 14px 16px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-size: 13px; font-weight: 700; padding: 0 6px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; min-height: 32px; }
.check input { width: 18px; height: 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.error { color: var(--danger); font-size: 13px; font-weight: 600; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--nav); }
.login .card { width: min(400px, 100%); padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.login .brand-name { color: var(--ink); }

/* Kanban */
.board-wrap { overflow-x: auto; padding-bottom: 12px; }
.board { display: flex; gap: 14px; align-items: flex-start; width: max-content; }
.col { width: 272px; flex: none; background: #ebeef2; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; transition: background .12s; }
.col.over { background: #dde9fb; outline: 2px dashed var(--accent); }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 2px; }
.col-head h2 { font-size: 13px; font-weight: 700; font-family: Inter, sans-serif; display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 999px; background: #64748b; }
.count { font-size: 12px; font-weight: 600; color: var(--muted); background: #fff; padding: 2px 8px; border-radius: 999px; }
.opp { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-decoration: none; color: var(--ink); box-shadow: 0 1px 2px rgba(15,27,45,.06); cursor: grab; }
.opp:hover { border-color: #b8c1cd; color: var(--ink); }
.opp.stalled { border-color: #f5b97a; }
.opp.dragging { opacity: .5; }
.opp-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.opp-name { font-size: 14px; font-weight: 600; }
.opp-proc { font-size: 13px; color: var(--muted); }
.opp-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.opp-value { font-size: 12px; font-weight: 700; }
.opp-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid #eef1f5; padding-top: 8px; font-size: 12px; color: var(--muted); gap: 6px; }
.opp.stalled .opp-foot .age { color: var(--warn); font-weight: 700; }
.opp-move { font-size: 12px; min-height: 32px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; max-width: 130px; }
.flag { color: var(--danger); font-weight: 600; font-size: 11px; }

/* Paciente */
.back { font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.p-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.p-id { display: flex; align-items: center; gap: 16px; }
.p-id h1 { font-size: 24px; font-weight: 800; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; min-width: 900px; }
.stepper li { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }
.stepper li::before { content: ''; height: 6px; border-radius: 999px; background: var(--line); }
.stepper li.done::before { background: #8db6ef; }
.stepper li.current { color: var(--ink); font-weight: 700; }
.stepper li.current::before { background: var(--accent); }
.stepper li.lost::before { background: var(--danger); }
.scroll-x { overflow-x: auto; }
.two-col { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.two-col > .wide { flex: 3 1 520px; min-width: 0; }
.two-col > .side { flex: 2 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-rail .dot { margin-top: 5px; width: 10px; height: 10px; }
.tl-rail::after { content: ''; flex: 1; width: 2px; background: var(--line); margin-top: 4px; }
.tl-body { display: flex; flex-direction: column; gap: 2px; padding-bottom: 16px; font-size: 13px; color: #3b4657; }
.tl-body strong { font-size: 14px; color: var(--ink); }
.tl-body small { font-size: 12px; color: var(--muted); }
.task { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 8px; background: var(--bg); font-size: 14px; }
.task.overdue { background: var(--warn-bg); }
.task input { width: 18px; height: 18px; margin-top: 1px; flex: none; }
.task .t-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.task .t-info small { font-size: 12px; color: var(--muted); }
.task.overdue .t-info small { color: var(--warn); }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.locked { background: var(--bg); border: 1px dashed #b8c1cd; border-radius: 14px; padding: 16px 20px; display: flex; gap: 12px; align-items: flex-start; font-size: 13px; color: #3b4657; }
.locked strong { display: block; font-size: 14px; color: var(--ink); margin-bottom: 2px; }
.inline-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.inline-form input, .inline-form select, .inline-form textarea { min-height: 40px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px; font-size: 14px; background: #fff; }
.inline-form textarea { padding: 8px 10px; resize: vertical; }
.inline-form .row input { flex: 1; min-width: 0; }
.mt { margin: 24px 0 12px; }
select.btn { appearance: auto; padding-right: 12px; }

/* Tabelas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); }
tr.link-row { cursor: pointer; }
tr.link-row:hover td { background: #f8fafb; }
code.snippet { display: block; white-space: pre-wrap; word-break: break-all; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 12px; }

/* Modal */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(15,27,45,.25); }
dialog::backdrop { background: rgba(15,27,45,.45); }
dialog form { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
dialog h2 { font-size: 20px; font-weight: 800; }

/* Agenda */
.tag.red { background: #fdecea; color: #a01c12; }
.tag.green { background: #e3f6ea; color: #136c34; }
.tag.orange { background: var(--warn-bg); color: var(--warn); }
.btn.danger { color: var(--danger); }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.appt { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.appt:first-of-type { border-top: 0; }
.appt.cancelado .appt-name, .appt.cancelado .appt-time { text-decoration: line-through; color: var(--muted); }
.appt-time { width: 64px; font-family: Manrope, sans-serif; font-weight: 800; font-size: 16px; display: flex; flex-direction: column; }
.appt-time small { font-family: Inter, sans-serif; font-weight: 400; font-size: 12px; color: var(--muted); }
.appt-main { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.appt-name { font-weight: 600; text-decoration: none; color: var(--ink); }
.appt-actions { margin-left: auto; }
.mini { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.mini svg { width: 13px; height: 13px; }
.mini.warn { color: var(--warn); font-weight: 600; }

/* Frequência e evolução */
.chart { width: 100%; height: auto; display: block; max-width: 640px; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.mini-stats div { background: var(--bg); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.mini-stats strong { font-family: Manrope, sans-serif; font-size: 22px; font-weight: 800; }
.mini-stats span { font-size: 12px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--ink); margin-top: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.blue { background: #0b5fd6; } .sw.orange { background: #d97706; }
.sub { font-size: 14px; font-weight: 700; margin: 18px 0 4px; }
.headline { font-size: 15px; margin: 0 0 12px; }
.headline .good { color: #136c34; font-weight: 700; } .headline .bad { color: var(--danger); font-weight: 700; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.charts figure { margin: 0; background: var(--bg); border-radius: 12px; padding: 12px; }
.charts figcaption { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 svg, .integ h2 svg { width: 20px; height: 20px; flex: none; }
.day h2 { text-transform: none; }
.evo-form { margin-top: 16px; }
.evo-form summary { list-style: none; display: inline-flex; }
.evo-form summary::-webkit-details-marker { display: none; }
.evo-form[open] summary { margin-bottom: 12px; }
.evo-list { display: flex; flex-direction: column; gap: 10px; }
.evo { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.evo header { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.evo p { margin: 6px 0 0; white-space: pre-wrap; }

/* Integrações */
.integ { display: flex; flex-direction: column; gap: 12px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #eef1f5; color: #3b4657; }
.status-pill.on { background: #e3f6ea; color: #136c34; }
.steps { margin: 0; padding-left: 18px; font-size: 13px; color: #3b4657; display: flex; flex-direction: column; gap: 4px; }

/* Financeiro */
.month-label { font-family: Manrope, sans-serif; font-size: 16px; min-width: 130px; text-align: center; }
.stat.good strong { color: #136c34; } .stat.bad strong { color: #a01c12; }
.wide-chart { max-width: 900px; }
.cat-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.cat { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.cat-top { display: flex; justify-content: space-between; gap: 8px; }
.cat small { font-size: 12px; color: var(--muted); }
.cat-bar { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.cat-bar i { display: block; height: 100%; border-radius: 999px; width: 0; }
.cat-bar i.blue { background: #0b5fd6; } .cat-bar i.orange { background: #d97706; }
td.num, th.num { text-align: right; white-space: nowrap; }
.neg { color: #a01c12; font-weight: 600; } .pos { color: #136c34; font-weight: 600; }

/* Mensagens */
.inbox { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.conv-list { flex: 1 1 280px; max-width: 100%; padding: 8px; display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow-y: auto; }
.conv { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; text-decoration: none; color: var(--ink); min-height: 56px; }
.conv:hover { background: var(--bg); color: var(--ink); }
.conv.active { background: var(--accent-soft); }
.conv.unread strong { font-weight: 800; }
.conv-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.conv-main strong { font-size: 14px; font-weight: 600; }
.conv-main small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .badge { margin-left: 0; }
.ch { width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; color: #fff; flex: none; }
.ch svg { width: 16px; height: 16px; }
.ch.ig { background: #c13584; } .ch.fb { background: #1877f2; }
.thread { flex: 3 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 12px; min-height: 420px; }
.thread-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.msgs { flex: 1; overflow-y: auto; max-height: 55vh; display: flex; flex-direction: column; gap: 8px; padding: 4px; }
.msg { max-width: 75%; padding: 10px 12px; border-radius: 14px; font-size: 14px; }
.msg p { margin: 0 0 4px; white-space: pre-wrap; }
.msg small { font-size: 11px; color: var(--muted); }
.msg.in { background: var(--bg); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.out { background: var(--accent-soft); align-self: flex-end; border-bottom-right-radius: 4px; }
.reply { display: flex; gap: 10px; align-items: flex-end; }
.reply textarea { flex: 1; min-height: 56px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; resize: vertical; }
.reply textarea:disabled { background: var(--bg); }

/* Divulgação */
.field input[type='file'] { padding: 10px 12px; }
.post-preview { max-width: 320px; max-height: 320px; border-radius: 12px; object-fit: cover; }
.post { display: flex; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 14px; }
.post:first-child { border-top: 0; padding-top: 0; }
.post img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }
.post p { margin: 0 0 4px; }

/* Cores das etapas */
.s-novo_contato { background: #64748b; } .s-primeiro_atendimento { background: #0284c7; } .s-qualificacao { background: #7c3aed; }
.s-agendamento { background: #0b6e6e; } .s-comparecimento { background: #059669; } .s-proposta { background: #ca8a04; }
.s-negociacao { background: #ea580c; } .s-fechado { background: #16a34a; } .s-perdido { background: #b42318; }
.t-whatsapp { background: #128c4a; } .t-ligacao { background: #0284c7; } .t-email { background: #7c3aed; } .t-agendamento { background: #0b6e6e; }
.t-comparecimento { background: #059669; } .t-orcamento { background: #ca8a04; } .t-observacao { background: #3b4657; } .t-rede_social { background: #c13584; } .t-sistema { background: #94a3b8; }

/* Avisos */
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 50; max-width: calc(100% - 40px); }
.toast.err { background: var(--danger); }

/* Menu agrupado */
.nav-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--nav-muted); padding: 14px 12px 4px; }
.nav { overflow-y: auto; }

/* Paciente: cabeçalho, abas e dados */
.p-sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.p-actions { gap: 8px; }
.icon-btn { padding: 0 12px; }
.stepper-card { padding: 14px 20px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line-2); }
.tab { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 0; border-bottom: 2px solid transparent; background: none; font-size: 14px; color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px 32px; }
.info-block h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; font-family: Inter, sans-serif; font-weight: 700; }
.info-block dl, .kv { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.info-block dl div, .kv div { display: flex; flex-direction: column; gap: 2px; }
.info-block dt, .kv dt { font-size: 12px; color: var(--muted); }
.info-block dd, .kv dd { margin: 0; font-size: 15px; }
.empty-val { color: #b8c1cd; }
.ok { color: #136c34; font-weight: 600; }
.pre { white-space: pre-wrap; }
.edit-form fieldset { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 18px 0 4px; }
.edit-form legend { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-ink); padding: 0 10px 0 0; }
.edit-form fieldset .muted { margin-top: 8px; display: block; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(rgba(255,255,255,0), #fff 30%); padding: 16px 0 4px; display: flex; justify-content: flex-end; gap: 10px; }
#iform .row input { flex: 1; min-width: 160px; }

/* Central de mensagens */
.search.slim { min-height: 40px; margin: 4px 4px 8px; min-width: 0; }
.conv-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.conv-side small { font-size: 11px; color: var(--muted); }
.ch.wa { background: #128c4a; font-size: 12px; font-weight: 700; }
.is-wa .conv.active { background: #e3f6ea; }
.is-wa .msg.out { background: #dcf8c6; }
.empty-thread { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty-thread svg { width: 40px; height: 40px; opacity: .4; }
.window-closed { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 12px; padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; font-size: 14px; }
.window-closed p { margin: 0; flex: 1 1 300px; }

/* Ligações, resgate e campanhas */
.seg { gap: 6px; }
.seg .chip { text-decoration: none; color: var(--ink); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.btn.sm.wa svg, .btn.sm svg { width: 15px; height: 15px; }
.aud-list { display: flex; flex-direction: column; gap: 8px; }
.aud { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.aud:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.aud input { margin-top: 3px; width: 18px; height: 18px; }
.aud span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.aud small { color: var(--muted); font-size: 12px; }
.camp { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 14px; }
.camp:first-child { border-top: 0; padding-top: 0; }
.camp .row { justify-content: space-between; }
.progress { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: #128c4a; }

/* Aviso de ligação */
.call-pop { position: fixed; top: 16px; right: 16px; z-index: 60; background: #fff; border: 1px solid var(--line); border-left: 4px solid #128c4a; border-radius: 12px; box-shadow: 0 12px 32px rgba(15,27,45,.2); padding: 14px 16px; display: flex; align-items: center; gap: 12px; max-width: calc(100% - 32px); width: 420px; }
.call-pop > svg { width: 24px; height: 24px; color: #128c4a; flex: none; }
.call-pop div { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 14px; }
.call-pop span { font-size: 13px; color: var(--muted); }
.call-pop .x { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); min-width: 32px; min-height: 32px; }

/* Ficha para impressão */
.print-bar { position: sticky; top: 0; display: flex; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--nav); }
.print-doc { max-width: 860px; margin: 24px auto; background: #fff; padding: 40px 48px; border-radius: 12px; font-size: 13px; color: #111; }
.print-doc h1 { font-size: 26px; margin: 18px 0 4px; }
.print-doc h2 { font-size: 15px; margin: 24px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 1px solid #ddd; padding-bottom: 12px; }
.print-clinic { font-family: Manrope, sans-serif; font-weight: 800; font-size: 16px; }
.print-meta { text-align: right; font-weight: 700; }
.print-meta small { font-weight: 400; color: #555; }
.print-table { width: 100%; border-collapse: collapse; }
.print-table th, .print-table td { border-bottom: 1px solid #e5e5e5; padding: 6px 8px; text-align: left; vertical-align: top; font-size: 12.5px; }
.print-table th { width: 30%; color: #555; font-weight: 600; }
.evo-table th { width: auto; background: #f4f6f8; }
.print-doc .chart { max-width: 100%; }
.print-doc .charts figure { background: #fff; border: 1px solid #eee; }
.print-foot { margin-top: 40px; font-size: 11px; color: #555; }
.sign { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 40px auto 16px; width: 320px; text-align: center; }
.sign span { display: block; width: 100%; border-top: 1px solid #333; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .no-print, .toast, .call-pop { display: none !important; }
  .print-doc { margin: 0; padding: 0; max-width: none; border-radius: 0; }
  .page-break { break-before: page; }
  .print-table tr, .charts figure { break-inside: avoid; }
}
