/* Atende Fácil — design system
   Estrutura inspirada no painel de referência (cards brancos raio 16 sobre
   fundo cinza claro, sidebar branca com seções, KPIs com card de destaque).
   Identidade própria: teal, menta, azul escuro. */

:root {
  --bg: #F5F5F8;
  --card: #FFFFFF;
  --primary: #0F766E;
  --primary-hover: #0D655E;
  --primary-soft: #CCFBF1;
  --primary-softer: #E6FBF7;
  --accent: #14B8A6;
  --navy: #0B2545;
  --navy-hover: #0F2F58;
  --text: #1E293B;
  --text-2: #475569;
  --muted: #64748B;
  --muted-2: #94A3B8;
  --border: #E6E8EF;
  --border-2: #D8DCE6;
  --success: #16A34A;
  --success-soft: #DCFCE7;
  --warning: #B45309;
  --warning-soft: #FEF3C7;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --info: #1D4ED8;
  --info-soft: #DBEAFE;
  --violet-soft: #EDE9FE;
  --violet: #6D28D9;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .14);
  --sidebar-w: 280px;
  --topbar-h: 76px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
svg.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.text-right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-1 { flex: 1; min-width: 0; }
.gap-sm { gap: 6px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex: none;
  z-index: 30;
}
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  flex: none;
}
.page { padding: 4px 32px 40px; flex: 1; min-width: 0; }
.page-full { padding: 4px 32px 24px; display: flex; flex-direction: column; min-height: calc(100vh - var(--topbar-h)); }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--primary); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 24px; height: 24px; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.01em; color: var(--navy); line-height: 1.1; }
.brand-name small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; color: var(--muted);
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn.bordered { border-color: var(--border); background: var(--card); }

/* Seletor de clínica (pill escuro) */
.clinic-pill {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--navy); color: #fff; border-radius: 999px; padding: 8px 8px 8px 16px;
  font-weight: 600; font-size: 14px;
}
.clinic-pill .caret { width: 30px; height: 30px; border-radius: 999px; background: rgba(255,255,255,.14); display: grid; place-items: center; }
.clinic-pill .caret svg { width: 16px; height: 16px; }

/* Navegação */
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-section { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.nav-section::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: var(--text-2); font-weight: 500; font-size: 14px; transition: background .15s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .ic { color: inherit; }
.nav-item .badge { margin-left: auto; }

.sidebar-foot { margin-top: auto; }
.wa-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  text-align: center; box-shadow: var(--shadow);
}
.wa-card .wa-icon { width: 48px; height: 48px; border-radius: 999px; margin: -42px auto 8px; display: grid; place-items: center; background: var(--success-soft); color: var(--success); border: 4px solid var(--card); }
.wa-card .wa-icon.off { background: var(--danger-soft); color: var(--danger); }
.wa-card .wa-icon svg { width: 22px; height: 22px; }
.wa-card h4 { font-size: 15px; margin-bottom: 4px; }
.wa-card p { color: var(--muted); font-size: 12px; margin-bottom: 12px; }

