/* fision. — identidade visual: Brunswick Green #0C4137 · Emerald #06D6A0 · Polar #E6FBF6 · Inter */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/inter-latin-var.woff2") format("woff2"); }
:root {
  color-scheme: light;
  --brand-deep: #0C4137;   /* Brunswick Green */
  --brand: #06D6A0;        /* Emerald */
  --brand-polar: #E6FBF6;  /* Polar */
  --bg: #f3f9f7;
  --surface: #ffffff;
  --surface-2: #f5faf8;
  --surface-3: #ebf5f1;
  --border: #dfece7;
  --border-strong: #cadfd7;
  --text: #0b2a24;
  --text-2: #2b4a43;
  --muted: #5f7b74;
  --primary: #06D6A0;          /* fundos: botões, destaques */
  --primary-text: #04876a;     /* textos e ícones em verde (contraste no branco) */
  --primary-600: #05c391;
  --primary-ink: #022a20;
  --primary-50: rgba(6, 214, 160, .10);
  --primary-100: rgba(6, 214, 160, .26);
  --sidebar: #041210;
  --sidebar-text: #a4c7bd;
  --danger: #d23f3f;
  --danger-50: #fdeeee;
  --amber: #a85d00; --amber-50: #fff4e0;
  --green: #12804f; --green-50: #e4f7ec;
  --blue: #1f5fbf; --blue-50: #eaf1ff;
  --red: #c4302f; --red-50: #fdecec;
  --teal: #04876a; --teal-50: #dff8f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(12,65,55,.05), 0 4px 14px rgba(12,65,55,.05);
  --shadow-lg: 0 24px 60px rgba(4,18,16,.28);
  --glow: 0 0 0 1px rgba(6,214,160,.35), 0 8px 22px rgba(6,214,160,.28);
  --grad: linear-gradient(135deg, #06D6A0 0%, #0C4137 100%);
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
/* áreas escuras da marca: menu lateral, topo no celular e arte da tela de entrada */
.sidebar, .topbar, .auth-art, .doc-viewer-bar {
  color-scheme: dark;
  --text: #e6fbf6; --text-2: #c3e3da; --muted: #86ada3; --border: #173a32; --border-strong: #245247;
  --surface: #0a1c18; --surface-2: #0e241f; --primary-text: #06D6A0;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--text); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  background: radial-gradient(900px 480px at 100% -10%, rgba(6,214,160,.10), transparent 60%), var(--bg);
  background-attachment: fixed;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: 23px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
a { color: var(--primary-text); text-decoration: none; }
button { font: inherit; cursor: pointer; }
small { color: var(--muted); }
::selection { background: rgba(6,214,160,.35); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c7dbd4; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.hidden { display: none !important; }

/* ---------- Marca ---------- */
.fision-logo { display: inline-flex; flex-direction: column; color: #fff; max-width: 100%; }
.fision-logo img { display: block; max-width: 100%; height: auto; }
.fision-tag { display: block; margin-top: 4px; max-width: 190px; font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: #a9d8cb; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, #06201b 0%, var(--sidebar) 45%); border-right: 1px solid #0c2a24; color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40; }
.brand { display: flex; gap: 10px; align-items: center; padding: 22px 20px 20px; color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-deep); display: grid; place-items: center; color: var(--brand); flex: none; }
.brand-mark img { width: 24px; height: 24px; }
.brand b { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 3px; padding: 6px 12px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--sidebar-text); font-weight: 500; border: 1px solid transparent; transition: background .12s, color .12s; }
.nav a:hover { background: rgba(6,214,160,.06); color: #fff; }
.nav a.active { background: linear-gradient(90deg, rgba(6,214,160,.20), rgba(6,214,160,.06)); border-color: rgba(6,214,160,.25); color: #fff; }
.nav a.active svg { color: var(--brand); }
.nav .num { font-size: 11px; color: var(--muted); width: 14px; text-align: right; }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-deep); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; border: 1px solid rgba(6,214,160,.3); }
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who small { color: var(--muted); font-size: 11px; }
.side-foot .icon-btn { color: var(--sidebar-text); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 28px 32px 60px; max-width: 1400px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: block; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.kpi .kpi-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .kpi-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary-text); border: 1px solid var(--primary-100); }
.kpi .kpi-val { font-size: 26px; font-weight: 700; letter-spacing: -.025em; color: var(--text); }
.kpi .kpi-sub { font-size: 12px; color: var(--muted); }
.kpi.warn .kpi-ic { background: var(--amber-50); color: var(--amber); border-color: rgba(251,191,71,.25); }
.kpi.good .kpi-ic { background: var(--green-50); color: var(--green); border-color: rgba(52,211,153,.25); }
.kpi.blue .kpi-ic { background: var(--blue-50); color: var(--blue); border-color: rgba(106,168,255,.25); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 8px 15px; border-radius: 10px; font-weight: 550; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-3); border-color: rgba(6,214,160,.55); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 650; box-shadow: 0 4px 14px rgba(6,214,160,.30); }
.btn.primary:hover { background: #2be3b2; border-color: #2be3b2; box-shadow: var(--glow); }
.btn.danger { background: #e5484d; border-color: #e5484d; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(12,65,55,.06); }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: transparent; border: 0; padding: 6px; border-radius: 8px; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(12,65,55,.07); color: var(--text); }
.sidebar .icon-btn:hover, .topbar .icon-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.btn-group { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.btn-group button { border: 0; background: transparent; padding: 7px 13px; font-weight: 550; color: var(--muted); }
.btn-group button + button { border-left: 1px solid var(--border); }
.btn-group button.on { background: var(--primary-50); color: var(--primary-text); }

.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge.blue { background: var(--blue-50); color: var(--blue); border-color: rgba(106,168,255,.25); }
.badge.green { background: var(--green-50); color: var(--green); border-color: rgba(52,211,153,.25); }
.badge.amber { background: var(--amber-50); color: var(--amber); border-color: rgba(251,191,71,.25); }
.badge.red { background: var(--red-50); color: var(--red); border-color: rgba(255,122,122,.25); }
.badge.teal { background: var(--teal-50); color: var(--teal); border-color: rgba(46,230,192,.25); }
.badge.gray { background: #eef3f1; color: var(--muted); border-color: #e1ebe7; }

/* Tabelas */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: rgba(6,214,160,.05); }
.table td.actions { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 700; background: var(--surface-2); }

/* Formulários */
.form-grid { display: grid; gap: 14px 16px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.span-all { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; margin-top: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); color: var(--primary-text); text-transform: uppercase; font-size: 12px; letter-spacing: .07em; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req { color: var(--danger); }
.help { font-size: 11.5px; }
.input { width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: #fff; color: var(--text); font: inherit; transition: border-color .12s, box-shadow .12s; }
.input::placeholder { color: #98aea8; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(6,214,160,.18); }
select.input option { background: #fff; color: var(--text); }
textarea.input { resize: vertical; min-height: 64px; }
.input[readonly] { background: var(--surface-2); }
.input:disabled { opacity: .6; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 34px; min-width: 240px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; font-size: 13px; cursor: pointer; user-select: none; color: var(--text-2); }
.check:has(input:checked) { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-text); font-weight: 600; }
.check input { accent-color: var(--primary); margin: 0; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); }
.scale { display: grid; grid-template-columns: auto 1fr 40px auto; gap: 12px; align-items: center; }
.scale small { font-size: 11px; }
.scale-out { font-weight: 700; font-size: 18px; text-align: center; }
.range { -webkit-appearance: none; appearance: none; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--tone, var(--primary)) var(--fill, 0%), #dbe8e3 var(--fill, 0%)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--tone, var(--primary)); cursor: pointer; }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--tone, var(--primary)); cursor: pointer; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: thin; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--primary-text); border-bottom-color: var(--primary); }

/* Modal */
.overlay { position: fixed; inset: 0; background: rgba(4,18,16,.55); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .12s; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }

/* Toasts */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { display: flex; gap: 9px; align-items: center; background: #0C4137; border: 1px solid #0C4137; color: #fff; padding: 11px 15px; border-radius: 12px; box-shadow: var(--shadow-lg); max-width: 380px; animation: up .2s; transition: opacity .3s, transform .3s; }
.toast.ok svg { color: var(--brand); }
.toast.error { background: #3a1214; border-color: #6b2226; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-icon { width: 54px; height: 54px; border-radius: 16px; background: var(--primary-50); border: 1px solid var(--primary-100); display: grid; place-items: center; margin: 0 auto 10px; color: var(--primary-text); }
.empty p { margin: 0 0 14px; }
.loading { display: grid; place-items: center; padding: 50px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--primary-100); border-top-color: var(--primary); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--amber-50); color: #7a4706; border: 1px solid #f6dfb5; align-items: flex-start; }
.notice.info { background: var(--primary-50); color: var(--text); border-color: var(--primary-100); }
.notice.info svg { color: var(--primary-text); }
.notice.ok { background: var(--green-50); color: #14532d; border-color: #c4e8cf; }
.notice svg { flex-shrink: 0; margin-top: 1px; }

/* Listas */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item.click { cursor: pointer; }
.list-item.click:hover { background: rgba(6,214,160,.05); }
.time-chip { min-width: 58px; text-align: center; padding: 6px 8px; border-radius: 10px; background: var(--primary-50); border: 1px solid var(--primary-100); color: var(--primary-text); font-weight: 700; font-size: 13px; line-height: 1.15; }
.time-chip small { display: block; color: var(--primary-text); font-weight: 500; font-size: 10.5px; }

/* Prontuário */
.patient-head { display: flex; gap: 16px; align-items: center; padding: 18px; flex-wrap: wrap; }
.patient-head .avatar { width: 56px; height: 56px; font-size: 19px; }
.patient-head .meta { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 4px; }
.dl { display: grid; grid-template-columns: 180px 1fr; gap: 0; }
.dl dt, .dl dd { padding: 9px 0; border-bottom: 1px solid var(--border); margin: 0; }
.dl dt { color: var(--muted); font-size: 12.5px; font-weight: 600; padding-right: 12px; }
.dl dd { white-space: pre-wrap; word-break: break-word; }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }
.view-section { color: var(--primary-text); text-transform: uppercase; font-size: 12px; letter-spacing: .07em; font-weight: 600; margin: 18px 0 4px; }
.view-section:first-child { margin-top: 0; }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-50), 0 0 12px rgba(6,214,160,.6); }
.tl-item .card-body { padding: 14px 16px; }
.tl-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.tl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; margin-top: 10px; }
.tl-grid div b { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tl-grid div span { white-space: pre-wrap; }

.compare { display: grid; gap: 0; overflow-x: auto; }
.compare table { min-width: 600px; }
.compare td { vertical-align: top; white-space: pre-wrap; }
.compare th:first-child, .compare td:first-child { width: 190px; color: var(--muted); font-weight: 600; font-size: 12.5px; }

/* Agenda */
.cal-toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.cal-title { font-size: 17px; font-weight: 650; min-width: 220px; }
.week { display: grid; grid-template-columns: 54px repeat(7, minmax(110px, 1fr)); overflow-x: auto; }
.week.day-view { grid-template-columns: 54px 1fr; }
.wk-head { position: sticky; top: 0; background: var(--surface-2); border-bottom: 1px solid var(--border); padding: 8px; text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; z-index: 2; }
.wk-head b { display: block; font-size: 18px; color: var(--text); }
.wk-head.today b { color: var(--primary-ink); background: var(--primary); border-radius: 50%; width: 32px; height: 32px; line-height: 32px; margin: 2px auto 0; box-shadow: 0 0 14px rgba(6,214,160,.45); }
.wk-hours { border-right: 1px solid var(--border); }
.wk-hour { height: 56px; font-size: 11px; color: var(--muted); text-align: right; padding: 2px 6px 0 0; border-bottom: 1px solid transparent; }
.wk-col { position: relative; border-right: 1px solid var(--border); background-image: repeating-linear-gradient(to bottom, transparent 0 55px, var(--border) 55px 56px); cursor: copy; }
.wk-col.today { background-color: rgba(6,214,160,.035); }
.ev { position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 3px 6px; font-size: 11.5px; overflow: hidden; cursor: pointer; border-left: 3px solid; line-height: 1.25; }
.ev b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.agendado { background: #eaf1ff; border-color: #3b6ef0; color: #1e3a8a; }
.ev.confirmado { background: #dcf9ef; border-color: #06D6A0; color: #065f46; }
.ev.realizado { background: #e6f6ec; border-color: #22a04b; color: #14532d; }
.ev.falta { background: #fdecec; border-color: #dc2626; color: #7f1d1d; }
.ev.cancelado { background: #f0f3f2; border-color: #9aaba6; color: #5b6b67; text-decoration: line-through; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.month .m-head { padding: 8px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.m-cell { min-height: 108px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; cursor: pointer; overflow: hidden; }
.m-cell:nth-child(7n) { border-right: 0; }
.m-cell.other { background: var(--surface-2); color: #a3b5b0; }
.m-cell .d { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.m-cell.today .d { color: var(--primary-ink); background: var(--primary); border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
.m-ev { font-size: 11px; padding: 2px 5px; border-radius: 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; color: var(--text-2); }
.m-ev.agendado { background: #eaf1ff; border-color: #3b6ef0; } .m-ev.confirmado { background: #dcf9ef; border-color: #06D6A0; }
.m-ev.realizado { background: #e6f6ec; border-color: #22a04b; } .m-ev.falta { background: #fdecec; border-color: #dc2626; }
.m-ev.cancelado { background: #f0f3f2; border-color: #9aaba6; text-decoration: line-through; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Gráficos */
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--border); }
.chart text { font-size: 11px; fill: var(--muted); font-family: var(--font); }

/* Login */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: radial-gradient(900px 520px at 0% 0%, rgba(6,214,160,.35), transparent 55%), radial-gradient(700px 600px at 100% 100%, rgba(6,214,160,.22), transparent 60%), linear-gradient(160deg, #0C4137 0%, #04110f 70%); color: var(--text-2); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--border); }
.auth-art h1 { font-size: 36px; color: #fff; line-height: 1.15; max-width: 470px; margin-top: 40px; letter-spacing: -.03em; }
.auth-art h1 em { font-style: normal; color: var(--brand); }
.auth-art p { max-width: 440px; color: #a9cfc5; font-size: 15px; }
.auth-art ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 10px; }
.auth-art li { display: flex; gap: 10px; align-items: center; }
.auth-art li svg { color: var(--brand); }
.auth-form { display: grid; place-items: center; padding: 30px; background: transparent; }
.auth-box { width: min(380px, 100%); }
.auth-box h2 { font-size: 23px; margin-bottom: 6px; }
.auth-box p { color: var(--muted); margin: 0 0 22px; }
.auth-box .btn { width: 100%; padding: 11px; margin-top: 6px; }
.auth-logo-sm { display: none; margin-bottom: 22px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .g-main, .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .app.menu-open .sidebar { transform: none; }
  .app.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 30; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(4,18,16,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; color: var(--text); }
  .topbar b { font-size: 15px; }
  .content { padding: 18px 16px 50px; }
  .g2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-logo-sm { display: inline-flex; }
}
@media (max-width: 640px) {
  .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; } .kpi .kpi-val { font-size: 20px; }
  .dl { grid-template-columns: 1fr; } .dl dt { border-bottom: 0; padding-bottom: 0; }
  .tl-grid { grid-template-columns: 1fr; }
  .search .input { min-width: 0; }
  .search { flex: 1; }
  .table th, .table td { padding: 9px 10px; }
  .hide-sm { display: none; }
  .modal-body { padding: 16px; }
  .scale { grid-template-columns: 1fr 40px; } .scale small { display: none; }
  h1 { font-size: 19px; }
}

/* ---------- Modo demonstração ---------- */
.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 30px; background: var(--amber-50); color: #7c3f06; border-bottom: 1px solid #f6dfb5; font-size: 13px; }
.demo-login { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--text); }
.demo-login:hover { border-color: var(--primary); background: var(--primary-50); }
.demo-login small { font-size: 12px; }
.demo-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.demo-divider::before, .demo-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.doc-viewer { position: fixed; inset: 0; z-index: 150; display: flex; flex-direction: column; background: #0b1a17; padding-top: env(safe-area-inset-top, 0px); }
.doc-viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px max(16px, env(safe-area-inset-left, 0px)); background: var(--sidebar); color: var(--text-2); font-size: 13px; border-bottom: 1px solid var(--border); }
.doc-viewer iframe { flex: 1; width: 100%; border: 0; background: #e9edf0; }
@media (max-width: 900px) { .topbar { top: env(safe-area-inset-top, 0px); } .demo-banner { padding: 8px 16px; } }
.area-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--primary-50); border: 1px solid var(--primary-100); color: var(--primary-text); font-size: 12px; font-weight: 600; margin-bottom: 10px; }
@media (max-width: 640px) {
  .patient-head .row h1 { font-size: 18px; }
  .list-item { flex-wrap: wrap; }
  .page-head > .row, .cal-toolbar > .row { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .patient-head { align-items: flex-start; }
  .patient-head > .grow { flex: 1 1 calc(100% - 72px); }
  .patient-head > .row { width: 100%; }
}

/* ---------- SaaS: cadastro e assinatura ---------- */
.auth-box .auth-switch { margin: 14px 0 0; text-align: center; font-size: 13.5px; }
.auth-box .auth-switch a { font-weight: 600; }
.terms-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--muted); line-height: 1.4; cursor: pointer; }
.terms-check input { accent-color: var(--primary); margin: 2px 0 0; flex: none; }
.billing-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 32px; background: #e9f9f3; color: var(--text-2); border-bottom: 1px solid var(--border); font-size: 13px; }
.billing-banner svg { color: var(--primary-text); }
.billing-banner span { flex: 1; min-width: 200px; }
.billing-banner.warn { background: var(--amber-50); color: #7c3f06; border-bottom-color: #f6dfb5; }
.billing-banner.warn svg { color: var(--amber); }
.billing-banner .btn { margin-left: auto; }
@media (max-width: 900px) { .billing-banner { padding: 8px 16px; } }

/* ---------- Área administrativa da plataforma ---------- */
.admin-mode .brand small { color: var(--brand); }
.admin-banner { background: #e9f9f3; color: var(--text-2); border-bottom-color: var(--border); }

/* ---------- Aplicativo instalável (PWA) ---------- */
.side-install { padding: 0 12px 10px; }
.install-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px dashed rgba(6,214,160,.3); background: transparent; color: var(--sidebar-text); font: inherit; font-weight: 500; cursor: pointer; }
.install-btn:hover { background: rgba(6,214,160,.06); color: #fff; }
.install-btn[hidden], .auth-install .btn[hidden] { display: none; }
.auth-install { display: flex; justify-content: center; margin-top: 14px; }
.offline-banner { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200; display: flex; align-items: center; gap: 10px; max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 12px; background: #0C4137; border: 1px solid #0C4137; color: #fff; font-size: 13px; box-shadow: var(--shadow-lg); }
.offline-banner[hidden] { display: none; }
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); }
  .sidebar { padding-top: env(safe-area-inset-top); }
}

/* ---------- Biblioteca de exercícios ---------- */
.ex-filters { gap: 8px; }
.ex-list .list-item { padding: 10px 14px; }
.ex-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary-text); flex: none; }
.ex-sub { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-steps { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.ex-num { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: 12.5px; flex: none; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.ex-details { margin-top: 10px; }
.ex-details summary { cursor: pointer; color: var(--primary-text); font-weight: 600; font-size: 13px; }
@media (max-width: 900px) { .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* prévia dos modelos de e-mail (admin) — mostra o e-mail como o paciente vê (claro) */
.mail-preview { background: #eef6f3; border: 1px solid var(--border); border-radius: 12px; padding: 14px; color: #0b2a24; }
.mail-subject { margin-bottom: 10px; font-size: 13.5px; }
.mail-subject small { display: block; color: #4b6b63; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.mail-card { background: #fff; border: 1px solid #d5e7e1; border-radius: 12px; padding: 16px 18px; font-size: 14px; }
.mail-card p { margin: 0 0 10px; line-height: 1.5; }
.mail-brand { font-weight: 800; color: #0C4137; margin-bottom: 10px; letter-spacing: -.03em; font-size: 18px; }
.mail-brand i { font-style: normal; color: #06b386; }
.mail-btn { display: inline-block; background: #06D6A0; color: #022a20; padding: 9px 16px; border-radius: 9px; font-weight: 700; margin-top: 4px; }
@media (max-width: 900px) { .tpl-edit { grid-template-columns: 1fr; } }
.switch-row { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.switch-row input { width: 16px; height: 16px; accent-color: var(--primary); }
.qr-box { display: flex; justify-content: center; }
.qr-box svg { width: 210px; height: 210px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.recovery-codes code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; text-align: center; font-size: 14px; letter-spacing: .05em; }
.progress { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--grad); transition: width .3s; }
.ev .ev-pay { display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 6px; font-size: 10.5px; font-weight: 700; background: rgba(255,255,255,.85); }
.ev .ev-pay.green { color: #15803d; } .ev .ev-pay.amber { color: #b45309; } .ev .ev-pay.gray { color: #475569; } .ev .ev-pay.blue { color: #1d4ed8; }

/* WhatsApp conectado (Configurações → WhatsApp) */
.wa-connected { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid #c8ecd5; background: linear-gradient(135deg, #f0fbf4, #fff); border-radius: 14px; }
.wa-avatar { position: relative; width: 56px; height: 56px; flex: none; border-radius: 50%; background: #25d366; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(37,211,102,.35); }
.wa-check { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; background: #128c7e; border: 2px solid var(--surface); display: grid; place-items: center; }
.wa-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.wa-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: #128c7e; font-size: 13px; }
.wa-dot { width: 8px; height: 8px; border-radius: 50%; background: #25d366; box-shadow: 0 0 0 3px rgba(37,211,102,.2); }
.wa-phone { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: .2px; }
.wa-disconnect { color: var(--danger) !important; margin-left: auto; }
.wa-sub { margin: 0; font-size: 15px; font-weight: 700; }
.wa-times { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-end; }
.wa-times .field { margin: 0; }
.wa-time-rule { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.wa-photo { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #fff; }
.wa-name { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; color: var(--text); }
.wa-rename { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 3px; border-radius: 6px; display: inline-grid; place-items: center; }
.wa-rename:hover { background: rgba(6,214,160,.12); color: var(--primary-text); }

/* Tutorial guiado do primeiro acesso */
.tour { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.tour-block { position: fixed; background: rgba(1, 8, 7, .74); pointer-events: auto; transition: all .2s ease; }
.tour-hole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 3px var(--brand), 0 0 26px rgba(6,214,160,.65); pointer-events: none; transition: all .2s ease; animation: tour-pulse 1.6s ease-in-out infinite; }
@keyframes tour-pulse { 50% { box-shadow: 0 0 0 5px var(--brand), 0 0 34px rgba(6,214,160,.85); } }
.tour-card { position: fixed; width: min(340px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); border-radius: 16px; padding: 18px 18px 14px; box-shadow: var(--shadow-lg); pointer-events: auto; display: flex; flex-direction: column; gap: 8px; transition: left .2s ease, top .2s ease; }
.tour-card.center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: min(400px, calc(100vw - 24px)); text-align: center; align-items: center; padding: 26px 24px 18px; }
.tour-card h3 { margin: 0; font-size: 17px; color: var(--text); }
.tour-card p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.tour-card .tour-tip { background: var(--primary-50); border: 1px solid var(--primary-100); color: var(--primary-text); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.tour-step { font-size: 12px; font-weight: 600; color: var(--primary-text); text-transform: uppercase; letter-spacing: .4px; }
.tour-icon { width: 50px; height: 50px; border-radius: 50%; background: var(--brand-deep); border: 1px solid rgba(6,214,160,.4); color: var(--brand); display: grid; place-items: center; box-shadow: 0 0 24px rgba(6,214,160,.3); }
.tour-icon img { width: 30px; height: 30px; }
.tour-dots { display: flex; gap: 5px; margin-top: 2px; }
.tour-dots span { width: 7px; height: 7px; border-radius: 50%; background: #d3e3dd; }
.tour-dots span.on { background: var(--primary); width: 18px; border-radius: 4px; }
.tour-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; width: 100%; justify-content: flex-end; }
.tour-card.center .tour-actions { justify-content: center; }
