:root {
  /* Identidade Ponto. (extraída da apresentação oficial) */
  --brand: #003adb;
  --brand-dark: #00228a;
  --brand-deep: #001657;
  --brand-cyan: #00e5ff;
  --font-brand: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: #f3f5fb;
  --panel: #ffffff;
  --border: #e1e5f0;
  --text: #141a2e;
  --muted: #667085;
  --accent: var(--brand);
  --danger: #dc2626;
  --ok: #059669;
  --warn: #d97706;
  --bubble-in: #ffffff;
  --bubble-out: #dcfce7;
  --bubble-bot: #e0f2fe;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); min-height: 1em; margin: 0; }

h1, h2, h3, .btn, .nav, .seg, .chat-tenant, .tenant-badge { font-family: var(--font-brand); }
h1, h2 { font-weight: 700; letter-spacing: -0.3px; }

/* Botões e campos */
.btn { border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f0f1f4; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--brand-dark); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
.btn.danger { color: var(--danger); border-color: #f5c2c2; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 4px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; background: #fff; width: 100%; }
textarea { resize: vertical; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.row > .btn, .row > .shrink { flex: 0 0 auto; }
.stack { display: grid; gap: 10px; }

/* Login */
/* Login: fundo azul da marca com o símbolo "p." ao fundo, como na capa da apresentação */
.login {
  position: relative; overflow: hidden;
  display: grid; place-items: center; height: 100%; padding: 16px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
}
.login::before {
  content: ""; position: absolute; left: -8vh; bottom: -12vh; width: 70vh; height: 95vh;
  background: url("brand/simbolo-branco.png") no-repeat center / contain; opacity: .14; pointer-events: none;
}
.login-card { position: relative; }
.login-card { background: var(--panel); padding: 36px 32px 28px; border-radius: 18px; width: min(380px, 100%); display: grid; gap: 12px; text-align: center; box-shadow: 0 24px 60px rgba(0, 20, 90, .35); }
.login-card label { text-align: left; }
.login-logo { width: 190px; max-width: 70%; margin: 0 auto; display: block; }
.login-sub { font-family: var(--font-brand); color: var(--brand); font-size: 20px; letter-spacing: 1px; margin: -8px 0 10px; }

/* Layout */
.app { display: grid; grid-template-columns: 210px 1fr; height: 100%; }
.nav { background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 55%, var(--brand-deep) 100%); color: #e5ebff; padding: 20px 12px; display: flex; flex-direction: column; gap: 22px; }
.nav-logo { width: 118px; margin: 0 8px; display: block; }
.nav nav { display: grid; gap: 2px; }
.nav nav button { text-align: left; background: none; border: 0; border-left: 3px solid transparent; color: #c9d6ff; padding: 9px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 500; }
.nav nav button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav nav button.active { background: rgba(255, 255, 255, .14); color: #fff; border-left-color: var(--brand-cyan); font-weight: 600; }
.nav .count { background: var(--brand-cyan); color: var(--brand-deep); font-weight: 700; border-radius: 99px; padding: 0 7px; font-size: 11px; line-height: 18px; }
.nav-footer { margin-top: auto; display: grid; gap: 6px; padding: 0 8px; }
.nav-footer .muted { color: #a9b9ee; }
.nav-footer .btn.ghost { color: #fff; justify-self: start; padding-left: 0; }
main { overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.page { padding: 20px 24px; overflow: auto; height: 100%; }
.page h1 { margin: 0 0 16px; font-size: 20px; }
.toolbar { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar label { min-width: 180px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }

/* Selo do cliente — identificação visual inconfundível */
.tenant-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); border: 1px solid color-mix(in srgb, var(--c) 30%, white); padding: 1px 8px; border-radius: 99px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }

/* Atendimentos */
.inbox { display: grid; grid-template-columns: 340px 1fr 300px; height: 100%; min-height: 0; }
.queue { border-right: 1px solid var(--border); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.queue .filters { padding: 12px; display: grid; gap: 8px; border-bottom: 1px solid var(--border); }
.seg { display: flex; background: #f0f1f4; border-radius: 8px; padding: 2px; }
.seg button { flex: 1; border: 0; background: none; padding: 5px 4px; border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--muted); }
.seg button.active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.queue-list { overflow: auto; flex: 1; }
.conv { padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; border-left: 4px solid var(--c); display: grid; gap: 3px; }
.conv:hover { background: #f8f9fb; }
.conv.selected { background: color-mix(in srgb, var(--c) 7%, white); }
.conv .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.conv .name { font-weight: 600; display: flex; gap: 6px; align-items: center; }
.conv .preview { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv time { color: var(--muted); font-size: 11px; flex: none; }
.unread { background: var(--ok); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; line-height: 17px; }
.flag { color: var(--danger); font-size: 12px; font-weight: 600; }
.pill { font-size: 11px; border-radius: 99px; padding: 0 7px; background: #eef0f3; color: var(--muted); }
.pill.bot { background: #e0f2fe; color: #0369a1; }
.pill.closed { background: #f3f4f6; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* Tempo de espera e dono da conversa */
.meta-line { margin-top: 2px; }
.wait { font-size: 11px; font-weight: 600; border-radius: 99px; padding: 0 7px; line-height: 18px; }
.wait.ok { background: #e7f8ef; color: #047857; }
.wait.warn { background: #fef3c7; color: #92400e; }
.wait.late { background: #fee2e2; color: #b91c1c; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.owner { font-size: 11px; color: var(--muted); white-space: nowrap; }
.owner.me { color: var(--brand); font-weight: 600; }
.owner.none { color: #b45309; }
.pill.optout { background: #fff1e6; color: #9a3412; }
.chat-contact .actions { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.optout-toggle { color: var(--text); font-size: 13px; gap: 8px; }

/* Botões de template (como aparecem no WhatsApp do paciente) */
.tpl-buttons { display: grid; gap: 4px; margin-top: 6px; }
.tpl-buttons span { display: block; text-align: center; background: rgba(255,255,255,.75); border: 1px solid rgba(0,58,219,.18); color: var(--brand); border-radius: 6px; padding: 4px 8px; font-size: 12.5px; font-weight: 600; }
.wa-btn { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 30%, white); }

/* Respostas rápidas */
.qr-wrap { position: relative; }
.qr-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 20, 90, .15); max-height: 320px; overflow: auto; z-index: 20; padding: 4px; }
.qr-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.qr-item:hover, .qr-item.active { background: color-mix(in srgb, var(--brand) 9%, white); }
.qr-item b { color: var(--brand); }
.qr-manage { display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--border); background: none; padding: 8px 10px; color: var(--muted); cursor: pointer; font-size: 12px; margin-top: 4px; }
.qr-manage:hover { color: var(--brand); }

.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #efeae2; }
.chat-head { background: var(--panel); border-bottom: 1px solid var(--border); }
.chat-tenant { background: var(--c); color: #fff; padding: 6px 16px; font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; letter-spacing: .2px; }
.chat-contact { padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-contact strong { font-size: 15px; }
.messages { flex: 1; overflow: auto; padding: 16px 6%; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 75%; padding: 7px 10px 5px; border-radius: 8px; background: var(--bubble-in); box-shadow: 0 1px 1px rgba(0,0,0,.06); align-self: flex-start; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.out { align-self: flex-end; background: var(--bubble-out); }
.msg.out.bot { background: var(--bubble-bot); }
.msg.failed { outline: 1px solid var(--danger); }
.msg .meta { font-size: 10.5px; color: var(--muted); text-align: right; margin-top: 2px; }
.msg .tpl { font-size: 10.5px; color: #0369a1; font-weight: 600; }
.anexo-previa { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg, #f6f7f9); }
.anexo-previa img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; flex: none; }
.anexo-previa .anexo-icone { font-size: 32px; width: 64px; text-align: center; flex: none; }
.anexo-info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.anexo-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anexo-info span { font-size: 12px; color: var(--muted); }
.midia { margin: 2px 0 4px; font-size: 13px; color: var(--muted); }
.midia img { display: block; max-width: min(280px, 100%); max-height: 320px; border-radius: 6px; cursor: zoom-in; }
.midia-sticker img { max-width: 140px; background: none; }
.midia audio { width: 260px; max-width: 100%; height: 40px; }
.midia video { display: block; max-width: min(320px, 100%); border-radius: 6px; }
.midia-doc { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; background: rgba(0,0,0,.05); color: inherit; text-decoration: none; }
.midia-doc span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.midia-doc small { color: #0369a1; font-weight: 600; }
.midia-carregando { font-style: italic; }
.midia-erro { color: var(--danger); }
.msg.note { align-self: center; background: #fff7d6; color: #7a5b00; font-size: 12px; max-width: 90%; text-align: center; }
.composer { background: var(--panel); border-top: 1px solid var(--border); padding: 10px 12px; display: grid; gap: 8px; }
.composer textarea { min-height: 42px; max-height: 160px; }
.window-warn { background: #fff7d6; color: #7a5b00; padding: 8px 10px; border-radius: 8px; font-size: 13px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }

.side { border-left: 1px solid var(--border); background: var(--panel); overflow: auto; padding: 14px; display: grid; gap: 14px; align-content: start; }
.side h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { background: #eef2ff; color: #3730a3; border-radius: 99px; padding: 1px 4px 1px 9px; font-size: 12px; display: inline-flex; align-items: center; gap: 2px; }
.tag button { border: 0; background: none; cursor: pointer; color: #6366f1; padding: 0 4px; }
.appt { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: grid; gap: 4px; font-size: 13px; }
.appt .actions { display: flex; gap: 4px; flex-wrap: wrap; }

.status { font-size: 11px; font-weight: 600; border-radius: 99px; padding: 1px 8px; display: inline-block; }
.status.scheduled { background: #fef3c7; color: #92400e; }
.status.confirmed { background: #d1fae5; color: #065f46; }
.status.cancelled { background: #fee2e2; color: #991b1b; }
.status.done { background: #e0e7ff; color: #3730a3; }
.status.no_show { background: #f3f4f6; color: #4b5563; }

/* Agenda */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.slot { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--panel); cursor: pointer; text-align: left; display: grid; gap: 2px; min-height: 58px; }
.slot .time { font-weight: 700; }
.slot.free { border-color: #a7f3d0; background: #f0fdf4; }
.slot.free:hover { background: #dcfce7; }
.slot.busy { border-left: 4px solid var(--c); }
.slot.blocked { background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 6px, #e5e7eb 6px, #e5e7eb 12px); }
.slot.past { opacity: .5; cursor: default; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }

/* Lista de espera / tabelas */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }
.taglist button { display: flex; justify-content: space-between; width: 100%; text-align: left; }
.taglist button.active { background: #eef2ff; border-color: #c7d2fe; }

/* Modal e toasts */
.modal-bg { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 20px; display: grid; gap: 14px; }
.modal h2 { margin: 0; font-size: 17px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.pick-list { display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.pick-list button { text-align: left; }
.pick-list button.active { background: #eef2ff; border-color: #a5b4fc; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; }
.toast { background: #111827; color: #fff; padding: 10px 14px; border-radius: 10px; max-width: 360px; box-shadow: 0 6px 20px rgba(0,0,0,.2); display: grid; gap: 6px; }
.toast.error { background: var(--danger); }
.toast .btn { justify-self: start; }
.fab { position: fixed; left: 12px; bottom: 150px; z-index: 40; background: #25d366; color: #fff; border: 0; border-radius: 99px; padding: 10px 16px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.2); }

@media (max-width: 1200px) {
  .inbox { grid-template-columns: 300px 1fr; }
  .side { display: none; }
}
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .nav { flex-direction: row; align-items: center; padding: 8px; overflow-x: auto; background: var(--brand); }
  .nav-logo { width: 72px; margin: 0 4px; flex: none; }
  .nav nav { display: flex; }
  .nav-footer { margin: 0; }
  .inbox { grid-template-columns: 1fr; }
  .inbox.has-chat .queue { display: none; }
  .inbox:not(.has-chat) .chat { display: none; }
  .grid2 { grid-template-columns: 1fr; }
}

/* Caixinha de marcar com o texto ao lado */
.check { display: flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
.check > input { flex: none; width: auto; margin: 0; }

/* =====================================================================
   Tema vidro azul — painel e barra lateral
   Fundo azul profundo com luzes; barra lateral de vidro escuro com borda
   luminosa e pílula que desliza; área de trabalho em vidro claro para leitura.
   ===================================================================== */
:root {
  --abismo: #000f45;
  --cobalto: #1a5cff;
  --ceu: #8db8ff;
  --brilho: #00e5ff;
  --vidro-claro: rgba(246, 249, 255, .82);
  --linha: rgba(0, 58, 219, .11);
  --bg: #eef3ff;
  --border: rgba(0, 58, 219, .14);
  --bubble-out: #dce8ff;
  --bubble-bot: #e3fbff;
  --radius: 14px;
  --curva: cubic-bezier(.32, .72, 0, 1);
}

/* Fundo da aplicação: azul profundo com duas luzes suaves (é o que o vidro desfoca) */
.app {
  position: relative; isolation: isolate;
  grid-template-columns: 244px 1fr; gap: 14px; padding: 14px;
  background:
    radial-gradient(42vw 42vw at 6% 4%, rgba(0, 229, 255, .30), transparent 62%),
    radial-gradient(48vw 48vw at 96% 100%, rgba(26, 92, 255, .75), transparent 60%),
    radial-gradient(30vw 30vw at 60% 40%, rgba(70, 120, 255, .25), transparent 70%),
    linear-gradient(140deg, var(--abismo) 0%, var(--brand-deep) 35%, var(--brand) 100%);
}
/* o símbolo do fundo pode vazar da área: corta o excesso para a página não ganhar barra de rolagem */
.app { overflow: hidden; }
.app::after {
  content: ""; position: absolute; left: -6vh; bottom: -10vh; width: 54vh; height: 72vh; z-index: -1;
  background: url("brand/simbolo-branco.png") no-repeat center / contain; opacity: .06; pointer-events: none;
}

/* ---------- Barra lateral de vidro ---------- */
.nav {
  position: relative; border-radius: 26px; padding: 22px 12px 14px; gap: 26px;
  background: linear-gradient(165deg, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, .05) 45%, rgba(0, 20, 90, .25) 100%);
  -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 24px 60px rgba(0, 8, 45, .5);
  color: #e5ecff; overflow: hidden;
}
/* borda luminosa: ciano no alto, some no meio, volta embaixo */
.nav::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(170deg, rgba(0, 229, 255, .95), rgba(141, 184, 255, .35) 28%, rgba(255, 255, 255, .06) 55%, rgba(0, 229, 255, .55) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
/* reflexo de luz no topo */
.nav::after {
  content: ""; position: absolute; top: -40px; left: -30px; width: 200px; height: 140px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(0, 229, 255, .28), transparent); filter: blur(6px);
}
.nav-logo { width: 124px; margin: 2px 10px 0; position: relative; z-index: 1; }

.nav nav { position: relative; display: grid; gap: 4px; z-index: 1; }
.nav nav button {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 11px; justify-content: flex-start;
  border: 0; border-radius: 14px; padding: 10px 12px; background: none;
  color: #b9c9fb; font-weight: 500; letter-spacing: .1px;
  transition: color .25s ease, background-color .25s ease;
}
.nav nav button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav nav button.active { background: none; color: #fff; font-weight: 600; border-left-color: transparent; }
.nav nav button:focus-visible { outline: 2px solid var(--brilho); outline-offset: 2px; }
.nav-ico { width: 20px; height: 20px; flex: none; transition: color .25s ease, filter .25s ease, transform .35s var(--curva); }
.nav nav button:hover .nav-ico { transform: translateX(1px); }
.nav nav button.active .nav-ico { color: var(--brilho); filter: drop-shadow(0 0 6px rgba(0, 229, 255, .7)); }
.nav-txt { flex: 1; text-align: left; white-space: nowrap; }
.nav .count {
  background: linear-gradient(135deg, var(--brilho), #6fd8ff); color: var(--brand-deep);
  box-shadow: 0 0 12px rgba(0, 229, 255, .55); padding: 0 9px; line-height: 24px;
  font-size: 13.5px; font-weight: 800; min-width: 26px; text-align: center;
}

/* pílula de vidro que desliza até o item ativo */
.nav-pill {
  position: absolute; left: 0; top: 0; z-index: 0; border-radius: 14px; pointer-events: none;
  background: linear-gradient(100deg, rgba(0, 229, 255, .20), rgba(255, 255, 255, .10) 55%, rgba(255, 255, 255, .05));
  border: 1px solid rgba(0, 229, 255, .42);
  box-shadow: 0 0 22px rgba(0, 229, 255, .22), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .5s var(--curva), width .5s var(--curva), height .5s var(--curva), opacity .3s ease;
}
.nav-pill::before {
  content: ""; position: absolute; left: -1px; top: 22%; bottom: 22%; width: 3px; border-radius: 3px;
  background: var(--brilho); box-shadow: 0 0 10px var(--brilho);
}
.nav-pill.sem-anim { transition: none; }

.nav-footer {
  position: relative; z-index: 1; padding: 12px; gap: 8px; border-radius: 18px;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12);
}
.nav-footer .muted { color: #c3d1ff; }
.nav-footer .btn.ghost { color: #fff; padding: 5px 10px; border-radius: 10px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); }
.nav-footer .btn.ghost:hover { background: rgba(255, 255, 255, .16); }

/* ---------- Área de trabalho em vidro claro ---------- */
.app > main {
  position: relative; border-radius: 26px; background: var(--vidro-claro);
  -webkit-backdrop-filter: blur(26px) saturate(150%); backdrop-filter: blur(26px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .65);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 24px 60px rgba(0, 8, 45, .35);
}
.page { padding: 26px 30px; }
.page h1 { font-size: 22px; color: var(--brand-deep); margin-bottom: 20px; }

.card {
  background: rgba(255, 255, 255, .72); border: 1px solid rgba(255, 255, 255, .95); border-radius: 18px;
  box-shadow: inset 0 0 0 1px var(--linha), 0 10px 28px rgba(0, 40, 140, .07);
}
table { background: rgba(255, 255, 255, .6); border-radius: 16px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--linha); }
th, td { border-bottom-color: var(--linha); }
th { color: #5b6b99; background: rgba(0, 58, 219, .04); }
tbody tr { transition: background-color .2s ease; }
tbody tr:hover { background: rgba(0, 58, 219, .035); }

/* Botões e campos */
.btn {
  border-radius: 11px; background: rgba(255, 255, 255, .78); border-color: rgba(0, 58, 219, .16);
  transition: background-color .2s ease, box-shadow .25s ease, transform .2s ease, border-color .2s ease;
}
.btn:hover { background: #fff; border-color: rgba(0, 58, 219, .3); box-shadow: 0 4px 14px rgba(0, 58, 219, .12); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--cobalto), var(--brand) 60%, var(--brand-dark));
  border-color: rgba(255, 255, 255, .2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 16px rgba(0, 58, 219, .3);
}
.btn.primary:hover { background: linear-gradient(135deg, #2f6bff, var(--cobalto) 60%, var(--brand)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 8px 24px rgba(0, 58, 219, .45), 0 0 0 3px rgba(0, 229, 255, .18); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn:focus-visible { outline: 2px solid var(--brilho); outline-offset: 2px; }
input, select, textarea {
  border-radius: 11px; background: rgba(255, 255, 255, .85); border-color: rgba(0, 58, 219, .16);
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cobalto); box-shadow: 0 0 0 3px rgba(26, 92, 255, .16), 0 0 14px rgba(0, 229, 255, .18); }
.seg { background: rgba(0, 58, 219, .07); border-radius: 12px; padding: 3px; }
.seg button { white-space: nowrap; border-radius: 9px; transition: background-color .25s ease, color .25s ease, box-shadow .25s ease; }
.seg button.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 2px 8px rgba(0, 40, 140, .12); }

/* Atendimentos: fila, conversa e painel do contato dentro do vidro */
.queue, .side { background: rgba(255, 255, 255, .45); border-color: var(--linha); }
.queue .filters { border-bottom-color: var(--linha); }
.conv { border-bottom-color: var(--linha); transition: background-color .2s ease; }
.conv:hover { background: rgba(255, 255, 255, .7); }
.conv.selected { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 12%, white), rgba(255, 255, 255, .85)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 18%, transparent); }
.chat { background: linear-gradient(180deg, #e9f0ff 0%, #f4f7ff 100%); }
.chat-head { background: rgba(255, 255, 255, .7); border-bottom-color: var(--linha); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.msg { border-radius: 14px; box-shadow: 0 1px 2px rgba(0, 30, 110, .08); }
.msg.out { border-bottom-right-radius: 5px; }
.msg:not(.out):not(.note) { border-bottom-left-radius: 5px; }
.composer { background: rgba(255, 255, 255, .7); border-top-color: var(--linha); }
.qr-pop { border-radius: 16px; background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-color: rgba(255, 255, 255, .9); box-shadow: inset 0 0 0 1px var(--linha), 0 18px 40px rgba(0, 20, 90, .2); }
.appt, .slot { border-radius: 12px; border-color: var(--linha); }
.slot { background: rgba(255, 255, 255, .75); transition: background-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.slot:not(.past):hover { box-shadow: 0 6px 18px rgba(0, 58, 219, .12); transform: translateY(-1px); }
.slot.free { background: rgba(236, 253, 245, .85); }

/* Janelas (modal) e avisos */
.modal-bg { background: rgba(0, 14, 60, .42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fundo-entra .25s ease; }
.modal {
  position: relative; border-radius: 24px; background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 0 #fff, 0 30px 80px rgba(0, 10, 60, .45);
  animation: janela-entra .4s var(--curva);
}
.modal::before {
  content: ""; position: absolute; left: 24px; right: 24px; top: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--brilho), var(--cobalto), transparent);
}
.modal h2 { color: var(--brand-deep); }
@keyframes fundo-entra { from { opacity: 0; } }
@keyframes janela-entra { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.toast { background: rgba(0, 22, 87, .9); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid rgba(0, 229, 255, .3); border-radius: 14px; box-shadow: 0 12px 34px rgba(0, 10, 60, .35); }
.toast.error { background: rgba(185, 28, 28, .92); border-color: rgba(255, 255, 255, .25); }

/* Rolagem fina */
* { scrollbar-width: thin; scrollbar-color: rgba(0, 58, 219, .25) transparent; }

/* Celular e tablet: barra de vidro no topo */
@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; gap: 8px; padding: 8px; }
  .nav { flex-direction: row; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 20px; background: linear-gradient(165deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05)); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .nav::after { display: none; }
  .nav-logo { width: 70px; margin: 0 4px; }
  .nav nav { display: flex; gap: 2px; }
  .nav nav button { padding: 8px 10px; gap: 7px; }
  .nav-footer { padding: 0; background: none; border: 0; }
  .nav-footer #me { display: none; }
  .app > main { border-radius: 20px; }
  .page { padding: 18px 16px; }
}

/* Sem vidro no navegador: cores sólidas equivalentes */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav { background: linear-gradient(180deg, #0a3fd6, var(--brand-deep)); }
  .app > main { background: #f4f7ff; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-pill, .nav-ico, .btn, .slot, .conv { transition: none !important; }
  .modal, .modal-bg { animation: none !important; }
  .wait.late { animation: none; }
}

/* =====================================================================
   Aba ligada ao painel (só no computador)
   O item ativo vira uma aba clara, da mesma cor do painel, que atravessa
   o espaço entre a barra lateral e a área de trabalho, com curvas
   côncavas em cima e embaixo — como uma pasta puxada para fora.
   ===================================================================== */
@media (min-width: 801px) {
  :root { --painel: #f5f8ff; --curva-aba: 18px; }
  .app > aside.nav { overflow: visible; z-index: 2; }
  .app > main {
    z-index: 1; background: var(--painel);
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  /* o reflexo do topo fica dentro da barra (antes era cortado pelo overflow) */
  .nav::after {
    top: 0; left: 0; width: 190px; height: 130px; border-top-left-radius: 26px; filter: none;
    background: radial-gradient(150px 110px at 0 0, rgba(0, 229, 255, .26), transparent 70%);
  }
  .nav-pill {
    background: var(--painel); border: 0; border-radius: 16px 0 0 16px;
    box-shadow: -10px 8px 22px -12px rgba(0, 8, 45, .55);
  }
  /* curvas côncavas que fazem a aba "escorrer" para dentro do painel */
  .nav-pill::before, .nav-pill::after {
    content: ""; position: absolute; left: auto; right: 0; width: var(--curva-aba); height: var(--curva-aba);
    border-radius: 0; box-shadow: none;
  }
  .nav-pill::before {
    top: auto; bottom: 100%;
    background: radial-gradient(circle at 0 0, transparent calc(var(--curva-aba) - .5px), var(--painel) var(--curva-aba));
  }
  .nav-pill::after {
    top: 100%; bottom: auto;
    background: radial-gradient(circle at 0 100%, transparent calc(var(--curva-aba) - .5px), var(--painel) var(--curva-aba));
  }
  .nav nav button.active { color: var(--brand-deep); }
  .nav nav button.active .nav-ico { color: var(--brand); filter: none; }
  .nav nav button.active .count { box-shadow: none; }
  .nav .count { font-size: 15.5px; line-height: 30px; min-width: 32px; padding: 0 11px; }
}

/* Nova conversa: botão na fila e prévia da mensagem */
.queue .filters .nova-conversa { width: 100%; justify-content: center; }
.previa-modelo { background: #e7f1ff; border-radius: 16px 16px 16px 6px; font-size: 14px; line-height: 1.45; }
.previa-botoes { display: flex; gap: 8px; margin-top: 10px; }
.previa-botoes span { flex: 1; text-align: center; padding: 7px 10px; border-radius: 10px; background: #fff; color: var(--brand); font-weight: 600; font-size: 13px; box-shadow: inset 0 0 0 1px var(--linha); }

/* Número bloqueado */
.bloqueado-aviso { font-size: 13px; color: var(--danger, #c62828); background: rgba(198, 40, 40, .07); border-radius: 10px; padding: 8px 10px; }
.so-celular { display: none; }
@media (max-width: 800px) { .so-celular { display: inline-flex; } }
/* Celular: botões da conversa descem para baixo do nome, sem passar da borda */
@media (max-width: 800px) {
  .chat-contact { flex-direction: column; align-items: stretch; }
  .chat-contact .actions { justify-content: flex-start; }
}

/* Financeiro */
.fin-resumo { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.fin-resumo .card { display: grid; gap: 4px; padding: 14px 16px; }
.fin-resumo b { font-size: 22px; }
.fin-pago { color: #15803d; }
.fin-vencido { color: #b91c1c; }
.fin-st { font-size: 12px; font-weight: 700; border-radius: 99px; padding: 2px 10px; white-space: nowrap; }
.fin-st.fin-aberto { background: #fff7e0; color: #9a6700; }
.fin-st.fin-pago { background: #e6f7ec; color: #15803d; }
.fin-st.fin-vencido { background: #fde8e8; color: #b91c1c; }
.fin-st.fin-cancelado { background: #eef1f6; color: #5b6478; }
.fin-acoes { display: flex; gap: 6px; justify-content: flex-end; }
@media (max-width: 800px) {
  .fin-resumo { grid-template-columns: 1fr; }
  #fin-lista { overflow-x: auto; }
}

/* ---------- Telefone no navegador (ramal Nvoip) ---------- */
.sp-chip { display: inline-flex; align-items: center; gap: 7px; justify-self: start; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .08); color: #fff; border-radius: 99px; padding: 5px 11px 5px 9px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.sp-chip:hover { background: rgba(255, 255, 255, .16); }
.sp-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; flex: none; }
.sp-chip[data-status="ready"] .sp-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); }
.sp-chip[data-status="connecting"] .sp-dot { background: #facc15; }
.sp-chip[data-status="error"] .sp-dot { background: #ef4444; }

.sp-card { position: fixed; right: 16px; top: 16px; z-index: 80; width: 300px; max-width: calc(100vw - 32px); background: #fff; color: var(--text); border-radius: 18px; padding: 16px; box-shadow: 0 18px 50px rgba(0, 15, 69, .35); border: 1px solid var(--border); display: grid; gap: 10px; font-family: var(--font-brand); }
.sp-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: none; }
.sp-head b { color: var(--text); font-variant-numeric: tabular-nums; }
.sp-ringing, .sp-live { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.sp-ringing { animation: sp-pulse 1s ease-in-out infinite; }
@keyframes sp-pulse { 50% { box-shadow: 0 0 0 7px rgba(5, 150, 105, .18); } }
.sp-who { display: grid; gap: 2px; }
.sp-who b { font-size: 18px; font-weight: 700; }
.sp-who span { color: var(--muted); font-size: 13px; }
.sp-tenant { font-size: 12px; }
.sp-note { margin: 0; font-size: 12px; color: var(--muted); }
.sp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sp-btn { border: 1px solid var(--border); background: #f1f5ff; border-radius: 12px; padding: 11px 10px; font-weight: 700; cursor: pointer; }
.sp-btn.answer { background: var(--ok); border-color: var(--ok); color: #fff; }
.sp-btn.end { background: var(--danger); border-color: var(--danger); color: #fff; }
.sp-btn.on { background: var(--text); color: #fff; }
.sp-btn:focus-visible { outline: 3px solid var(--brilho); outline-offset: 2px; }
@media (max-width: 800px) {
  .sp-chip { font-size: 0; gap: 0; padding: 7px; }
  .sp-card { left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; }
}
@media (prefers-reduced-motion: reduce) { .sp-ringing { animation: none; } }

/* ---------- WhatsApp por QR Code (uazapi) ---------- */
.wa-box { display: grid; gap: 10px; justify-items: start; }
.wa-box p { margin: 0; }
.wa-st { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.wa-st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.wa-st.ok { color: var(--ok); } .wa-st.ok::before { background: var(--ok); }
.wa-st.warn { color: var(--warn); } .wa-st.warn::before { background: var(--warn); }
.wa-st.erro { color: var(--danger); } .wa-st.erro::before { background: var(--danger); }
.wa-qr { width: 260px; max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border); background: #fff; padding: 8px; justify-self: center; }
.wa-codigo { font: 700 28px/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 3px; padding: 12px 18px; border-radius: 12px; background: #f1f5ff; border: 1px solid var(--border); justify-self: center; }