/* ---------- Topbar ---------- */
.search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 0 18px; height: 46px; color: var(--muted);
}
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; color: var(--text); }
.search input::placeholder { color: var(--muted-2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.pill-info { display: flex; align-items: center; gap: 8px; background: #E9EAF2; border-radius: 999px; padding: 8px 14px; font-size: 13px; color: var(--text-2); }
.pill-info b { color: var(--navy); }
.bell { position: relative; }
.bell .dot { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); }
.user-menu { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.user-menu .user-text { text-align: right; line-height: 1.2; }
.user-menu .user-text b { display: block; font-size: 14px; }
.user-menu .user-text span { font-size: 12px; color: var(--muted); }
.user-menu .avatar { width: 44px; height: 44px; font-size: 15px; }

/* ---------- Título de página ---------- */
.page-head { display: flex; align-items: center; gap: 14px; margin: 14px 0 22px; flex-wrap: wrap; }
.page-head .title-icon { width: 36px; height: 36px; border-radius: 999px; border: 1.5px solid var(--primary); color: var(--primary); display: grid; place-items: center; flex: none; }
.page-head .title-icon svg { width: 18px; height: 18px; }
.page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; color: var(--text); line-height: 1.15; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 16px; font-weight: 600; }
.card-head .ic { color: var(--muted); width: 18px; height: 18px; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body-flush { margin: 0 -20px -20px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-kpi { grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-2-1 { grid-template-columns: 2fr 1fr; }

/* KPI */
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-height: 130px; position: relative; }
.kpi .kpi-title { display: flex; align-items: flex-start; gap: 10px; color: var(--text-2); font-size: 15px; font-weight: 500; line-height: 1.3; }
.kpi .kpi-title .ic { color: var(--muted); width: 18px; height: 18px; margin-top: 1px; }
.kpi .kpi-value { font-size: 32px; font-weight: 700; letter-spacing: -.02em; text-align: right; color: var(--text); line-height: 1.1; margin-top: auto; }
.kpi .kpi-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.kpi.dark { background: var(--navy); color: #fff; }
.kpi.dark .kpi-title, .kpi.dark .kpi-value, .kpi.dark .kpi-foot { color: #fff; }
.kpi.dark .kpi-title .ic { color: rgba(255,255,255,.75); }
.kpi.dark .kpi-foot { color: rgba(255,255,255,.75); }
.delta { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; font-weight: 600; font-size: 12px; }
.delta.up { background: var(--success-soft); color: var(--success); }
.delta.down { background: var(--danger-soft); color: var(--danger); }
.delta.flat { background: #E9EAF2; color: var(--text-2); }
.kpi.dark .delta { background: rgba(255,255,255,.14); color: #fff; }

/* ---------- Chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.chip.no-dot::before { display: none; }
.chip-success { background: var(--success-soft); color: #15803D; }
.chip-warning { background: var(--warning-soft); color: var(--warning); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-teal { background: var(--primary-soft); color: var(--primary); }
.chip-neutral { background: #E9EAF2; color: var(--text-2); }
.chip-violet { background: var(--violet-soft); color: var(--violet); }
.badge { min-width: 20px; height: 20px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; padding: 0 6px; }

/* ---------- Avatar ---------- */
.avatar { width: 40px; height: 40px; border-radius: 999px; display: inline-grid; place-items: center; font-weight: 600; font-size: 14px; flex: none; background: var(--primary-soft); color: var(--primary); position: relative; }
.avatar.lg { width: 96px; height: 96px; font-size: 32px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.tone-1 { background: #CCFBF1; color: #0F766E; }
.avatar.tone-2 { background: #DBEAFE; color: #1D4ED8; }
.avatar.tone-3 { background: #FEF3C7; color: #B45309; }
.avatar.tone-4 { background: #FCE7F3; color: #BE185D; }
.avatar.tone-5 { background: #EDE9FE; color: #6D28D9; }
.avatar.tone-6 { background: #DCFCE7; color: #15803D; }
.avatar .wa-dot { position: absolute; bottom: -2px; left: -2px; width: 16px; height: 16px; border-radius: 999px; background: #25D366; border: 2px solid #fff; display: grid; place-items: center; }
.avatar .wa-dot svg { width: 9px; height: 9px; fill: #fff; stroke: none; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; font-size: 14px; background: var(--card); color: var(--text); transition: background .15s, box-shadow .15s; white-space: nowrap; }
.btn .ic { width: 18px; height: 18px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-hover); }
.btn-teal { background: var(--primary); color: #fff; }
.btn-teal:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline { border-color: var(--border-2); background: var(--card); color: var(--text); }
.btn-outline:hover:not(:disabled) { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #FECACA; }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover:not(:disabled) { background: #B5F5E8; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn-xs { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-square { border-radius: 12px; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }

/* ---------- Tabs (pill) ---------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: 14px; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--primary); color: #fff; }
.tab .count { font-size: 11px; font-weight: 600; opacity: .8; }
.tabs-line { display: flex; gap: 6px; border-bottom: 1px solid var(--border); }
.tabs-line .tab { border-radius: 0; height: 46px; padding: 0 18px; background: transparent !important; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-line .tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Tabela ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table td.wrap { white-space: normal; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #FAFAFC; }
.table .cell-main { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.table .kebab { margin-left: auto; }
.table .actions-cell { display: flex; gap: 6px; justify-content: flex-end; }

/* Lista de itens com avatar (estilo lista de agentes) */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 6px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.list-item .li-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.list-item .li-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.list-item .li-time { font-size: 12px; color: var(--muted); }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label, .label { font-weight: 600; font-size: 13px; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border-2); border-radius: 10px; background: var(--card); padding: 0 16px; height: 52px; outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20, 184, 166, .18); }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input.sm, .select.sm { height: 42px; padding: 0 12px; }
.textarea { height: auto; min-height: 140px; padding: 14px 16px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.input-icon { position: relative; }
.input-icon .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.input-icon .input { padding-left: 42px; }
.input-icon .toggle-eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); display: grid; place-items: center; }
.counter { text-align: right; font-size: 12px; color: var(--muted); margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-error { color: var(--danger); background: var(--danger-soft); border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 500; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* Segmentado (tom de voz) */
.segment { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.segment button { height: 54px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--card); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: 13px; color: var(--text-2); }
.segment button.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Toggle */
.toggle { position: relative; width: 52px; height: 28px; border-radius: 999px; background: #D5D9E2; border: 0; padding: 0; flex: none; transition: background .2s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 999px; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle.on { background: var(--navy); }
.toggle.on::after { transform: translateX(24px); }
.toggle:disabled { opacity: .5; }

/* Lista de opções com ícone + título + descrição + controle (tela do agente) */
.option-row { display: flex; align-items: center; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.option-row:last-child { border-bottom: 0; }
.option-row .opt-icon { width: 28px; color: var(--text); display: grid; place-items: center; flex: none; }
.option-row .opt-icon .ic { width: 24px; height: 24px; }
.option-row .opt-body { flex: 1; min-width: 0; }
.option-row .opt-title { font-weight: 600; font-size: 15px; }
.option-row .opt-desc { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.45; }

/* ---------- Estado vazio ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .empty-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 16px; }
.empty .empty-icon .ic { width: 26px; height: 26px; }
.empty h3 { font-size: 20px; color: var(--text); margin-bottom: 8px; }
.empty p { max-width: 380px; line-height: 1.55; }
.empty .stats { display: flex; gap: 40px; margin-top: 28px; }
.empty .stats b { display: block; font-size: 22px; color: var(--text); }
.empty .stats .warn b { color: #D97706; }
.empty .stats span { font-size: 12px; }
.empty .legend { display: flex; gap: 20px; margin-top: 20px; font-size: 12px; }
.empty .legend i { display: inline-block; width: 7px; height: 7px; border-radius: 999px; margin-right: 6px; background: var(--primary); }
.empty .legend i.green { background: var(--success); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 37, 69, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; backdrop-filter: blur(2px); }
.modal { background: var(--card); border-radius: 20px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal.lg { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 12px; }
.modal-head h3 { font-size: 20px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 8px 24px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 24px 24px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; display: flex; gap: 10px; align-items: center; animation: pop .18s ease-out; max-width: 360px; }
.toast.success { background: #166534; }
.toast.error { background: #991B1B; }

/* ---------- Paginação ---------- */
.pagination { display: flex; align-items: center; gap: 6px; padding: 14px 4px 0; font-size: 13px; color: var(--muted); }
.pagination .pages { margin: 0 auto; display: flex; gap: 4px; }
.pagination .pg { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.pagination .pg.active { background: var(--navy); color: #fff; font-weight: 700; }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: 400px 1fr; gap: 16px; flex: 1; min-height: 0; }
.inbox-list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.inbox-list-head { padding: 16px 16px 0; }
.inbox-list-head .search { height: 42px; max-width: none; background: var(--bg); border-color: transparent; }
.inbox-list-head .tabs { margin: 12px 0 0; padding-bottom: 12px; border-bottom: 1px solid var(--border); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.inbox-list-head .tabs::-webkit-scrollbar { display: none; }
.inbox-list-head .tab { height: 34px; padding: 0 11px; font-size: 13px; white-space: nowrap; flex: none; }
.inbox-scroll { overflow-y: auto; flex: 1; padding: 6px 8px 12px; }
.inbox-group { font-size: 12px; color: var(--muted); font-weight: 500; padding: 12px 10px 6px; }
.conv { display: flex; gap: 12px; padding: 12px 10px; border-radius: 12px; cursor: pointer; align-items: flex-start; }
.conv:hover { background: #FAFAFC; }
.conv.active { background: var(--primary-softer); }
.conv .conv-body { flex: 1; min-width: 0; }
.conv .conv-name { font-weight: 600; font-size: 14px; }
.conv .conv-preview { color: var(--muted); font-size: 13px; margin-top: 2px; }
.conv .conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.conv .conv-time { font-size: 11px; color: var(--muted); }
.conv .chip { margin-top: 6px; }

.inbox-pane { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chat-head .chat-who b { display: block; font-size: 15px; }
.chat-head .chat-who span { font-size: 12px; color: var(--muted); }
.chat-head .chat-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; background: #F9FAFC; }
.bubble { max-width: 72%; padding: 10px 14px; border-radius: 14px; line-height: 1.5; font-size: 14px; position: relative; box-shadow: 0 1px 1px rgba(15,23,42,.05); white-space: pre-wrap; word-wrap: break-word; }
.bubble.in { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--primary-soft); border-bottom-right-radius: 4px; }
.bubble.out.human { background: #DBEAFE; }
.bubble .b-author { display: block; font-size: 11px; font-weight: 700; color: var(--primary); margin-bottom: 2px; text-transform: uppercase; letter-spacing: .04em; }
.bubble.human .b-author { color: var(--info); }
.bubble .b-time { display: block; font-size: 10px; color: var(--muted); text-align: right; margin-top: 4px; }
.bubble.system { align-self: center; background: #E9EAF2; color: var(--text-2); font-size: 12px; border-radius: 999px; padding: 6px 14px; box-shadow: none; }
.day-sep { align-self: center; font-size: 11px; color: var(--muted); background: #E9EAF2; padding: 4px 12px; border-radius: 999px; margin: 6px 0; }
.chat-foot { border-top: 1px solid var(--border); padding: 12px 16px 14px; }
.chat-foot .quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chat-foot .quick button { border: 1px solid var(--border-2); background: var(--card); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.chat-foot .quick button:hover { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.composer { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; min-height: 46px; max-height: 140px; border: 1px solid var(--border-2); border-radius: 14px; padding: 12px 14px; resize: none; outline: 0; line-height: 1.4; }
.composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20,184,166,.18); }
.composer-locked { background: var(--warning-soft); color: var(--warning); border-radius: 12px; padding: 12px 14px; font-size: 13px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------- Agenda ---------- */
.agenda-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.agenda-toolbar .seg { display: inline-flex; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.agenda-toolbar .seg button { border: 0; background: transparent; border-radius: 999px; height: 34px; padding: 0 16px; font-weight: 600; color: var(--text-2); }
.agenda-toolbar .seg button.active { background: var(--primary); color: #fff; }
.agenda-toolbar .select { width: auto; min-width: 200px; }
.agenda-day { margin-bottom: 20px; }
.agenda-day-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.agenda-day-title h3 { font-size: 15px; }
.agenda-day-title h3::first-letter { text-transform: uppercase; }
.agenda-day-title span { font-size: 12px; color: var(--muted); }
.appt { display: grid; grid-template-columns: 76px 1fr auto; gap: 14px; align-items: center; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 10px; border-left: 4px solid var(--primary); cursor: pointer; }
.appt.confirmado { border-left-color: var(--success); }
.appt.cancelado { border-left-color: var(--danger); opacity: .75; }
.appt.faltou { border-left-color: #D97706; }
.appt.realizado { border-left-color: var(--muted-2); }
.appt .appt-time b { display: block; font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.appt .appt-time span { font-size: 11px; color: var(--muted); }
.appt .appt-main b { font-size: 15px; font-weight: 600; display: block; }
.appt .appt-main span { font-size: 13px; color: var(--muted); }
.appt .appt-right { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.week .wday { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px; min-height: 360px; }
.week .wday.today { outline: 2px solid var(--accent); }
.week .wday-head { text-align: center; margin-bottom: 10px; }
.week .wday-head b { display: block; font-size: 20px; }
.week .wday-head span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.week .wappt { border-radius: 8px; padding: 6px 8px; font-size: 12px; margin-bottom: 6px; background: var(--primary-soft); color: var(--primary); cursor: pointer; border-left: 3px solid var(--primary); }
.week .wappt.confirmado { background: var(--success-soft); color: #15803D; border-left-color: var(--success); }
.week .wappt.cancelado { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; border-left-color: var(--danger); }
.week .wappt.faltou { background: var(--warning-soft); color: var(--warning); border-left-color: #D97706; }
.week .wappt.realizado { background: #E9EAF2; color: var(--text-2); border-left-color: var(--muted-2); }
.week .wappt b { display: block; }

/* ---------- Tela do agente ---------- */
.agent-layout { display: grid; grid-template-columns: 300px 1fr; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); min-height: 640px; overflow: hidden; }
.agent-layout > * { min-width: 0; }
.agent-side { padding: 32px 24px; border-right: 1px dashed var(--border-2); display: flex; flex-direction: column; align-items: center; }
.agent-side .avatar.lg { background: var(--primary-soft); color: var(--primary); border: 4px solid #fff; box-shadow: 0 0 0 2px var(--primary-soft); }
.agent-side .avatar .edit { position: absolute; right: -2px; bottom: 2px; width: 30px; height: 30px; border-radius: 999px; background: var(--accent); color: #fff; display: grid; place-items: center; border: 2px solid #fff; }
.agent-side .avatar .edit svg { width: 14px; height: 14px; }
.agent-side .agent-name { margin-top: 14px; font-size: 17px; font-weight: 600; }
.agent-side .agent-role { color: var(--muted); font-size: 13px; margin-top: 3px; }
.agent-side .agent-model { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-weight: 600; font-size: 13px; }
.agent-menu { width: 100%; margin-top: 26px; display: flex; flex-direction: column; gap: 4px; }
.agent-menu button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 18px; border: 0; background: transparent; border-radius: 12px; font-size: 15px; color: var(--text-2); text-align: left; }
.agent-menu button.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.agent-side .test-btn { margin-top: 28px; width: 96px; height: 56px; border-radius: 999px; background: var(--navy); color: #fff; border: 0; font-weight: 600; font-size: 13px; line-height: 1.2; display: flex; align-items: center; justify-content: center; gap: 6px; }
.agent-side .test-btn .ic { width: 14px; height: 14px; }
.agent-main { padding: 32px 48px 40px; min-width: 0; }
.agent-main h2 { font-size: 17px; font-weight: 600; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.agent-panel { display: none; }
.agent-panel.active { display: block; }
.faq-item { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: start; margin-bottom: 10px; }
.faq-item .textarea { min-height: 52px; }
.chip-input { display: flex; flex-wrap: wrap; gap: 6px; border: 1px solid var(--border-2); border-radius: 10px; padding: 8px; min-height: 52px; }
.chip-input .chip { height: 30px; padding: 0 10px; }
.chip-input .chip button { border: 0; background: transparent; padding: 0; color: inherit; display: grid; place-items: center; }
.chip-input input { border: 0; outline: 0; flex: 1; min-width: 140px; padding: 0 6px; }

/* Simulador (chat de teste estilo WhatsApp) */
.sim { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; height: 560px; max-width: 520px; }
.sim-head { background: var(--primary); color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.sim-head .avatar { background: rgba(255,255,255,.2); color: #fff; }
.sim-head b { display: block; font-size: 14px; }
.sim-head span { font-size: 11px; opacity: .85; }
.sim-body { flex: 1; overflow-y: auto; padding: 16px; background: #ECE5DD; background-image: radial-gradient(rgba(255,255,255,.35) 1px, transparent 1px); background-size: 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.sim-body .bubble.in { background: #fff; }
.sim-body .bubble.out { background: #D9FDD3; }
.sim-body .typing { align-self: flex-start; background: #fff; padding: 10px 14px; border-radius: 14px; display: flex; gap: 4px; }
.sim-body .typing i { width: 6px; height: 6px; border-radius: 999px; background: var(--muted-2); animation: blink 1s infinite; }
.sim-body .typing i:nth-child(2) { animation-delay: .2s; }
.sim-body .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.sim-foot { display: flex; gap: 8px; padding: 10px; background: #F0F2F5; }
.sim-foot input { flex: 1; border: 0; border-radius: 999px; padding: 0 16px; height: 42px; outline: 0; background: #fff; }
.sim-foot button { width: 42px; height: 42px; border-radius: 999px; border: 0; background: var(--primary); color: #fff; display: grid; place-items: center; }

/* ---------- Configurações / WhatsApp ---------- */
.qr-box { display: grid; grid-template-columns: 240px 1fr; gap: 28px; align-items: center; }
.qr-frame { width: 240px; height: 240px; border-radius: 16px; border: 1px solid var(--border); display: grid; place-items: center; background: #fff; overflow: hidden; }
.qr-frame img { width: 100%; height: 100%; object-fit: contain; }
.qr-placeholder { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }
.status-big { display: flex; align-items: center; gap: 14px; }
.status-big .wa-icon { width: 56px; height: 56px; border-radius: 999px; display: grid; place-items: center; background: var(--success-soft); color: var(--success); }
.status-big .wa-icon.off { background: var(--danger-soft); color: var(--danger); }
.status-big .wa-icon svg { width: 26px; height: 26px; }
.status-big b { display: block; font-size: 17px; }
.status-big span { color: var(--muted); font-size: 13px; }
.steps { color: var(--text-2); font-size: 13px; line-height: 1.7; margin-top: 12px; padding-left: 18px; }
.hours-grid { display: flex; flex-direction: column; gap: 8px; }
.hours-row { display: grid; grid-template-columns: 120px 1fr 16px 1fr; gap: 10px; align-items: center; }
.hours-row .day { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.hours-row .input { height: 42px; padding: 0 12px; }
.hours-row.off .input { opacity: .4; pointer-events: none; }
.hours-row .toggle { width: 40px; height: 22px; }
.hours-row .toggle::after { width: 16px; height: 16px; }
.hours-row .toggle.on::after { transform: translateX(18px); }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-left { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #FAFAFC; }
.login-card { width: 100%; max-width: 440px; }
.login-card .brand { margin-bottom: 40px; }
.login-card .brand-mark { width: 52px; height: 52px; border-radius: 16px; }
.login-card .brand-mark svg { width: 30px; height: 30px; }
.login-card .brand-name { font-size: 24px; }
.login-card h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.login-card .sub { color: var(--muted); margin: 6px 0 28px; }
.login-card .btn-primary { height: 52px; border-radius: 12px; text-transform: uppercase; letter-spacing: .06em; font-size: 13px; }
.login-card .foot { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 20px; text-align: center; color: var(--muted); font-size: 12px; }
.login-right { background: var(--navy); color: #fff; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; text-align: center; }
.login-right::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 999px; background: radial-gradient(circle, rgba(20,184,166,.45), transparent 65%); top: -160px; right: -160px; }
.login-right::after { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 999px; background: radial-gradient(circle, rgba(15,118,110,.55), transparent 65%); bottom: -160px; left: -140px; }
.login-right h2 { font-size: 36px; font-weight: 700; letter-spacing: -.02em; position: relative; z-index: 1; }
.login-right p { max-width: 460px; color: rgba(255,255,255,.8); font-size: 16px; line-height: 1.6; margin-top: 14px; position: relative; z-index: 1; }
.login-right .orbit { position: relative; z-index: 1; margin-top: 40px; width: 360px; height: 360px; }
.login-right .orbit .ring { position: absolute; inset: 0; border-radius: 999px; border: 1px solid rgba(255,255,255,.14); }
.login-right .orbit .ring.r2 { inset: 50px; border-color: rgba(20,184,166,.35); }
.login-right .orbit .ring.r3 { inset: 100px; border-color: rgba(255,255,255,.08); }
.login-right .orbit .center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 84px; height: 84px; border-radius: 999px; background: var(--primary); display: grid; place-items: center; box-shadow: 0 0 0 14px rgba(15,118,110,.25); }
.login-right .orbit .center svg { width: 40px; height: 40px; }
.login-right .orbit .sat { position: absolute; width: 52px; height: 52px; border-radius: 999px; background: #fff; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.login-right .orbit .sat svg { width: 26px; height: 26px; }
.login-right .dots { display: flex; gap: 6px; margin-top: 28px; position: relative; z-index: 1; }
.login-right .dots i { width: 8px; height: 4px; border-radius: 999px; background: rgba(255,255,255,.35); }
.login-right .dots i.on { width: 28px; background: #fff; }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg, #EEF0F5 25%, #F7F8FB 50%, #EEF0F5 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Responsivo ---------- */
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(11,37,69,.4); z-index: 25; }
.menu-btn { display: none; }
@media (max-width: 1240px) {
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 340px 1fr; }
  .agent-layout { grid-template-columns: 260px 1fr; }
  .agent-main { padding: 28px 28px 36px; }
  .search { max-width: 280px; }
  .pill-info { display: none; }
}
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 16px; height: 64px; gap: 10px; }
  .page, .page-full { padding: 4px 16px 32px; }
  .page-full { min-height: calc(100vh - 64px); }
  .search { max-width: none; }
  .user-menu .user-text { display: none; }
  .page-head h1 { font-size: 24px; }
  .grid-2 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; }
  .inbox.showing-chat .inbox-list { display: none; }
  .inbox:not(.showing-chat) .inbox-pane { display: none; }
  .back-btn { display: inline-flex !important; }
  .agent-layout { grid-template-columns: 1fr; }
  .agent-side { border-right: 0; border-bottom: 1px dashed var(--border-2); padding: 24px 16px; }
  .agent-menu { flex-direction: row; overflow-x: auto; gap: 6px; max-width: 100%; scrollbar-width: none; justify-content: flex-start; }
  .agent-menu::-webkit-scrollbar { display: none; }
  .week .wday { min-height: 0; }
  .agent-menu button { width: auto; white-space: nowrap; padding: 10px 14px; font-size: 14px; }
  .agent-main { padding: 20px 16px 28px; }
  .week { grid-template-columns: repeat(2, 1fr); }
  .qr-box { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .login-page { grid-template-columns: 1fr; }
  .login-right { display: none; }
}
@media (max-width: 600px) {
  .grid-kpi { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 14px; min-height: 116px; }
  .kpi .kpi-title { font-size: 13px; }
  .kpi .kpi-value { font-size: 26px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .segment { grid-template-columns: 1fr; }
  .faq-item { grid-template-columns: 1fr; }
  .appt { grid-template-columns: 64px 1fr; }
  .appt .appt-right { grid-column: 1 / -1; justify-content: flex-start; }
  .week { grid-template-columns: 1fr; }
  .hours-row { grid-template-columns: 100px 1fr 12px 1fr; gap: 6px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .bubble { max-width: 88%; }
  .search { display: none; }
  .inbox-list-head .search { display: flex; }
  .card { padding: 16px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .empty .stats { gap: 24px; }
  .chat-head .chat-actions { margin-left: 0; width: 100%; }
  .chat-head .chat-actions .btn { flex: 1; }
  .sim { height: 480px; }
}
@media (max-width: 360px) {
  .grid-kpi { grid-template-columns: 1fr; }
  .tab { padding: 0 12px; font-size: 13px; }
}

/* ---------- Cadastro público ---------- */
.login-card .field.invalid .input { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.field-error { display: none; color: var(--danger); font-size: 12px; font-weight: 500; }
.field.invalid .field-error { display: block; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text-2); line-height: 1.45; cursor: pointer; font-weight: 400; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--primary); flex: none; }
.login-card .promo { display: inline-flex; align-items: center; gap: 8px; background: var(--primary-softer); color: var(--primary); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; margin-bottom: 18px; }
.login-card .promo .ic { width: 16px; height: 16px; }
.login-card .foot .link { font-weight: 600; }

/* ---------- Banner de trial ---------- */
.trial-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--primary-softer); border: 1px solid var(--primary-soft); color: var(--primary); border-radius: 12px; padding: 10px 16px; font-size: 13px; font-weight: 500; margin: 4px 0 16px; }
.trial-banner .ic { width: 18px; height: 18px; flex: none; }
.trial-banner span { flex: 1; min-width: 200px; }
.trial-banner.expired { background: var(--warning-soft); border-color: #FDE68A; color: var(--warning); }
.trial-banner .btn { height: 32px; padding: 0 14px; font-size: 12px; }

/* ---------- Menu de contexto (admin) ---------- */
.ctx-menu { position: absolute; z-index: 60; min-width: 220px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.ctx-menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; }
.ctx-menu button:hover:not(:disabled) { background: var(--bg); }
.ctx-menu button:disabled { opacity: .45; cursor: default; }
.ctx-menu .ic { width: 16px; height: 16px; }
.actions-cell { white-space: nowrap; }
.actions-cell .icon-btn { margin-left: 4px; }

/* ===================== CRM ===================== */

/* Barra de ferramentas (busca + filtros + ações) */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { height: 44px; max-width: none; flex: 1; min-width: 220px; background: var(--bg); border-color: transparent; }
.toolbar .select.sm, .toolbar .input.sm { width: auto; min-width: 150px; }
.toolbar .spacer { flex: 1; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .select.sm { min-width: 0; padding-right: 34px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 12px; font-weight: 600; }
.filter-chip button { border: 0; background: rgba(15,118,110,.12); color: inherit; width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; padding: 0; }
.filter-chip button .ic { width: 12px; height: 12px; }

/* Etiquetas com cor livre */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.6; background: var(--tag-bg, #E9EAF2); color: var(--tag-fg, var(--text-2)); }
.tag.sm { font-size: 11px; padding: 1px 7px; }
.tag button { border: 0; background: transparent; color: inherit; padding: 0; display: grid; place-items: center; opacity: .7; }
.tag button:hover { opacity: 1; }
.tag button .ic { width: 12px; height: 12px; }
.tag-list { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.tag-add { border: 1px dashed var(--border-2); background: transparent; color: var(--muted); border-radius: 8px; height: 24px; padding: 0 8px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.tag-add:hover { border-color: var(--primary); color: var(--primary); }
.tag-add .ic { width: 12px; height: 12px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 999px; border: 3px solid transparent; cursor: pointer; padding: 0; }
.swatch.active { border-color: var(--navy); box-shadow: 0 0 0 2px #fff inset; }
.color-dot { width: 12px; height: 12px; border-radius: 999px; display: inline-block; flex: none; }

/* Tabela de pacientes */
.table td.check, .table th.check { width: 36px; padding-right: 0; }
.table input[type="checkbox"], .check-all { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.table tr.selectable { cursor: pointer; }
.table tr.selected td { background: var(--primary-softer); }
.cell-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.stage { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.stage .color-dot { width: 8px; height: 8px; }
.stale { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--warning); background: var(--warning-soft); border-radius: 6px; padding: 2px 6px; }
.stale.danger { color: var(--danger); background: var(--danger-soft); }
.stale .ic { width: 12px; height: 12px; }
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--navy); color: #fff; border-radius: 12px; padding: 8px 8px 8px 16px; margin-bottom: 12px; font-size: 13px; font-weight: 500; animation: pop .15s ease-out; }
.bulk-bar .btn { height: 34px; padding: 0 12px; font-size: 13px; background: rgba(255,255,255,.12); color: #fff; }
.bulk-bar .btn:hover { background: rgba(255,255,255,.22); }
.bulk-bar .close { margin-left: auto; }
.table-foot { display: flex; align-items: center; gap: 10px; padding: 12px 4px 0; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.table-foot .pagination { padding: 0; margin-left: auto; }

/* Importação CSV */
.dropzone { border: 2px dashed var(--border-2); border-radius: 14px; padding: 28px 20px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--primary-softer); color: var(--primary); }
.dropzone .ic { width: 28px; height: 28px; margin-bottom: 8px; }
.dropzone b { display: block; color: var(--text); margin-bottom: 4px; }
.preview-table { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.preview-table .table td, .preview-table .table th { padding: 8px 10px; font-size: 13px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.result-grid > div { background: var(--bg); border-radius: 12px; padding: 14px; text-align: center; }
.result-grid b { display: block; font-size: 24px; font-weight: 700; }
.result-grid span { font-size: 12px; color: var(--muted); }
.result-grid .ok b { color: var(--success); }
.result-grid .upd b { color: var(--info); }
.result-grid .skip b { color: var(--warning); }

/* Ficha do paciente */
.ficha-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ficha-head .avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.ficha-head .who { flex: 1; min-width: 200px; }
.ficha-head .who h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ficha-head .who .meta { color: var(--muted); font-size: 13px; margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.ficha-head .who .tag-list { margin-top: 10px; }
.ficha-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ficha-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr) 320px; gap: 20px; margin-top: 20px; align-items: start; }
.ficha-grid .col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.dl { display: flex; flex-direction: column; }
.dl-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); min-height: 42px; }
.dl-row:last-child { border-bottom: 0; }
.dl-row dt { font-size: 12px; color: var(--muted); font-weight: 500; }
.dl-row dd { margin: 0; font-size: 13.5px; font-weight: 500; min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; }
.dl-row dd .placeholder { color: var(--muted-2); font-weight: 400; }
.dl-row.editable dd { cursor: text; border-radius: 8px; padding: 4px 8px; margin: -4px -8px; transition: background .12s; }
.dl-row.editable dd:hover { background: var(--bg); }
.dl-row.editable dd .ic { width: 13px; height: 13px; color: var(--muted-2); opacity: 0; margin-left: auto; }
.dl-row.editable dd:hover .ic { opacity: 1; }
.dl-row .inline-edit { display: flex; gap: 6px; align-items: center; width: 100%; }
.dl-row .inline-edit .input, .dl-row .inline-edit .select { height: 36px; padding: 0 10px; font-size: 13px; }
.dl-row .inline-edit .btn { height: 32px; width: 32px; padding: 0; }
.lgpd { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg); font-size: 13px; }
.lgpd .ic { width: 20px; height: 20px; color: var(--muted); flex: none; }
.lgpd.on { background: var(--success-soft); color: #15803D; }
.lgpd.on .ic { color: #15803D; }
.lgpd b { display: block; font-size: 13px; }
.lgpd span { font-size: 12px; opacity: .8; }
.lgpd .toggle { margin-left: auto; }

/* Timeline */
.tl { position: relative; padding-left: 34px; margin-top: 6px; }
.tl::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-dot { position: absolute; left: -34px; top: 0; width: 28px; height: 28px; border-radius: 999px; background: var(--card); border: 2px solid var(--border); display: grid; place-items: center; color: var(--muted); }
.tl-dot .ic { width: 13px; height: 13px; }
.tl-dot.mensagem { border-color: var(--primary-soft); color: var(--primary); background: var(--primary-softer); }
.tl-dot.agendamento { border-color: #FDE68A; color: var(--warning); background: var(--warning-soft); }
.tl-dot.etapa { border-color: #C7D2FE; color: var(--info); background: var(--info-soft); }
.tl-dot.tarefa { border-color: #BBF7D0; color: #15803D; background: var(--success-soft); }
.tl-dot.nota { border-color: #DDD6FE; color: var(--violet); background: var(--violet-soft); }
.tl-dot.etiqueta, .tl-dot.campo { border-color: #FBCFE8; color: #BE185D; background: #FCE7F3; }
.tl-text { font-size: 13.5px; line-height: 1.5; }
.tl-text b { font-weight: 600; }
.tl-meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-note { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 6px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.note-box { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.note-box .textarea { min-height: 76px; padding: 10px 14px; }
.note-box .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tl-filter { display: flex; gap: 4px; flex-wrap: wrap; }
.tl-filter button { border: 1px solid var(--border-2); background: var(--card); border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.tl-filter button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Cards laterais da ficha (negócios, tarefas, agendamentos) */
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-item { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.mini-item .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mini-item .row b { font-size: 13.5px; flex: 1; min-width: 0; }
.mini-item .sub { font-size: 12px; color: var(--muted); }
.mini-item .value { font-weight: 700; font-size: 13px; color: var(--navy); }
.mini-item .select.sm { height: 34px; font-size: 12px; padding: 0 30px 0 10px; }
.mini-item.done { opacity: .6; }
.mini-item.done .row b { text-decoration: line-through; }

/* Funil Kanban */
.kanban-wrap { overflow-x: auto; overflow-y: hidden; padding-bottom: 10px; margin: 0 -32px; padding-left: 32px; padding-right: 32px; }
.kanban { display: flex; gap: 14px; align-items: flex-start; min-height: calc(100vh - 290px); }
.kcol { flex: none; width: 282px; background: #EEEFF4; border-radius: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 250px); border-top: 4px solid var(--col, var(--muted-2)); }
.kcol-head { padding: 12px 14px 8px; display: flex; align-items: center; gap: 8px; }
.kcol-head b { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcol-head .count { min-width: 22px; height: 22px; border-radius: 999px; background: var(--card); color: var(--text-2); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; padding: 0 6px; }
.kcol-sum { padding: 0 14px 10px; font-size: 12px; color: var(--muted); font-weight: 500; }
.kcol-body { padding: 4px 8px 8px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 80px; border-radius: 0 0 12px 12px; transition: background .12s; }
.kcol.over .kcol-body { background: var(--primary-softer); box-shadow: inset 0 0 0 2px var(--accent); }
.kcol.over-lost .kcol-body { background: var(--danger-soft); box-shadow: inset 0 0 0 2px var(--danger); }
.kcol.over-won .kcol-body { background: var(--success-soft); box-shadow: inset 0 0 0 2px var(--success); }
.kcol-empty { text-align: center; color: var(--muted-2); font-size: 12px; padding: 18px 8px; border: 1px dashed var(--border-2); border-radius: 10px; }
.kcard { background: var(--card); border-radius: 12px; padding: 12px 12px 10px; box-shadow: var(--shadow); cursor: grab; display: flex; flex-direction: column; gap: 6px; user-select: none; transition: transform .12s, box-shadow .12s; }
.kcard:hover { box-shadow: 0 4px 14px rgba(15,23,42,.1); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .45; transform: rotate(1.5deg); }
.kcard-top { display: flex; align-items: center; gap: 8px; }
.kcard-top .avatar { width: 28px; height: 28px; font-size: 11px; }
.kcard-name { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard-title { font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.kcard-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.kcard-foot .value { font-weight: 700; font-size: 13px; color: var(--navy); }
.kcard-foot .resp { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.kcard-foot .resp .avatar { width: 20px; height: 20px; font-size: 9px; }
.kcard .tag-list { margin-top: 2px; }
.kcol.closed .kcard { border-left: 3px solid var(--col); }
.stage-editor { display: flex; flex-direction: column; gap: 8px; }
.stage-row { display: grid; grid-template-columns: 24px 1fr 130px 150px auto; gap: 8px; align-items: center; background: var(--bg); border-radius: 12px; padding: 8px 10px; }
.stage-row .input, .stage-row .select { height: 38px; padding: 0 10px; font-size: 13px; background: var(--card); }
.stage-row .select { padding-right: 30px; }
.stage-row .color-btn { width: 24px; height: 24px; border-radius: 999px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-2); cursor: pointer; padding: 0; }
.stage-row .order-btns { display: flex; gap: 2px; }
.stage-row .order-btns .icon-btn { width: 30px; height: 30px; border-radius: 8px; }
.stage-row .order-btns .icon-btn .ic { width: 14px; height: 14px; }

/* Tarefas */
.task-list { display: flex; flex-direction: column; }
.task-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: 0; }
.task-check { width: 24px; height: 24px; border-radius: 999px; border: 2px solid var(--border-2); background: var(--card); display: grid; place-items: center; color: transparent; flex: none; margin-top: 1px; padding: 0; transition: background .12s, border-color .12s; }
.task-check:hover { border-color: var(--success); color: var(--success); }
.task-check.done { background: var(--success); border-color: var(--success); color: #fff; }
.task-check .ic { width: 14px; height: 14px; stroke-width: 2.5; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.task-desc { font-size: 13px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }
.task-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 5px; }
.task-meta a { font-weight: 600; }
.task-meta .due { display: inline-flex; align-items: center; gap: 4px; }
.task-meta .due .ic { width: 13px; height: 13px; }
.task-row.late .task-meta .due { color: var(--danger); font-weight: 600; }
.task-row.today .task-meta .due { color: var(--warning); font-weight: 600; }
.task-right { display: flex; gap: 4px; align-items: center; }
.quick-add { display: grid; grid-template-columns: 1fr 200px 180px auto; gap: 8px; margin-bottom: 16px; }
.quick-add .input, .quick-add .select { height: 44px; }

/* Relatórios */
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.chart { width: 100%; overflow: visible; font-family: var(--font); }
.chart text { fill: var(--text-2); font-size: 12px; }
.chart .axis { stroke: var(--border); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 3; }
.chart .bar { fill: var(--primary); }
.chart .bar.won { fill: var(--success); }
.chart .bar.lost { fill: var(--danger); }
.chart .val { font-weight: 700; fill: var(--text); }
.chart .label { font-weight: 500; fill: var(--text); }
.chart .line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { opacity: .12; }
.chart .pt { stroke: #fff; stroke-width: 2; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.rank { display: flex; flex-direction: column; gap: 10px; }
.rank-row { display: grid; grid-template-columns: 28px 32px 1fr auto; gap: 10px; align-items: center; }
.rank-row .pos { font-weight: 700; color: var(--muted); font-size: 13px; }
.rank-row .bar-wrap { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-top: 5px; }
.rank-row .bar-fill { height: 100%; background: var(--primary); border-radius: 999px; }
.rank-row .name { font-weight: 600; font-size: 13.5px; }
.rank-row .num { font-weight: 700; font-size: 14px; color: var(--navy); }
.rank-row .num small { font-weight: 500; color: var(--muted); font-size: 11px; display: block; text-align: right; }
.motivos { display: flex; flex-direction: column; gap: 8px; }
.motivos .row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.motivos .row b { min-width: 28px; text-align: right; }
.period-seg { display: inline-flex; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.period-seg button { border: 0; background: transparent; border-radius: 999px; height: 34px; padding: 0 14px; font-weight: 600; color: var(--text-2); font-size: 13px; }
.period-seg button.active { background: var(--primary); color: #fff; }

/* Mini ficha no inbox */
.inbox.with-panel { grid-template-columns: 360px minmax(0, 1fr) 300px; }
.inbox-side { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.inbox-side .side-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.inbox-side .side-head b { font-size: 14px; flex: 1; }
.inbox-side .side-body { overflow-y: auto; padding: 14px 16px 18px; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.side-sec h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.side-sec h4 .right { margin-left: auto; text-transform: none; letter-spacing: 0; }
.side-sec h4 .right button { border: 0; background: transparent; color: var(--primary); font-size: 12px; font-weight: 600; padding: 0; }
.side-person { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 6px 0 4px; }
.side-person .avatar { width: 56px; height: 56px; font-size: 20px; }
.side-person b { font-size: 15px; }
.side-person span { font-size: 12px; color: var(--muted); }
.side-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.side-actions button { border: 1px solid var(--border); background: var(--card); border-radius: 10px; padding: 8px 4px; font-size: 11px; font-weight: 600; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.side-actions button:hover { background: var(--primary-softer); color: var(--primary); border-color: transparent; }
.side-actions button .ic { width: 16px; height: 16px; }
.side-task { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.side-task:last-child { border-bottom: 0; }
.side-task .task-check { width: 20px; height: 20px; }
.side-task .task-check .ic { width: 11px; height: 11px; }
.side-task span { display: block; font-size: 11px; color: var(--muted); }
.side-task.late span { color: var(--danger); font-weight: 600; }
.side-next { background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.side-next .ic { color: var(--primary); }
.side-next b { display: block; }
.side-next span { font-size: 12px; color: var(--muted); }
.side-toggle { display: none; }

/* Busca global (dropdown) */
.search { position: relative; }
.search-dd { position: absolute; top: 54px; left: 0; right: 0; min-width: 320px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); z-index: 90; max-height: 440px; overflow-y: auto; padding: 6px; }
.search-dd .sd-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 10px 10px 4px; }
.search-dd .sd-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text); cursor: pointer; }
.search-dd .sd-item:hover, .search-dd .sd-item.active { background: var(--bg); }
.search-dd .sd-item .avatar { width: 32px; height: 32px; font-size: 12px; }
.search-dd .sd-item .sd-icon { width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; background: var(--bg); color: var(--muted); flex: none; }
.search-dd .sd-item .sd-icon .ic { width: 16px; height: 16px; }
.search-dd .sd-body { flex: 1; min-width: 0; }
.search-dd .sd-body b { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-dd .sd-body span { font-size: 12px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-dd .sd-empty { padding: 18px 10px; text-align: center; color: var(--muted); font-size: 13px; }

/* Responsivo CRM */
@media (max-width: 1240px) {
  .ficha-grid { grid-template-columns: 1fr 1fr; }
  .ficha-grid .col-center { grid-column: 1 / -1; order: 2; }
  .inbox.with-panel { grid-template-columns: 340px 1fr; }
  .inbox-side { position: fixed; right: 0; top: 0; bottom: 0; width: 320px; max-width: 92vw; border-radius: 16px 0 0 16px; z-index: 40; transform: translateX(100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .inbox.panel-open .inbox-side { transform: none; }
  .side-toggle { display: inline-flex; }
  .report-grid { grid-template-columns: 1fr; }
  .quick-add { grid-template-columns: 1fr 1fr; }
  .quick-add .btn { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .kanban-wrap { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .kanban { min-height: 0; }
  .kcol { width: 260px; max-height: calc(100vh - 220px); }
  .ficha-grid { grid-template-columns: 1fr; }
  .ficha-grid .col-center { order: 0; }
  .stage-row { grid-template-columns: 24px 1fr auto; }
  .stage-row .select { grid-column: 2 / -1; }
  .result-grid { grid-template-columns: 1fr; }
  .search-dd { position: fixed; left: 12px; right: 12px; top: 64px; }
}
@media (max-width: 600px) {
  .toolbar .search { min-width: 0; flex: 1 1 100%; max-width: none !important; display: flex; }
  .filters { width: 100%; }
  .filters .select.sm { flex: 1; min-width: 45%; }
  .ficha-head .actions { width: 100%; }
  .ficha-head .actions .btn { flex: 1; }
  .dl-row { grid-template-columns: 96px 1fr; }
  .quick-add { grid-template-columns: 1fr; }
  .side-actions { grid-template-columns: 1fr 1fr 1fr; }
  .bulk-bar { padding: 8px 12px; }
  .bulk-bar .close { margin-left: 0; }
}
