/* Funil CRM — estilos globais */

:root {
  --ink-950: #0E1016;
  --ink-900: #161923;
  --ink-800: #1F2330;
  --ink-700: #2A2F3F;
  --ink-500: #565D73;
  --ink-300: #9AA0B4;
  --paper-50: #FBFBFA;
  --paper-100: #F3F4F6;
  --paper-200: #E8E9ED;
  --signal: #00B6AB;
  --signal-50: #E3F9F7;
  --signal-600: #009288;
  --teal: #0EA5A0;
  --teal-50: #E7F8F7;
  --amber: #E8A93B;
  --font-display: 'Montserrat', sans-serif;
  --font-body: 'Montserrat', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper-100);
  color: var(--ink-950);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; }
p { margin: 0; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select { font-family: inherit; font-size: 16px; }

.muted { color: var(--ink-500); font-size: 15px; }
.muted.small { font-size: 14px; margin-top: 4px; margin-bottom: 20px; }
.text-signal { color: var(--signal); font-weight: 500; }
.text-teal { color: var(--teal); }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-body { background: var(--paper-100); }
.login-grid { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
@media (max-width: 960px) { .login-grid { grid-template-columns: 1fr; } .login-brand { display: none; } }

.login-brand {
  background: var(--ink-950);
  color: var(--paper-50);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-brand-copy { max-width: 420px; display: flex; flex-direction: column; gap: 16px; }
.login-brand-copy h1 { font-size: 36px; line-height: 1.25; font-weight: 700; }
.login-brand .eyebrow { color: var(--signal); }
.login-brand .muted { color: var(--ink-300); line-height: 1.6; }
.foot-note { color: var(--ink-500); font-size: 14px; }

.brand-mark { display: flex; align-items: center; gap: 8px; }
.logo-box {
  width: 32px; height: 32px; border-radius: 10px; background: var(--signal);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; color: white;
}
.logo-text { font-family: var(--font-display); font-size: 20px; }

.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 18px; }
.login-form h2 { font-size: 26px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-700); }
.login-form input {
  border: 1px solid rgba(31,35,48,0.1); border-radius: 8px; padding: 10px 12px; font-size: 16px; outline: none;
}
.login-form input:focus { border-color: var(--signal); box-shadow: 0 0 0 3px rgba(0, 182, 171,0.15); }
.hint { font-size: 14px; color: var(--ink-500); text-align: center; }

.eyebrow { font-size: 13px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--signal); font-weight: 600; margin-bottom: 6px; }

.alert-error {
  font-size: 15px; color: var(--signal-600); background: var(--signal-50);
  border: 1px solid rgba(0, 182, 171,0.3); border-radius: 8px; padding: 8px 12px;
  margin-bottom: 4px;
}
.alert-success {
  font-size: 15px; color: var(--teal); background: var(--teal-50);
  border: 1px solid rgba(14,165,160,0.3); border-radius: 8px; padding: 8px 12px;
  margin-bottom: 4px;
}

.btn { border-radius: 8px; padding: 10px 16px; font-size: 16px; font-weight: 500; transition: background 0.15s; }
.btn-primary { background: var(--ink-950); color: white; }
.btn-primary:hover { background: var(--signal); }
.btn-block { width: 100%; text-align: center; }

/* ---------- App shell (estilo Pipedrive: rail estreita + topbar) ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar-rail {
  width: 60px; flex-shrink: 0; background: var(--signal); border-right: 1px solid rgba(0,0,0,0.08);
  display: flex; flex-direction: column; align-items: center; position: sticky; top: 0; height: 100vh;
  padding: 14px 0;
}
.rail-brand { margin-bottom: 12px; }
.rail-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; align-items: center; width: 100%; }
.rail-bottom { display: flex; flex-direction: column; align-items: center; padding-top: 8px; }

.rail-item {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.88); transition: background 0.15s, color 0.15s; position: relative;
}
.rail-item i { font-size: 19px; }
.rail-item:hover { background: rgba(255,255,255,0.18); color: #fff; }
.rail-item.active { background: rgba(255,255,255,0.95); color: var(--signal); }

/* Nome do item aparece ao passar o mouse */
.rail-item::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--ink-950); color: #fff; font-size: 12px; font-weight: 500;
  padding: 6px 10px; border-radius: 7px; white-space: nowrap; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity 0.12s; z-index: 200;
  box-shadow: 0 4px 14px rgba(14,16,22,0.22);
}
.rail-item::before {
  content: ''; position: absolute; left: calc(100% + 4px); top: 50%; transform: translateY(-50%);
  border: 5px solid transparent; border-right-color: var(--ink-950);
  opacity: 0; visibility: hidden; transition: opacity 0.12s; z-index: 200;
}
.rail-item:hover::after, .rail-item:hover::before { opacity: 1; visibility: visible; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: white; font-size: 14px; font-weight: 500; flex-shrink: 0; text-decoration: none; overflow: hidden;
}
.avatar-sm { width: 22px; height: 22px; font-size: 12px; }
.avatar-photo { width: 100%; height: 100%; object-fit: cover; }

.profile-photo-row { display: flex; align-items: center; gap: 16px; }
.profile-photo-preview { width: 64px; height: 64px; font-size: 24px; }
.signature-preview {
  border: 1px solid var(--paper-200); border-radius: 8px; padding: 12px; font-size: 13px;
  background: var(--paper-50); min-height: 40px; max-width: 100%; overflow-x: auto;
}
.signature-preview img { max-width: 100%; }

.deal-file-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--paper-200); }
.deal-file-row:last-child { border-bottom: none; }
.deal-file-icon { font-size: 18px; color: var(--ink-500); width: 20px; text-align: center; flex-shrink: 0; }
.deal-file-info { flex: 1; min-width: 0; }
.deal-file-name { font-size: 13px; color: var(--ink-950); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-file-name:hover { color: var(--signal); text-decoration: underline; }
.deal-file-meta { font-size: 11px; color: var(--ink-500); margin-top: 1px; }

/* ---------- Caixa de entrada de e-mail ---------- */
.inbox-layout { flex: 1; display: flex; gap: 0; overflow: hidden; margin: 0 32px 24px; border: 1px solid var(--paper-200); border-radius: 12px; background: white; }
.inbox-list { width: 360px; flex-shrink: 0; overflow-y: auto; border-right: 1px solid var(--paper-200); }
.inbox-item { padding: 14px 16px; border-bottom: 1px solid var(--paper-200); cursor: pointer; }
.inbox-item:hover { background: var(--paper-100); }
.inbox-item.active { background: var(--signal-50); }
.inbox-item.unread .inbox-item-from, .inbox-item.unread .inbox-item-subject { font-weight: 700; }
.inbox-item-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.inbox-item-from { font-size: 13px; color: var(--ink-950); }
.inbox-item-date { font-size: 11px; color: var(--ink-300); flex-shrink: 0; }
.inbox-item-subject { font-size: 13px; color: var(--ink-950); margin-bottom: 2px; }
.inbox-item-snippet { font-size: 12px; color: var(--ink-500); margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-detail { flex: 1; overflow-y: auto; padding: 24px; }
.inbox-detail-header { border-bottom: 1px solid var(--paper-200); padding-bottom: 16px; margin-bottom: 16px; }
.inbox-detail-header h2 { font-family: var(--font-display); font-size: 20px; }
.inbox-detail-body { font-size: 14px; line-height: 1.6; color: var(--ink-950); }
.inbox-plain-body { white-space: pre-wrap; font-family: var(--font-body); }
.active-filter { background: var(--signal-50) !important; color: var(--signal) !important; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: 20px; padding: 0 24px;
  background: white; border-bottom: 1px solid var(--paper-200); position: sticky; top: 0; z-index: 10;
}
.topbar-crumb { display: flex; align-items: center; gap: 8px; font-size: 15px; white-space: nowrap; }
.topbar-app-name { font-family: var(--font-display); font-weight: 700; color: var(--ink-950); }
.topbar-sep { color: var(--ink-300); }
.topbar-page { color: var(--ink-500); }
.topbar-search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 6px; background: var(--paper-100);
  border-radius: 8px; padding: 7px 12px;
}
.topbar-search-icon { font-size: 20px; color: var(--ink-300); }
.topbar-search input { border: none; background: none; outline: none; font-size: 15px; width: 100%; color: var(--ink-950); }
.topbar-search input::placeholder { color: var(--ink-300); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.main-content { flex: 1; min-width: 0; }
.page-wrap { padding: 32px; max-width: none; }
.page-wrap-wide { max-width: none; }

.data-table-wrap {
  background: white; border-radius: 14px; border: 1px solid rgba(31,35,48,0.04);
  box-shadow: 0 1px 2px rgba(14,16,22,0.06); overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.data-table thead th {
  text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-500);
  font-weight: 600; padding: 12px 16px; background: var(--paper-100); border-bottom: 1px solid var(--paper-200);
}
.data-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--paper-200); color: var(--ink-950); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--paper-100); }
.data-table-name { font-weight: 500; }
.page-wrap-fluid { max-width: none; height: calc(100vh - 56px); display: flex; flex-direction: column; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 32px; }
.page-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-header-row h1 { margin-bottom: 4px; }
.page-header-row .muted { margin-top: 4px; max-width: 480px; }

/* ---------- Dashboard ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
@media (max-width: 800px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }

.metric-card {
  background: white; border-radius: 14px; border: 1px solid rgba(31,35,48,0.04);
  box-shadow: 0 1px 2px rgba(14,16,22,0.06); padding: 16px;
}
.metric-icon {
  width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px; color: white; font-size: 16px;
}
.metric-icon.ink { background: var(--ink-950); }
.metric-icon.teal { background: var(--teal); }
.metric-icon.amber { background: var(--amber); }
.metric-icon.signal { background: var(--signal); }
.metric-label { font-size: 14px; color: var(--ink-500); margin-bottom: 4px; }
.metric-value { font-family: var(--font-display); font-size: 24px; }
.metric-sub { font-size: 13px; color: var(--ink-500); margin-top: 2px; }

.panel {
  background: white; border-radius: 14px; border: 1px solid rgba(31,35,48,0.04);
  box-shadow: 0 1px 2px rgba(14,16,22,0.06); padding: 24px; min-width: 0; box-sizing: border-box;
}
.panel h2 { font-size: 20px; margin-bottom: 4px; }

.bar-chart { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 90px; align-items: center; gap: 12px; }
.bar-label { font-size: 14px; color: var(--ink-500); }
.bar-track { background: var(--paper-200); border-radius: 6px; height: 10px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width 0.4s ease; }
.bar-signal { background: var(--signal); }
.bar-teal { background: var(--teal); }
.bar-ink { background: var(--ink-500); }
.bar-value { font-family: var(--font-mono); font-size: 13px; text-align: right; color: var(--ink-950); }

/* ---------- Pipeline / Kanban ---------- */
.pipeline-tabs { display: flex; gap: 16px; margin-top: 4px; }
.pipeline-tab { font-family: var(--font-display); font-size: 26px; color: var(--ink-300); }
.pipeline-tab.active { color: var(--ink-950); }
.pipeline-tab:hover { color: var(--ink-500); }

.kanban-board {
  flex: 1; display: flex; gap: 16px; overflow-x: auto; padding: 0 32px 24px;
  cursor: grab; overscroll-behavior-x: contain; scrollbar-gutter: stable;
}
.kanban-board.is-drag-scrolling { cursor: grabbing; user-select: none; }
.kanban-board .deal-card,
.kanban-board button,
.kanban-board a,
.kanban-board input,
.kanban-board select,
.kanban-board textarea { cursor: auto; }
.kanban-board .deal-card { cursor: grab; }
.kanban-board .deal-card.dragging { cursor: grabbing; }
.kanban-board button,
.kanban-board a,
.kanban-board select { cursor: pointer; }
.stage-column {
  width: 288px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--paper-50); border: 1px solid var(--paper-200); border-radius: 12px;
  overflow: hidden; max-height: 100%;
}
.stage-column-header { background: var(--paper-100); padding: 14px 16px 12px; border-bottom: 1px solid var(--paper-200); flex-shrink: 0; }
.stage-bar { height: 3px; border-radius: 4px; margin-bottom: 10px; }
.stage-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.stage-head h3 { font-size: 15px; font-weight: 600; }
.stage-count {
  font-size: 12px; color: var(--ink-500); background: white; border-radius: 999px;
  padding: 1px 8px; border: 1px solid var(--paper-200);
}
.stage-total { font-family: var(--font-mono); font-size: 13px; color: var(--ink-500); }
.stage-drop {
  flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 160px;
  padding: 12px; transition: background 0.15s; overflow-y: auto;
}
.stage-drop.drag-over { background: rgba(0, 182, 171,0.1); }

.deal-card {
  background: white; border-radius: 10px; border: 1px solid rgba(31,35,48,0.05);
  box-shadow: 0 1px 2px rgba(14,16,22,0.06); padding: 12px; cursor: grab;
}
.deal-card.dragging { opacity: 0.5; }
.deal-card:hover { border-color: rgba(0, 182, 171,0.4); }
.deal-title { font-size: 16px; font-weight: 500; margin-bottom: 8px; line-height: 1.35; }
.deal-subtitle { font-size: 13px; color: var(--ink-500); margin-bottom: 8px; }
.deal-foot { display: flex; align-items: center; justify-content: space-between; }
.deal-value { font-family: var(--font-mono); font-size: 14px; font-weight: 500; }

.add-deal-btn { text-align: left; font-size: 14px; color: var(--ink-500); padding: 8px; border-radius: 8px; }
.add-deal-btn:hover { color: var(--signal); background: white; }

/* ---------- Listas (contatos, atividades, automações) ---------- */
.list-panel {
  background: white; border-radius: 14px; border: 1px solid rgba(31,35,48,0.04);
  box-shadow: 0 1px 2px rgba(14,16,22,0.06);
}
.list-row { padding: 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(31,35,48,0.04); }
.list-row:last-child { border-bottom: none; }
.list-row-main { flex: 1; min-width: 0; }
.list-row-title { font-size: 16px; font-weight: 500; }
.list-row-meta { display: flex; gap: 12px; margin-top: 4px; font-size: 14px; color: var(--ink-500); flex-wrap: wrap; }
.list-row-meta-line { font-size: 13px; color: var(--ink-500); margin-top: 2px; }
.list-row-badge { font-size: 14px; color: var(--ink-500); flex-shrink: 0; }
.custom-field-row-actions { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; }
@media (max-width: 620px) {
  .custom-field-row-actions .btn { width: 36px; padding-inline: 0; font-size: 0; }
  .custom-field-row-actions .btn i { font-size: 12px; }
}

.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-row {
  background: white; border-radius: 10px; border: 1px solid rgba(31,35,48,0.05);
  box-shadow: 0 1px 2px rgba(14,16,22,0.06); padding: 14px; display: flex; align-items: center; gap: 12px;
}
.activity-row.overdue { border-color: rgba(0, 182, 171,0.4); }
.check-btn {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(31,35,48,0.15);
  color: transparent; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.check-btn:hover { border-color: var(--teal); background: var(--teal-50); color: var(--teal); }
.activity-icon {
  width: 28px; height: 28px; border-radius: 8px; background: var(--paper-100); color: var(--ink-500);
  display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0;
}
.activity-body { flex: 1; min-width: 0; }
.activity-subject { font-size: 16px; }
.activity-meta { display: flex; gap: 8px; font-size: 13px; color: var(--ink-500); margin-top: 3px; flex-wrap: wrap; }

.rule-row { align-items: center; }
.rule-icon {
  width: 32px; height: 32px; border-radius: 8px; background: var(--paper-100); color: var(--ink-500);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.rule-icon.active { background: var(--teal-50); color: var(--teal); }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* ---------- Atalhos de teclado ---------- */
.shortcuts-list { display: flex; flex-direction: column; gap: 10px; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shortcut-keys { flex-shrink: 0; }
.shortcut-label { font-size: 13px; color: var(--ink-500); text-align: right; }
kbd {
  display: inline-block; background: var(--paper-100); border: 1px solid var(--paper-200); border-bottom-width: 2px;
  border-radius: 5px; padding: 2px 7px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-950);
}

/* ---------- Toast ---------- */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink-950); color: white; padding: 12px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(14,16,22,0.25); animation: toast-in 0.25s ease-out; max-width: 340px;
}
.toast-success { background: var(--teal); }
.toast-error { background: var(--signal); }
.toast-hide { animation: toast-out 0.3s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(6px); } }

/* ---------- Linha do tempo de etapas (deal detail) ---------- */
.stage-timeline { display: flex; margin: 16px 32px 20px; border-radius: 8px; overflow: hidden; }
.timeline-segment {
  flex: 1; padding: 8px 14px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  position: relative; border-right: 1px solid white;
}
.timeline-segment:last-child { border-right: none; }
.timeline-days { font-size: 13px; font-weight: 600; }
.timeline-stage-name { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.timeline-current { background: var(--teal); color: white; }
.timeline-past { background: var(--paper-200); color: var(--ink-500); }
.timeline-future { background: var(--paper-100); color: var(--ink-300); }

/* ---------- Seguidores ---------- */
.followers-wrap { position: relative; }
.followers-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0; width: 240px; background: white; border-radius: 10px;
  border: 1px solid rgba(31,35,48,0.08); box-shadow: 0 8px 24px rgba(14,16,22,0.15); z-index: 50; padding: 10px 0; max-height: 300px; overflow-y: auto;
}
.followers-dropdown-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-500); font-weight: 600; padding: 4px 14px 8px; }
.followers-item { display: flex; align-items: center; gap: 8px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.followers-item:hover { background: var(--paper-100); }
.followers-item input[type="checkbox"] { width: 14px; height: 14px; }

/* ---------- Histórico de alterações ---------- */
.audit-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--paper-200); }
.audit-row:last-child { border-bottom: none; }
.audit-row-text { font-size: 13px; color: var(--ink-950); line-height: 1.5; }
.audit-row-time { font-size: 11px; color: var(--ink-300); margin-top: 2px; }
.audit-old { color: var(--signal-600); text-decoration: line-through; }
.audit-new { color: var(--teal); font-weight: 500; }

.email-open-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 0; }
.email-open-yes { color: var(--teal); }
.email-open-no { color: var(--ink-300); }

/* ---------- Categorias de campos personalizados ---------- */
.field-category-group, .cf-category-group { margin-bottom: 8px; }
.field-category-title, .cf-category-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
  color: var(--signal); margin: 18px 0 8px; padding-top: 10px; border-top: 1px solid var(--paper-200);
}
.field-category-group:first-child .field-category-title,
.cf-category-group:first-child .cf-category-title { margin-top: 0; padding-top: 0; border-top: none; }

/* ---------- Relatórios ---------- */
.funnel-row { display: grid; grid-template-columns: 160px 1fr 130px; align-items: center; gap: 12px; margin-bottom: 10px; }
.funnel-stage-name { font-size: 13px; color: var(--ink-950); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.funnel-bar-wrap { height: 22px; background: var(--paper-100); border-radius: 6px; overflow: hidden; }
.funnel-bar { height: 100%; background: var(--signal); border-radius: 6px; transition: width 0.3s; min-width: 2px; }
.funnel-bar-time { background: var(--teal); }
.funnel-bar-loss { background: var(--amber); }
.funnel-count { font-size: 13px; color: var(--ink-950); white-space: nowrap; }

.goal-row { padding: 14px 0; border-bottom: 1px solid var(--paper-200); }
.goal-row:last-child { border-bottom: none; }
.goal-row-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
.goal-bar-wrap { height: 10px; background: var(--paper-100); border-radius: 999px; overflow: hidden; margin-bottom: 4px; }
.goal-bar { height: 100%; border-radius: 999px; transition: width 0.3s; }
.goal-bar-low { background: var(--signal); }
.goal-bar-ok { background: var(--amber); }
.goal-bar-done { background: var(--teal); }
.pill-toggle { font-size: 14px; padding: 4px 10px; border-radius: 999px; background: rgba(31,35,48,0.05); color: var(--ink-500); font-weight: 500; flex-shrink: 0; }
.pill-toggle.pill-active { background: var(--teal-50); color: var(--teal); }
.icon-btn-danger { color: var(--ink-300); flex-shrink: 0; font-size: 16px; }
.icon-btn-danger:hover { color: var(--signal); }

.btn-sm { padding: 6px 12px; font-size: 14px; }

.picked-product-row {
  display: grid; grid-template-columns: 1fr 56px 70px 20px; align-items: center; gap: 8px;
  font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--paper-200);
}
.picked-product-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked-product-qty { width: 56px; padding: 4px 6px; border: 1px solid rgba(31,35,48,0.1); border-radius: 6px; font-size: 14px; }
.picked-product-price { font-family: var(--font-mono); text-align: right; }
.picked-product-remove { color: var(--ink-300); font-size: 18px; line-height: 1; }
.picked-product-remove:hover { color: var(--signal); }

.entity-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.entity-tab { white-space: nowrap; }
.entity-tab {
  font-size: 15px; padding: 6px 14px; border-radius: 999px; background: white;
  border: 1px solid rgba(31,35,48,0.08); color: var(--ink-500); display: inline-block; text-decoration: none;
}
.entity-tab.active { background: var(--ink-950); color: white; border-color: var(--ink-950); }
.entity-tab:hover:not(.active) { border-color: var(--signal); color: var(--ink-950); }
/* ---------- Detalhe do negócio ---------- */
.back-link { font-size: 14px; color: var(--ink-500); display: inline-block; margin-bottom: 4px; }
.back-link:hover { color: var(--signal); }

.inline-title-input {
  font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--ink-950);
  border: none; background: none; padding: 2px 0; width: 100%; outline: none;
}
.inline-title-input:focus { border-bottom: 2px solid var(--signal); }

.deal-detail-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.deal-detail-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn-ghost { background: white; border: 1px solid rgba(31,35,48,0.1); color: var(--ink-700); font-size: 14px; padding: 8px 14px; border-radius: 8px; }
.btn-ghost:hover { border-color: var(--signal); color: var(--signal); }

.deal-detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .deal-detail-grid { grid-template-columns: 1fr; } }
.deal-detail-col { display: flex; flex-direction: column; gap: 20px; }
.deal-detail-col-narrow { min-width: 0; }
.deal-detail-col-wide { min-width: 0; }

.timeline-segment { cursor: pointer; transition: filter 0.15s; }
.timeline-segment:hover { filter: brightness(0.93); }

.activity-create-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.activity-create-form .field-row { margin-bottom: 0; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-width: 0; }
.field-row label, .panel label {
  display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-700); margin-bottom: 10px;
  min-width: 0;
}
.field-row input, .field-row select, .panel input, .panel select {
  border: 1px solid rgba(31,35,48,0.1); border-radius: 8px; padding: 8px 10px; font-size: 16px; outline: none; text-transform: none;
  width: 100%; min-width: 0; box-sizing: border-box;
}
.field-row input:focus, .field-row select:focus, .panel input:focus, .panel select:focus { border-color: var(--signal); }

.products-total { font-size: 14px; color: var(--ink-950); margin-top: 8px; text-align: right; }

.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form input[type="text"] { flex: 1; border: 1px solid rgba(31,35,48,0.1); border-radius: 8px; padding: 8px 10px; font-size: 15px; }
.inline-form input[type="date"] { border: 1px solid rgba(31,35,48,0.1); border-radius: 8px; padding: 8px 10px; font-size: 15px; }

.mini-activity-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--paper-200); }
.mini-activity-row.done .mini-activity-subject { text-decoration: line-through; color: var(--ink-500); }
.mini-activity-subject { flex: 1; font-size: 15px; }
.mini-activity-date { font-size: 13px; color: var(--ink-500); }
.check-btn.checked { border-color: var(--teal); background: var(--teal-50); color: var(--teal); }

.note-row { padding: 10px 0; border-bottom: 1px solid var(--paper-200); }
.note-content { font-size: 15px; margin-bottom: 4px; }
.note-meta { font-size: 13px; color: var(--ink-500); }

/* ---------- Modal largo (duas colunas, estilo Pipedrive) ---------- */
.modal.modal-wide { max-width: 720px; }
.modal.deal-create-modal { max-width: 960px; }
.deal-create-modal .modal-two-col { grid-template-columns: minmax(0, 1fr) 320px; }
.deal-create-modal .modal-col-side { max-height: 64vh; overflow-y: auto; }
@media (max-width: 760px) { .deal-create-modal .modal-two-col { grid-template-columns: 1fr; } }
.modal-two-col { display: grid; grid-template-columns: 1fr 220px; gap: 24px; align-items: start; }
@media (max-width: 640px) { .modal-two-col { grid-template-columns: 1fr; } }
.modal-col label { margin-bottom: 12px; }
.modal-col-side {
  background: var(--paper-100); border-radius: 10px; padding: 14px; position: sticky; top: 0;
}
.side-panel-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-500); font-weight: 600; margin-bottom: 8px; }

.new-entity-fields { background: var(--teal-50); border-radius: 8px; padding: 10px 12px; margin: -6px 0 12px; }
.new-entity-badge { font-size: 13px; color: var(--teal); font-weight: 500; margin-bottom: 8px; text-transform: none; }
.new-entity-fields .field-row { margin-bottom: 0; }
.new-entity-fields .field-row label { margin-bottom: 0; }

.ac-wrap { position: relative; }
.ac-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid rgba(31,35,48,0.1);
  border-radius: 8px; box-shadow: 0 4px 16px rgba(14,16,22,0.12); z-index: 20; max-height: 220px; overflow-y: auto; margin-top: 4px;
}
.ac-item { padding: 8px 12px; cursor: pointer; text-transform: none; }
.ac-item:hover { background: var(--paper-100); }
.ac-item.ac-active { background: var(--signal-50); color: var(--ink-950); }
.ac-item-title { font-size: 15px; color: var(--ink-950); }
.ac-item-sub { font-size: 13px; color: var(--ink-500); }
.ac-create { color: var(--signal); font-size: 15px; border-top: 1px solid var(--paper-200); }

.icon-btn-note { color: var(--ink-300); font-size: 15px; padding: 2px; flex-shrink: 0; }
.icon-btn-note:hover { color: var(--teal); }

.deal-label {
  display: inline-block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--signal); background: var(--signal-50); border-radius: 4px; padding: 2px 6px; margin-bottom: 6px;
}

.filter-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-group { display: flex; gap: 4px; background: white; border-radius: 8px; padding: 3px; border: 1px solid rgba(31,35,48,0.06); }
.filter-chip { font-size: 14px; padding: 6px 12px; border-radius: 6px; color: var(--ink-500); white-space: nowrap; }
.filter-chip:hover { background: var(--paper-100); }
.filter-chip.active { background: var(--ink-950); color: white; }
.filter-select {
  font-size: 14px; padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(31,35,48,0.06);
  background: white; color: var(--ink-700);
}

.btn-add-pipeline {
  width: 26px; height: 26px; border-radius: 8px; background: var(--paper-100); color: var(--ink-500);
  font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.btn-add-pipeline:hover { background: var(--signal-50); color: var(--signal); }

.fab-new-deal {
  position: fixed; right: 32px; bottom: 32px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--signal); color: white; font-size: 30px; line-height: 1; display: flex;
  align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(0, 182, 171,0.4); z-index: 15;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fab-new-deal:hover { transform: scale(1.06); box-shadow: 0 6px 20px rgba(0, 182, 171,0.5); }

.stage-editor-list { display: flex; flex-direction: column; gap: 6px; }
.stage-editor-row { display: flex; align-items: center; gap: 8px; padding: 8px 7px; border: 1px solid transparent; border-bottom-color: var(--border); border-radius: 10px; transition: opacity .15s, border-color .15s, background .15s; }
.stage-editor-row:last-child { border-bottom: none; }
.stage-editor-row.is-dragging { opacity: .48; border-color: var(--signal); background: var(--signal-50); }
.stage-drag-handle { width: 28px; height: 34px; flex: 0 0 28px; display: grid; place-items: center; color: var(--text-faint); cursor: grab; }
.stage-drag-handle:active { cursor: grabbing; }
.stage-drag-handle:hover { color: var(--signal); }
.stage-name-input {
  flex: 1; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; font-size: 14px;
  background: transparent; transition: border-color 0.15s, background 0.15s;
}
.stage-name-input:hover, .stage-name-input:focus { border-color: rgba(31,35,48,0.1); background: white; outline: none; }
.pipeline-name-input:hover, .pipeline-name-input:focus { border-bottom: 1px solid var(--paper-200); outline: none; }
.stage-status-select { width: 145px; flex: 0 0 145px; min-height: 36px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 11px; font-weight: 600; }
.stage-order-actions { display: inline-flex; align-items: center; gap: 3px; }
.stage-order-btn { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-faint); font-size: 9px; }
.stage-order-btn:hover:not(:disabled) { border-color: var(--signal); color: var(--signal); background: var(--signal-50); }
.stage-order-btn:disabled { opacity: .3; cursor: default; }
.add-stage-form { display: grid; grid-template-columns: minmax(0, 1fr) 145px auto; gap: 8px; margin-top: 12px; }
.add-stage-form input, .add-stage-form select { min-height: 40px; border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; background: var(--surface); color: var(--text); font-size: 12px; }
.pipeline-create-modal { max-width: 760px; max-height: min(90vh, 850px); overflow-y: auto; }
.pipeline-stage-builder-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 9px; }
.pipeline-stage-builder-heading > div { display: flex; flex-direction: column; gap: 3px; }
.pipeline-stage-builder-heading span { color: var(--text-soft); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.pipeline-stage-builder-heading small { color: var(--text-faint); font-size: 10px; }
.pipeline-stage-builder { max-height: 430px; overflow-y: auto; margin-bottom: 18px; padding-right: 3px; }
.pipeline-stage-builder .stage-editor-row { background: var(--surface-soft); border-color: var(--border); }

@media (max-width: 700px) {
  .stage-editor-row { flex-wrap: wrap; }
  .stage-name-input { min-width: calc(100% - 46px); }
  .stage-status-select { flex: 1; width: auto; margin-left: 36px; }
  .add-stage-form { grid-template-columns: 1fr; }
  .pipeline-stage-builder-heading { align-items: flex-start; flex-direction: column; }
}

.filter-condition-row {
  display: grid; grid-template-columns: 1fr 140px 1fr 28px; gap: 8px; align-items: center; margin-bottom: 8px;
}
.filter-condition-row select, .filter-condition-row input {
  border: 1px solid rgba(31,35,48,0.1); border-radius: 8px; padding: 8px 10px; font-size: 14px; width: 100%;
}
.filter-condition-remove { color: var(--ink-300); font-size: 18px; line-height: 1; }
.filter-condition-remove:hover { color: var(--signal); }
#filter-count-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px;
  border-radius: 999px; background: var(--signal); color: white; font-size: 10px; padding: 0 4px; margin-left: 2px;
}

/* ---------- Sino de notificações ---------- */
.notif-bell-wrap { position: relative; }
.notif-bell-btn {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--ink-500); position: relative;
}
.notif-bell-btn:hover { background: var(--paper-100); color: var(--ink-950); }
.notif-bell-btn i { font-size: 18px; }
.notif-badge {
  position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px; border-radius: 999px;
  background: var(--signal); color: white; font-size: 9px; font-weight: 600; display: flex;
  align-items: center; justify-content: center; padding: 0 3px; border: 2px solid white;
}
.notif-panel {
  position: absolute; top: 42px; right: 0; width: 340px; max-height: 420px; background: white;
  border-radius: 12px; border: 1px solid rgba(31,35,48,0.08); box-shadow: 0 8px 24px rgba(14,16,22,0.15);
  z-index: 100; overflow: hidden; display: flex; flex-direction: column;
}
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  border-bottom: 1px solid var(--paper-200); font-size: 13px; font-weight: 600; color: var(--ink-950);
}
.notif-panel-header button { font-size: 11px; font-weight: 500; color: var(--signal); }
.notif-panel-header button:hover { text-decoration: underline; }
#notif-list { overflow-y: auto; flex: 1; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--paper-200); }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--paper-100); }
.notif-item.unread { background: var(--signal-50); }
.notif-item.unread:hover { background: #ffe8df; }
.notif-item-icon { font-size: 16px; flex-shrink: 0; }
.notif-item-body { min-width: 0; }
.notif-item-title { font-size: 13px; font-weight: 500; color: var(--ink-950); }
.notif-item-message { font-size: 12px; color: var(--ink-500); margin-top: 1px; }
.notif-item-time { font-size: 11px; color: var(--ink-300); margin-top: 3px; }

/* ---------- Busca global ---------- */
.topbar-search { position: relative; }
.global-search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: white;
  border-radius: 12px; border: 1px solid rgba(31,35,48,0.08); box-shadow: 0 8px 24px rgba(14,16,22,0.15);
  z-index: 100; max-height: 420px; overflow-y: auto; padding: 8px 0;
}
.gs-section { padding: 6px 0; }
.gs-section:not(:last-child) { border-bottom: 1px solid var(--paper-200); }
.gs-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-500); font-weight: 600; padding: 6px 16px; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 8px 16px; text-decoration: none; color: var(--ink-950); }
.gs-item:hover { background: var(--paper-100); }
.gs-item-icon { font-size: 13px; color: var(--ink-500); width: 16px; text-align: center; flex-shrink: 0; }
.gs-item-label { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item-meta { font-size: 12px; color: var(--ink-500); flex-shrink: 0; }
.gs-empty { padding: 16px; font-size: 13px; color: var(--ink-500); text-align: center; }

/* ---------- Previsão (forecast) ---------- */
.forecast-intro { margin-bottom: 16px; }
.forecast-bucket-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.forecast-bucket-header h3 { font-family: var(--font-display); font-size: 18px; text-transform: capitalize; }
.forecast-bucket-numbers { display: flex; gap: 14px; font-size: 13px; color: var(--ink-500); }
.forecast-weighted { color: var(--teal); font-weight: 500; }

.modal.modal-narrow { max-width: 340px; }
.next-activity-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.next-activity-actions .btn-primary { flex: 1; }

/* ---------- Mesclar duplicatas ---------- */
.dup-group {
  background: white; border-radius: 14px; border: 1px solid rgba(31,35,48,0.04);
  box-shadow: 0 1px 2px rgba(14,16,22,0.06); padding: 18px; margin-bottom: 16px;
}
.dup-group-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dup-group-title { font-family: var(--font-display); font-size: 18px; color: var(--ink-950); }
.dup-candidates { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.dup-candidate {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 10px;
  border: 1px solid var(--paper-200); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.dup-candidate:has(input:checked) { border-color: var(--signal); background: var(--signal-50); }
.dup-candidate input[type="radio"] { margin-top: 3px; }
.dup-candidate-name { font-size: 15px; font-weight: 500; color: var(--ink-950); }
.dup-candidate-meta { font-size: 13px; color: var(--ink-500); margin-top: 2px; }
.dup-candidate-date { font-size: 12px; color: var(--ink-300); margin-top: 2px; }

/* ---------- Linha do tempo ---------- */
.timeline-wrap {
  background: white; border-radius: 14px; border: 1px solid rgba(31,35,48,0.04);
  box-shadow: 0 1px 2px rgba(14,16,22,0.06); overflow-x: auto;
}
.tl-header { display: flex; border-bottom: 1px solid var(--paper-200); position: sticky; top: 0; background: white; z-index: 2; }
.tl-label-col { width: 240px; flex-shrink: 0; padding: 10px 16px; font-size: 14px; color: var(--ink-500); font-weight: 500; }
.tl-months { flex: 1; display: flex; min-width: 500px; }
.tl-month {
  padding: 10px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-500);
  border-left: 1px solid var(--paper-200); white-space: nowrap;
}
.tl-body { position: relative; }
.tl-today-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--signal); z-index: 1; }
.tl-row { display: flex; border-bottom: 1px solid var(--paper-200); align-items: center; min-height: 52px; }
.tl-row:last-child { border-bottom: none; }
.tl-entity-name { font-size: 15px; font-weight: 500; color: var(--ink-950); }
.tl-entity-sub { font-size: 13px; color: var(--ink-500); margin-top: 1px; }
.tl-track { flex: 1; min-width: 500px; position: relative; height: 100%; padding: 16px 0; }
.tl-track-line { position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--paper-200); }
.tl-marker {
  position: absolute; top: 50%; transform: translate(-50%, -50%); width: 22px; height: 22px; border-radius: 50%;
  background: var(--paper-100); border: 1px solid var(--paper-200); display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: default; z-index: 1;
}
.tl-marker.overdue { background: var(--signal-50); border-color: var(--signal); color: var(--signal-600); }
.tl-marker.done { background: var(--teal-50); border-color: var(--teal); color: var(--teal); }

.view-toggle { display: flex; gap: 2px; background: white; border-radius: 8px; padding: 3px; border: 1px solid rgba(31,35,48,0.06); }
.view-toggle-btn { font-size: 14px; padding: 6px 10px; border-radius: 6px; color: var(--ink-500); line-height: 1; }
.view-toggle-btn:hover { background: var(--paper-100); }
.view-toggle-btn.active { background: var(--ink-950); color: white; }

.page-wrap-inner-scroll { flex: 1; overflow-y: auto; padding: 0 32px 24px; }
.data-table-row-clickable { cursor: pointer; }

.tl-add-col { width: 56px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.tl-add-wrap { position: relative; }
.tl-add-btn {
  width: 28px; height: 28px; border-radius: 50%; background: var(--paper-100); color: var(--ink-500);
  font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.tl-add-btn:hover { background: var(--signal); color: white; }
.tl-add-menu {
  position: absolute; right: 0; top: 34px; background: white; border-radius: 8px; border: 1px solid rgba(31,35,48,0.1);
  box-shadow: 0 4px 16px rgba(14,16,22,0.12); z-index: 20; overflow: hidden; min-width: 160px;
}
.tl-add-menu button {
  display: block; width: 100%; text-align: left; padding: 10px 14px; font-size: 13px; color: var(--ink-950); white-space: nowrap;
}
.tl-add-menu button:hover { background: var(--paper-100); }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(14,16,22,0.4); display: flex;
  align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal { background: white; border-radius: 14px; box-shadow: 0 4px 24px rgba(14,16,22,0.15); width: 100%; max-width: 380px; padding: 24px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h3 { font-size: 20px; }
.modal-close { font-size: 22px; color: var(--ink-500); line-height: 1; }
.modal-close:hover { color: var(--ink-950); }
#rule-form, #deal-form, #contact-form, #activity-form { display: flex; flex-direction: column; gap: 14px; }
#rule-form label, #deal-form label, #contact-form label, #activity-form label {
  display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-700);
}
#rule-form input, #rule-form select, #deal-form input, #contact-form input, #activity-form input, #activity-form select {
  border: 1px solid rgba(31,35,48,0.1); border-radius: 8px; padding: 9px 12px; font-size: 16px; outline: none;
}
#rule-form input:focus, #rule-form select:focus, #deal-form input:focus,
#contact-form input:focus, #activity-form input:focus, #activity-form select:focus {
  border-color: var(--signal); box-shadow: 0 0 0 3px rgba(0, 182, 171,0.15);
}

/* Regra genérica para qualquer formulário dentro de modal (cobre textarea e formulários novos) */
.modal form { display: flex; flex-direction: column; gap: 14px; }
.modal form label {
  display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-700);
}
.modal form input, .modal form select, .modal form textarea {
  border: 1px solid rgba(31,35,48,0.1); border-radius: 8px; padding: 9px 12px; font-size: 16px;
  outline: none; font-family: inherit; text-transform: none; resize: vertical;
}
.modal form input:focus, .modal form select:focus, .modal form textarea:focus {
  border-color: var(--signal); box-shadow: 0 0 0 3px rgba(0, 182, 171,0.15);
}

/* ---------- Bloco colapsável ---------- */
.collapse-header {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%;
  background: none; border: none; padding: 0; cursor: pointer; text-align: left; font-family: inherit;
}
.collapse-title { display: block; font-size: 20px; font-weight: 700; color: var(--ink-950); }
.collapse-sub { display: block; font-size: 13px; color: var(--ink-500); margin-top: 4px; }
.collapse-chevron { color: var(--ink-300); transition: transform 0.2s; flex-shrink: 0; }
.collapse-open .collapse-chevron { transform: rotate(180deg); }
.collapse-body { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--paper-200); }
.checkbox-stack { display: flex; flex-direction: column; gap: 8px; }
.checkbox-stack label, .checkbox-label {
  display: flex; align-items: center; gap: 8px; font-size: 14px; text-transform: none;
  letter-spacing: normal; font-weight: 400; color: var(--ink-950); margin-bottom: 0;
}
.checkbox-stack input[type="checkbox"], .checkbox-label input[type="checkbox"] {
  width: 15px; height: 15px; flex-shrink: 0; margin: 0;
}

/* ---------- Barra de ações em massa ---------- */
.bulk-actions-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--paper-100); border: 1px solid var(--paper-200); border-radius: 10px;
  padding: 10px 16px; margin-bottom: 12px;
}
.btn-danger { background: var(--signal); color: white; border: none; }
.btn-danger:hover { filter: brightness(0.92); }
.activity-row .bulk-select { width: 15px; height: 15px; flex-shrink: 0; margin-right: 2px; }

.tl-marker-clickable { cursor: pointer; }
.tl-marker-clickable:hover { filter: brightness(0.9); transform: scale(1.12); }

/* ---------- Botão flutuante global ---------- */
#global-fab-wrap { position: fixed; right: 28px; bottom: 28px; z-index: 120; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
#global-fab {
  width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--teal); color: white; font-size: 20px;
  box-shadow: 0 6px 20px rgba(14,16,22,0.25); transition: transform 0.15s;
}
#global-fab:hover { transform: scale(1.06); }
#global-fab-menu { display: flex; flex-direction: column; gap: 6px; }
.fab-option {
  display: flex; align-items: center; gap: 9px; background: white; border: 1px solid rgba(31,35,48,0.08);
  border-radius: 10px; padding: 10px 16px; font-size: 14px; font-family: inherit; color: var(--ink-950);
  cursor: pointer; box-shadow: 0 4px 14px rgba(14,16,22,0.14); white-space: nowrap;
}
.fab-option:hover { background: var(--paper-100); }

.lost-reason-banner {
  display: flex; align-items: center; gap: 9px; margin: 12px 0 4px;
  background: var(--signal-50, #FDECEC); color: var(--signal-600, #B3261E);
  border-radius: 10px; padding: 10px 16px; font-size: 14px;
}

.lead-url {
  display: block; background: white; border: 1px solid var(--paper-200); border-radius: 8px;
  padding: 8px 12px; font-family: var(--font-mono); font-size: 12px; word-break: break-all; color: var(--ink-950);
}

/* ---------- Seletor de funil (menu suspenso) ---------- */
.pipeline-picker { position: relative; display: inline-block; }
.pipeline-picker-btn {
  display: flex; align-items: center; gap: 10px; background: white; cursor: pointer;
  border: 1px solid rgba(31,35,48,0.12); border-radius: 10px; padding: 9px 14px;
  font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ink-950);
}
.pipeline-picker-btn:hover { background: var(--paper-100); }
.pipeline-picker-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-picker-caret { font-size: 11px; color: var(--ink-500); }
.pipeline-picker-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; background: white;
  border: 1px solid rgba(31,35,48,0.08); border-radius: 10px; z-index: 60; padding: 6px 0;
  box-shadow: 0 8px 24px rgba(14,16,22,0.15); max-height: 320px; overflow-y: auto;
}
.pipeline-picker-option {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  background: none; border: none; text-align: left; cursor: pointer; font-family: inherit;
  font-size: 14px; padding: 9px 16px; color: var(--ink-950);
}
.pipeline-picker-option:hover { background: var(--paper-100); }
.pipeline-picker-option.active { color: var(--teal); font-weight: 600; }

/* ---------- Tema escuro ---------- */
html[data-theme="dark"] {
  --ink-950: #F2F3F7;
  --ink-900: #E4E6EE;
  --ink-800: #D2D5E0;
  --ink-700: #BFC3D2;
  --ink-500: #9BA1B5;
  --ink-300: #6E7488;
  --paper-50: #171A21;
  --paper-100: #12141A;
  --paper-200: #262A35;
}
html[data-theme="dark"] body { background: var(--paper-100); color: var(--ink-950); }
html[data-theme="dark"] .panel,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .kanban-column,
html[data-theme="dark"] .deal-card,
html[data-theme="dark"] .list-panel,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .followers-dropdown,
html[data-theme="dark"] .pipeline-picker-menu,
html[data-theme="dark"] .pipeline-picker-btn,
html[data-theme="dark"] .fab-option,
html[data-theme="dark"] .entity-tab,
html[data-theme="dark"] .lead-url {
  background: var(--paper-50);
  border-color: var(--paper-200);
  color: var(--ink-950);
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--paper-100); color: var(--ink-950); border-color: var(--paper-200);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--ink-300); }
html[data-theme="dark"] .entity-tab.active { background: var(--signal); color: #fff; border-color: var(--signal); }
html[data-theme="dark"] .data-table th { color: var(--ink-500); }
html[data-theme="dark"] .data-table tr { border-color: var(--paper-200); }
html[data-theme="dark"] .timeline-past { background: var(--paper-200); color: var(--ink-500); }
html[data-theme="dark"] .timeline-future { background: var(--paper-50); color: var(--ink-300); }
html[data-theme="dark"] .toast { background: var(--paper-50); color: var(--ink-950); }

/* Botão de alternar tema */
.theme-toggle-btn {
  width: 34px; height: 34px; border-radius: 50%; border: none; flex-shrink: 0;
  background: transparent; color: var(--ink-500); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.theme-toggle-btn i { font-size: 18px; }
.theme-toggle-btn:hover { background: var(--paper-100); color: var(--ink-950); }
html[data-theme="dark"] .theme-toggle-btn { border-color: var(--paper-200); }

/* Na barra lateral verde o logo ficaria verde sobre verde (invisível) — inverte as cores */
.sidebar-rail .logo-box { background: #fff; color: var(--signal); }

/* ---------- Galeria de automações prontas ---------- */
.templates-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px; margin-top: 16px;
}
.template-card {
  border: 1px solid var(--paper-200); border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 6px; background: var(--paper-50);
}
.template-card-done { opacity: 0.72; }
.template-icon {
  width: 34px; height: 34px; border-radius: 9px; background: var(--signal-50); color: var(--signal);
  display: flex; align-items: center; justify-content: center; font-size: 15px; margin-bottom: 4px;
}
.template-name { font-weight: 600; font-size: 14px; color: var(--ink-950); }
.template-desc { font-size: 12.5px; color: var(--ink-500); line-height: 1.5; flex: 1; }
.template-action { margin-top: 8px; }
.template-active { display: inline-flex; align-items: center; gap: 6px; color: var(--teal); font-size: 13px; font-weight: 600; }
html[data-theme="dark"] .template-card { background: var(--paper-50); border-color: var(--paper-200); }
html[data-theme="dark"] .template-icon { background: rgba(0,182,171,0.16); }

/* ---------- Perfil em duas colunas ---------- */
.profile-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start;
}
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }
.profile-col { display: flex; flex-direction: column; min-width: 0; }
/* Os painéis já usam margin-top pra espaçar; o primeiro de cada coluna não precisa */
.profile-col > .panel:first-child { margin-top: 0 !important; }

.meeting-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  font-size: 12.5px; color: var(--teal); text-decoration: none; font-weight: 500;
}
.meeting-link:hover { text-decoration: underline; }

.audit-icon {
  width: 22px; height: 22px; border-radius: 6px; background: var(--paper-100); color: var(--ink-500);
  display: inline-flex; align-items: center; justify-content: center; font-size: 10px; flex-shrink: 0;
}

/* Etapa pela qual o negócio ainda não passou */
.timeline-unvisited .timeline-days { opacity: 0.5; }

/* Motivo da perda / marca de ganho no card do Kanban */
.deal-lost-reason {
  display: flex; align-items: center; gap: 5px; margin-top: 6px;
  font-size: 11.5px; color: var(--signal); font-weight: 500;
}
.deal-won-tag {
  display: flex; align-items: center; gap: 5px; margin-top: 6px;
  font-size: 11.5px; color: var(--teal); font-weight: 600;
}

/* ---------- Relacionamentos no detalhe do negócio ---------- */
.relation-panel-heading,
.deal-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.relation-panel-heading .eyebrow,
.deal-panel-heading .eyebrow { margin-bottom: 4px; }
.deal-detail-panel { overflow: visible; }
.deal-detail-panel .relation-panel-heading h2,
.deal-detail-panel .deal-panel-heading h2 { margin: 0; font-size: 19px; }
.deal-panel-content { border-top: 1px solid var(--border); padding-top: 18px; }
.deal-panel-content > .entity-tabs:first-child { margin-top: -2px; }
.deal-interactions-panel { min-height: 420px; }
.relation-section + .relation-section { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 20px; }
.relation-section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--text-soft); font-size: 12px; font-weight: 700; }
.relation-section-title > span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.relation-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-soft); color: var(--text-soft); display: inline-grid; place-items: center; font-size: 10px; }
.relation-list { display: flex; flex-direction: column; gap: 7px; }
.relation-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 9px 10px; background: var(--surface-soft); }
.relation-row[data-entity-type] { cursor: pointer; transition: border-color .16s, background .16s, transform .16s; }
.relation-row[data-entity-type]:hover { border-color: color-mix(in srgb, var(--signal) 42%, var(--border)); background: var(--surface-hover); transform: translateY(-1px); }
.relation-avatar { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; display: grid; place-items: center; background: var(--signal-50); color: var(--signal); font-size: 12px; font-weight: 700; }
.relation-avatar-organization { background: var(--teal-50); color: var(--teal); }
.relation-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.relation-copy strong { color: var(--text); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relation-copy small { color: var(--text-faint); font-size: 10px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relation-remove { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px; color: var(--text-faint); display: grid; place-items: center; }
.relation-remove:hover { background: var(--signal-50); color: var(--signal); }
.relation-empty { color: var(--text-faint); font-size: 11px; padding: 5px 2px; }
.relation-add-wrap { margin-top: 9px; }
.relation-add-wrap input { width: 100%; min-height: 38px; border: 1px dashed var(--border-strong); border-radius: 11px; padding: 8px 10px 8px 32px; background: transparent; color: var(--text); font-size: 12px; }
.relation-add-wrap input:hover { border-color: var(--signal); }
.relation-add-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); z-index: 1; color: var(--signal); font-size: 10px; pointer-events: none; }
.relation-help { margin-top: 7px; color: var(--text-faint); font-size: 9px; line-height: 1.45; }

/* ========================================================================== 
   Renovação visual 2026 — superfícies modernas e tema escuro consistente
   ========================================================================== */

:root {
  color-scheme: light;
  --font-display: 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --app-bg: #f5f7f8;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-soft: #f3f6f7;
  --surface-hover: #edf3f3;
  --border: #e5eaec;
  --border-strong: #d8e0e3;
  --text: #142126;
  --text-soft: #65747a;
  --text-faint: #94a0a5;
  --sidebar-bg: #ffffff;
  --shadow-card: 0 1px 2px rgba(18, 35, 40, .03), 0 10px 30px rgba(18, 35, 40, .045);
  --shadow-float: 0 18px 50px rgba(18, 35, 40, .14);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --sidebar-width: 244px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink-950: #f3f7f7;
  --ink-900: #e6eded;
  --ink-800: #d5dfdf;
  --ink-700: #bdcaca;
  --ink-500: #93a3a5;
  --ink-300: #6e7d80;
  --paper-50: #1a2225;
  --paper-100: #111719;
  --paper-200: #293336;
  --signal-50: rgba(0, 182, 171, .14);
  --teal-50: rgba(14, 165, 160, .14);
  --app-bg: #0e1416;
  --surface: #171f22;
  --surface-raised: #1b2528;
  --surface-soft: #11191b;
  --surface-hover: #222e31;
  --border: #2a3639;
  --border-strong: #38464a;
  --text: #f2f7f7;
  --text-soft: #9eadaf;
  --text-faint: #728184;
  --sidebar-bg: #121a1c;
  --shadow-card: 0 1px 1px rgba(0, 0, 0, .18), 0 14px 38px rgba(0, 0, 0, .16);
  --shadow-float: 0 22px 60px rgba(0, 0, 0, .42);
}

body {
  background: var(--app-bg);
  color: var(--text);
  letter-spacing: -.01em;
}

h1, h2, h3, h4, .metric-value { letter-spacing: -.035em; }
.muted, .metric-label, .metric-sub { color: var(--text-soft); }

/* Navegação lateral inspirada na referência: larga, clara e legível. */
.sidebar-rail {
  width: var(--sidebar-width);
  padding: 22px 14px 16px;
  align-items: stretch;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  box-shadow: none;
  z-index: 30;
}
.rail-brand {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 8px 24px;
}
.sidebar-rail .logo-box {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--signal);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 182, 171, .22);
}
.rail-brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.rail-brand-copy strong { color: var(--text); font-size: 18px; letter-spacing: -.04em; }
.rail-brand-copy small { color: var(--text-faint); font-size: 10px; font-weight: 700; letter-spacing: .16em; margin-top: 4px; }
.rail-section-label {
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 0 12px;
  margin: 0 0 8px;
}
.rail-nav { align-items: stretch; gap: 3px; overflow-y: auto; scrollbar-width: none; }
.rail-nav::-webkit-scrollbar { display: none; }
.rail-item {
  width: 100%;
  min-height: 42px;
  height: auto;
  padding: 7px 10px;
  border-radius: 12px;
  justify-content: flex-start;
  gap: 10px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
}
.rail-item-icon { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 24px; }
.rail-item i { font-size: 15px; }
.rail-item:hover { background: var(--surface-hover); color: var(--text); transform: translateX(2px); }
.rail-item.active {
  background: var(--signal);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 182, 171, .18);
}
.rail-item.active::after { content: none; }
.rail-item::after, .rail-item::before { display: none; }
.rail-bottom { align-items: stretch; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.sidebar-profile {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 12px;
}
.sidebar-profile:hover { background: var(--surface-hover); }
.sidebar-profile .avatar { width: 34px; height: 34px; font-size: 13px; }
.sidebar-profile-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sidebar-profile-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text); }
.sidebar-profile-copy small { color: var(--text-faint); font-size: 10px; margin-top: 3px; }

/* Barra superior e área principal */
.topbar {
  height: 72px;
  padding: 0 30px;
  gap: 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-color: var(--border);
  backdrop-filter: blur(16px);
}
.topbar-crumb { font-size: 14px; }
.topbar-app-name { color: var(--text); }
.topbar-page, .topbar-sep { color: var(--text-faint); }
.topbar-search {
  max-width: 520px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: var(--surface-soft);
  padding: 8px 14px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.topbar-search:focus-within { background: var(--surface); border-color: var(--signal); box-shadow: 0 0 0 4px rgba(0, 182, 171, .11); }
.topbar-search input { color: var(--text); font-size: 13px; }
.topbar-search-icon { color: var(--text-faint); font-size: 14px; }
.theme-toggle-btn, .notif-bell-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-soft);
  background: var(--surface);
}
.theme-toggle-btn:hover, .notif-bell-btn:hover { background: var(--surface-hover); color: var(--text); }
.topbar-user .avatar-sm { width: 38px; height: 38px; font-size: 13px; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.main-content { background: var(--app-bg); }
.page-wrap { padding: 34px 36px 44px; }
.page-header { margin-bottom: 24px; }
.page-header h1 { color: var(--text); font-size: clamp(28px, 3vw, 38px); font-weight: 700; }
.eyebrow { font-size: 10px; letter-spacing: .16em; margin-bottom: 8px; }

/* Superfícies e cartões */
.panel, .metric-card, .data-table-wrap, .list-panel, .kanban-column,
.deal-card, .activity-row, .dup-group, .inbox-layout, .entity-tab,
.timeline-layout, .timeline-wrap, .template-card {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-card);
}
.metric-grid { gap: 18px; margin-bottom: 22px; }
.metric-card {
  min-height: 154px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.metric-card::after {
  content: '';
  position: absolute;
  width: 90px;
  height: 90px;
  right: -40px;
  top: -38px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--signal) 10%, transparent);
}
.metric-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--signal) 35%, var(--border)); box-shadow: 0 16px 38px rgba(18, 35, 40, .09); }
.metric-card:first-child { background: #163238; color: #fff; border-color: #163238; }
.metric-card:first-child .metric-label, .metric-card:first-child .metric-sub { color: rgba(255,255,255,.66); }
.metric-icon { width: 38px; height: 38px; border-radius: 12px; margin-bottom: 17px; }
.metric-icon.ink { background: rgba(255,255,255,.13); color: #fff; }
.metric-value { color: inherit; font-size: clamp(22px, 2.2vw, 30px); font-weight: 700; }
.panel { border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 26px; }
.panel h2 { color: var(--text); font-size: 19px; }
.bar-track { height: 11px; background: var(--surface-soft); border-radius: 999px; }
.bar-fill { border-radius: 999px; }
.bar-label, .bar-value { color: var(--text-soft); }

/* Controles, filtros e botões */
.filter-bar { align-items: center; gap: 10px; }
.filter-select, .pipeline-picker-btn, .btn-ghost, .filter-group, .view-toggle {
  min-height: 42px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 1px 2px rgba(18, 35, 40, .02);
}
.filter-select { padding: 9px 36px 9px 14px; font-size: 13px; }
.view-toggle { padding: 4px; }
.view-toggle-btn { min-height: 32px; padding: 7px 13px; border-radius: 9px; color: var(--text-soft); font-size: 12px; }
.view-toggle-btn.active { background: var(--signal); color: #fff; box-shadow: 0 5px 13px rgba(0, 182, 171, .18); }
.btn { border-radius: 12px; padding: 10px 16px; font-size: 13px; font-weight: 600; }
.btn-primary { background: var(--signal); color: #fff; box-shadow: 0 8px 18px rgba(0, 182, 171, .16); }
.btn-primary:hover { background: var(--signal-600); }
input, select, textarea { accent-color: var(--signal); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--signal) !important; box-shadow: 0 0 0 4px rgba(0, 182, 171, .11) !important; }

/* Tabelas e kanban */
.data-table-wrap { border: 1px solid var(--border); border-radius: var(--radius-md); }
.data-table thead th { background: var(--surface-soft); border-color: var(--border); color: var(--text-faint); font-size: 10px; letter-spacing: .08em; }
.data-table tbody td { border-color: var(--border); color: var(--text); }
.data-table tbody tr:hover { background: var(--surface-hover); }
.kanban-column { border-radius: var(--radius-md); }
.deal-card { border-radius: 13px; }

/* Menus, modais e elementos flutuantes */
.modal { max-width: 460px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface-raised); box-shadow: var(--shadow-float); }
.modal-overlay { background: rgba(4, 13, 15, .55); backdrop-filter: blur(7px); }
.fab-option, .pipeline-picker-menu, .followers-dropdown, .notif-panel,
.global-search-results, .autocomplete-results, .ac-dropdown, .tl-add-menu {
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-float);
}
#global-fab { background: var(--signal); box-shadow: 0 12px 28px rgba(0, 182, 171, .28); }
.notif-item:hover, .pipeline-picker-option:hover, .fab-option:hover,
.autocomplete-item:hover, .global-search-item:hover { background: var(--surface-hover); }

/* Tema escuro: remove todos os brancos fixos remanescentes. */
html[data-theme="dark"] .inbox-layout,
html[data-theme="dark"] .inbox-list,
html[data-theme="dark"] .inbox-detail,
html[data-theme="dark"] .tl-header,
html[data-theme="dark"] .data-table-wrap,
html[data-theme="dark"] .data-table thead th,
html[data-theme="dark"] .filter-group,
html[data-theme="dark"] .view-toggle,
html[data-theme="dark"] .filter-select,
html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .stage-name-input,
html[data-theme="dark"] .timeline-layout,
html[data-theme="dark"] .signature-preview,
html[data-theme="dark"] .bulk-actions-bar {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="dark"] .panel,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .kanban-column,
html[data-theme="dark"] .deal-card,
html[data-theme="dark"] .list-panel,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .followers-dropdown,
html[data-theme="dark"] .pipeline-picker-menu,
html[data-theme="dark"] .pipeline-picker-btn,
html[data-theme="dark"] .fab-option,
html[data-theme="dark"] .entity-tab,
html[data-theme="dark"] .lead-url,
html[data-theme="dark"] .template-card,
html[data-theme="dark"] .activity-row,
html[data-theme="dark"] .dup-group,
html[data-theme="dark"] .timeline-wrap,
html[data-theme="dark"] .ac-dropdown,
html[data-theme="dark"] .stage-count,
html[data-theme="dark"] .notif-panel,
html[data-theme="dark"] .global-search-results,
html[data-theme="dark"] .autocomplete-results,
html[data-theme="dark"] .ac-dropdown,
html[data-theme="dark"] .tl-add-menu {
  background: var(--surface-raised);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="dark"] .metric-card:first-child { background: #143137; border-color: #21474d; color: #fff; }
html[data-theme="dark"] .data-table tbody tr:hover,
html[data-theme="dark"] .inbox-item:hover,
html[data-theme="dark"] .tl-add-menu button:hover { background: var(--surface-hover); }
html[data-theme="dark"] .notif-item.unread { background: rgba(0, 182, 171, .09); }
html[data-theme="dark"] .notif-item.unread:hover { background: rgba(0, 182, 171, .14); }
html[data-theme="dark"] .add-deal-btn:hover,
html[data-theme="dark"] .stage-name-input:hover,
html[data-theme="dark"] .stage-name-input:focus { background: var(--surface-hover); }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .modal form input,
html[data-theme="dark"] .modal form select,
html[data-theme="dark"] .modal form textarea {
  background: var(--surface-soft);
  color: var(--text);
  border-color: var(--border);
}
html[data-theme="dark"] option { background: var(--surface-raised); color: var(--text); }

/* Editor completo de empresas e contatos */
.entity-editor-modal {
  max-width: 880px;
  max-height: min(88vh, 820px);
  overflow-y: auto;
}
.entity-editor-modal .modal-header { align-items: flex-start; }
.entity-editor-modal .modal-header .eyebrow { margin-bottom: 4px; }
.entity-editor-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.entity-editor-grid.has-notes { grid-template-columns: minmax(0, 1.1fr) minmax(290px, .9fr); }
.entity-editor-form { min-width: 0; }
.entity-editor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.entity-editor-actions .btn-danger { margin-right: auto; }
.entity-notes-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
}
.entity-notes-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.entity-notes-heading .eyebrow { margin-bottom: 4px; }
.entity-notes-heading h4 { color: var(--text); font-size: 17px; }
.entity-notes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 110px;
  max-height: 330px;
  overflow-y: auto;
  margin: 15px 0;
  padding-right: 3px;
}
.entity-note-card { padding: 11px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.entity-note-card p { color: var(--text); font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.entity-note-card small { display: block; margin-top: 6px; color: var(--text-faint); font-size: 10px; }
.entity-note-form { margin-top: auto; }
.entity-note-form textarea { min-height: 82px; resize: vertical; }
.entity-note-form .btn { align-self: flex-end; }
.data-table-actions { width: 1%; text-align: right; white-space: nowrap; }
.data-table-subtitle { display: block; margin-top: 3px; color: var(--text-faint); font-size: 10px; font-weight: 500; }
.data-table-row-clickable:hover .data-table-name { color: var(--signal); }

/* Diretórios de empresas e contatos, inspirados na referência enviada. */
.entity-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 20px 0 14px;
}
.entity-list-search {
  width: min(520px, 100%);
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text-faint);
}
.entity-list-search:focus-within { border-color: var(--signal); box-shadow: 0 0 0 4px rgba(0, 182, 171, .1); }
.entity-list-search input { flex: 1; min-width: 0; border: 0 !important; padding: 9px 0; background: transparent !important; box-shadow: none !important; color: var(--text); }
.entity-list-total { flex-shrink: 0; color: var(--text-soft); font-size: 12px; font-weight: 600; }
.entity-directory-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 440px) minmax(0, 1fr) auto;
  align-items: center;
}
.entity-directory-toolbar .entity-list-search { width: 100%; }
.entity-list-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.entity-list-filters .filter-select {
  width: auto;
  min-width: 145px;
  min-height: 44px;
  flex: 1 1 145px;
  padding-top: 9px;
  padding-bottom: 9px;
  border-radius: 12px;
  background-color: var(--surface);
  color: var(--text-soft);
  font-size: 11px;
}
.entity-filter-clear {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.entity-filter-clear:hover { background: var(--surface-hover); color: var(--signal); }
#orgs-list, #contacts-list { border-radius: 18px; }
#orgs-list .data-table th, #contacts-list .data-table th { padding-block: 14px; }
#orgs-list .data-table td, #contacts-list .data-table td { padding-block: 15px; }
#orgs-list .data-table tbody tr, #contacts-list .data-table tbody tr { transition: background .16s, transform .16s; }
#orgs-list .data-table tbody tr:hover, #contacts-list .data-table tbody tr:hover { background: var(--surface-hover); }
.data-table-name:has(.directory-avatar) { display: flex; align-items: center; gap: 11px; min-width: 220px; }
.directory-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--signal-50);
  color: var(--signal);
  font-size: 12px;
  font-weight: 700;
}
.directory-avatar-company { background: var(--teal-50); color: var(--teal); }
.directory-primary, .directory-contact-lines { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.directory-primary strong { color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.directory-primary small, .directory-contact-lines small { color: var(--text-faint); font-size: 10px; font-weight: 500; }
.directory-contact-lines > span { color: var(--text); font-size: 12px; }
.directory-owner { display: inline-flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 11px; white-space: nowrap; }
.directory-owner .avatar-sm { width: 26px; height: 26px; font-size: 10px; }
.directory-open-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-faint);
  background: var(--surface);
}
.directory-open-btn:hover { color: var(--signal); border-color: var(--signal); background: var(--signal-50); }
.table-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -8px -7px;
  padding: 8px 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.table-sort-btn i { color: var(--text-faint); font-size: 9px; opacity: .65; }
.table-sort-btn:hover { background: var(--surface-hover); color: var(--text); }
.table-sort-btn:hover i, .table-sort-btn.is-active i { color: var(--signal); opacity: 1; }
.table-sort-btn.is-active { color: var(--text); }
.entity-list-empty {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 30px;
  color: var(--text-faint);
  text-align: center;
}
.entity-list-empty > i { margin-bottom: 5px; color: var(--signal); font-size: 24px; }
.entity-list-empty strong { color: var(--text); font-size: 14px; }
.entity-list-empty span { font-size: 11px; }

.entity-context-section { padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px solid var(--border); }
.entity-context-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; color: var(--text-soft); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.entity-context-list { display: flex; flex-direction: column; gap: 7px; max-height: 155px; overflow-y: auto; }
.entity-context-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--text); text-decoration: none; }
.entity-context-item > span:nth-child(2) { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.entity-context-item strong { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-context-item small { color: var(--text-faint); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-context-link > i:last-child { color: var(--text-faint); font-size: 9px; }
.entity-context-link:hover { border-color: color-mix(in srgb, var(--signal) 45%, var(--border)); background: var(--signal-50); }
.entity-notes-panel .entity-notes-list { min-height: 70px; max-height: 190px; }

.deal-entity-link { display: inline-flex; align-items: center; gap: 5px; color: var(--text-soft); font-size: 12px; }
.deal-entity-link:hover { color: var(--signal); }
.entity-info-modal { max-width: 760px; }
.entity-info-hero { display: flex; align-items: center; gap: 13px; padding: 15px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-soft); margin-bottom: 18px; }
.entity-info-hero .directory-avatar { width: 44px; height: 44px; flex-basis: 44px; font-size: 15px; }
.entity-info-hero-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.entity-info-hero-copy strong { color: var(--text); font-size: 17px; }
.entity-info-hero-copy small { color: var(--text-soft); font-size: 11px; }
.entity-info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.entity-info-field { padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.entity-info-field span { display: block; margin-bottom: 5px; color: var(--text-faint); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.entity-info-field strong, .entity-info-field a { color: var(--text); font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.entity-info-field a:hover { color: var(--signal); }
.entity-info-field-wide { grid-column: 1 / -1; }
.entity-info-section { margin-top: 19px; }
.entity-info-section-title { margin-bottom: 9px; color: var(--text-soft); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.entity-info-empty { color: var(--text-faint); font-size: 11px; }
.entity-info-actions { display:flex; justify-content:flex-end; margin:-4px 0 10px; }
.entity-contact-relation { width:100%; text-align:left; font:inherit; cursor:pointer; }
.entity-contact-relation:not(:disabled):hover { border-color:var(--signal); background:var(--signal-50); }
.entity-contact-relation:disabled { cursor:default; opacity:.82; }
.entity-relation-status { margin-left:auto; color:var(--signal); font-size:10px; font-weight:700; white-space:nowrap; }
.entity-info-field label { margin:0; }
.entity-info-field input, .entity-info-field select, .entity-info-field textarea { margin-top:7px; }
.modal-form-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:16px; }
.activity-row-clickable { cursor:pointer; transition:border-color .16s ease, background .16s ease, transform .16s ease; }
.activity-row-clickable:hover { border-color:color-mix(in srgb, var(--signal) 40%, var(--border)); background:var(--surface-soft); transform:translateY(-1px); }
.settings-manager-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:12px; }
.page-header-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.settings-manager-heading h2 { margin:2px 0 0; }
.role-cards-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(245px,1fr)); gap:12px; }
.role-card { padding:15px; border:1px solid var(--border); border-radius:15px; background:var(--surface); }
.role-card-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.role-card-heading > div:first-child { display:flex; flex-direction:column; gap:3px; }
.role-card-heading strong { font-size:13px; }
.role-card-heading small { color:var(--text-faint); font-size:10px; }
.role-card-actions { display:flex; gap:5px; }
.role-permission-tags { display:flex; flex-wrap:wrap; gap:5px; margin-top:12px; }
.role-permission-tags span { padding:4px 7px; border-radius:999px; background:var(--surface-soft); color:var(--text-soft); font-size:9px; font-weight:600; }
.permissions-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.access-role-modal { max-height:calc(100vh - 32px); overflow-y:auto; }
.permissions-grid-extended { grid-template-columns:repeat(2,minmax(0,1fr)); }
.permission-option { display:flex; align-items:center; gap:9px; margin:0; padding:11px 12px; border:1px solid var(--border); border-radius:11px; background:var(--surface-soft); text-transform:none; letter-spacing:normal; font-size:12px; cursor:pointer; }
.permission-option input { width:auto; margin:0; }
.permission-option-danger { color:var(--signal-600); }
.product-category-badge { display:inline-flex; padding:3px 7px; border-radius:999px; background:var(--signal-50); color:var(--signal-600); font-size:9px; font-weight:700; }
@media (max-width: 560px) { .entity-info-grid { grid-template-columns: 1fr; } .entity-info-field-wide { grid-column: auto; } }
@media (max-width: 560px) { .permissions-grid { grid-template-columns:1fr; } }

/* Resumo de atividades exibido no primeiro acesso do dia. */
.daily-activity-modal { max-width: 620px; }
.daily-activity-intro { margin: -3px 0 18px; font-size: 13px; }
.daily-activity-section + .daily-activity-section { margin-top: 18px; }
.daily-activity-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: var(--text-soft); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.daily-activity-section-heading i { margin-right: 5px; color: var(--teal); }
.daily-activity-section.is-overdue .daily-activity-section-heading i { color: var(--signal); }
.daily-activity-list { display: flex; flex-direction: column; gap: 7px; max-height: 245px; overflow-y: auto; }
.daily-activity-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); color: var(--text); text-decoration: none; }
.daily-activity-item:hover { border-color: color-mix(in srgb, var(--signal) 42%, var(--border)); background: var(--signal-50); }
.daily-activity-time { min-width: 58px; color: var(--text-soft); font-size: 10px; font-weight: 700; text-transform: capitalize; }
.daily-activity-section.is-overdue .daily-activity-time { color: var(--signal); }
.daily-activity-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.daily-activity-copy strong { overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.daily-activity-copy small { overflow: hidden; color: var(--text-faint); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.daily-activity-item > i { color: var(--text-faint); font-size: 9px; }
.daily-activity-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--border); }

@media (max-width: 700px) {
  .entity-list-toolbar { align-items: stretch; flex-direction: column; }
  .entity-list-total { padding-left: 2px; }
  .entity-directory-toolbar { display: flex; }
  .entity-list-filters { width: 100%; }
  .entity-list-filters .filter-select { min-width: calc(50% - 4px); }
}

@media (max-width: 820px) {
  .entity-editor-grid.has-notes { grid-template-columns: 1fr; }
  .entity-editor-modal { max-width: 620px; }
}

/* Login também acompanha e permite alternar o tema salvo. */
.login-form-wrap { position: relative; background: var(--app-bg); }
.login-theme-toggle { position: absolute; top: 28px; right: 28px; z-index: 2; }
.login-form h2 { color: var(--text); }
.login-form label { color: var(--text-soft); }
.login-form input { background: var(--surface); border-color: var(--border); color: var(--text); }
.login-brand { background: #132b30; color: #fff; }
.login-brand .muted { color: rgba(255,255,255,.62); }
.login-brand .foot-note { color: rgba(255,255,255,.42); }
html[data-theme="dark"] .login-brand { background: #0b2529; }

@media (max-width: 1100px) {
  :root { --sidebar-width: 76px; }
  .sidebar-rail { padding-inline: 10px; }
  .rail-brand { justify-content: center; margin-inline: 0; }
  .rail-brand-copy, .rail-section-label, .rail-item-label, .sidebar-profile-copy { display: none; }
  .rail-item { justify-content: center; padding-inline: 8px; }
  .rail-item:hover { transform: none; }
  .rail-item::after, .rail-item::before { display: block; }
  .sidebar-profile { justify-content: center; padding-inline: 0; }
}

@media (max-width: 760px) {
  :root { --sidebar-width: 64px; }
  .sidebar-rail { padding: 14px 8px 12px; }
  .rail-brand { margin-bottom: 14px; }
  .sidebar-rail .logo-box { width: 36px; height: 36px; }
  .topbar { height: 62px; padding: 0 16px; }
  .topbar-crumb { display: none; }
  .topbar-search { min-width: 0; }
  .topbar-search input::placeholder { color: transparent; }
  .topbar-user { gap: 6px; }
  .topbar-user .avatar-sm { display: none; }
  .page-wrap { padding: 24px 16px 34px; }
  .page-header-row { align-items: flex-start; }
  .page-header h1 { font-size: 32px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 140px; }
  .metric-value { font-size: 26px; }
  .filter-bar { overflow-x: auto; padding-bottom: 4px; flex-wrap: nowrap; }
  .filter-select, .view-toggle { flex-shrink: 0; }
  .bar-row { grid-template-columns: 88px 1fr 72px; gap: 8px; }
  .panel { padding: 20px; border-radius: 18px; }
  .inbox-layout { margin-inline: 16px; }
  .login-theme-toggle { top: 18px; right: 18px; }
}

/* Construtor de cadências de e-mail */
.section-heading-row { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.section-heading-row h2 { margin:2px 0 5px; color:var(--text); font-size:20px; }
.soft-badge { display:inline-flex; align-items:center; min-height:28px; padding:5px 10px; border-radius:999px; background:var(--surface-soft); color:var(--text-soft); font-size:10px; font-weight:700; white-space:nowrap; }
.cadences-list { display:flex; flex-direction:column; gap:9px; margin-top:18px; }
.cadence-list-row { display:grid; grid-template-columns:42px minmax(0,1fr) auto auto auto; align-items:center; gap:12px; padding:13px; border:1px solid var(--border); border-radius:14px; background:var(--surface-soft); }
.cadence-list-icon { display:grid; width:38px; height:38px; place-items:center; border-radius:12px; background:var(--signal-50); color:var(--signal); }
.cadence-list-copy { min-width:0; }
.cadence-list-copy strong { display:block; overflow:hidden; color:var(--text); font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.cadence-list-copy small { display:block; margin-top:3px; color:var(--text-faint); font-size:9px; }
.cadence-list-stats { display:flex; align-items:center; gap:7px; }
.cadence-stat { padding:4px 7px; border-radius:8px; background:var(--surface); color:var(--text-soft); font-size:9px; white-space:nowrap; }
.cadence-row-actions { display:flex; gap:5px; }
.cadence-row-actions button { display:grid; width:31px; height:31px; place-items:center; border:1px solid var(--border); border-radius:9px; color:var(--text-soft); background:var(--surface); }
.cadence-row-actions button:hover { border-color:var(--signal); color:var(--signal); }
.btn-danger-outline { border:1px solid color-mix(in srgb, var(--signal) 36%, var(--border)); color:var(--signal); background:transparent; }
.btn-danger-outline:hover { background:var(--signal-50); }

.cadence-builder-overlay { padding:22px; }
.modal.cadence-builder-modal { display:flex; flex-direction:column; width:min(1480px, 97vw); max-width:none; height:min(900px, 94vh); padding:0; overflow:hidden; border-radius:24px; }
.cadence-builder-header { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:18px 22px; border-bottom:1px solid var(--border); background:var(--surface-raised); }
.cadence-builder-title { min-width:260px; }
.cadence-builder-title .eyebrow { margin-bottom:3px; }
.cadence-builder-title input { width:min(440px, 42vw); padding:4px 0; border:0; border-bottom:1px solid transparent; border-radius:0; background:transparent; color:var(--text); font-size:21px; font-weight:750; }
.cadence-builder-title input:focus { outline:0; border-bottom-color:var(--signal); }
.cadence-builder-actions { display:flex; align-items:center; gap:8px; }
.cadence-builder-error { margin:10px 22px 0; }
.cadence-builder-grid { display:grid; grid-template-columns:230px minmax(420px, 1fr) 310px; min-height:0; flex:1; }
.cadence-palette, .cadence-config-panel { min-height:0; padding:22px; overflow-y:auto; background:var(--surface-raised); }
.cadence-palette { border-right:1px solid var(--border); }
.cadence-config-panel { border-left:1px solid var(--border); }
.cadence-side-title { margin-bottom:18px; color:var(--text-faint); font-size:10px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; }
.cadence-palette-item { display:grid; grid-template-columns:38px minmax(0,1fr) 14px; align-items:center; gap:10px; width:100%; margin-bottom:9px; padding:12px; border:1px solid var(--border); border-radius:13px; background:var(--surface); color:var(--text); text-align:left; }
.cadence-palette-item:hover { border-color:color-mix(in srgb, var(--signal) 45%, var(--border)); box-shadow:0 8px 24px rgba(14,16,22,.06); transform:translateY(-1px); }
.cadence-palette-item > span:nth-child(2) { min-width:0; }
.cadence-palette-item strong, .cadence-palette-item small { display:block; }
.cadence-palette-item strong { font-size:11px; }
.cadence-palette-item small { margin-top:2px; color:var(--text-faint); font-size:8px; }
.cadence-palette-icon { display:grid; width:36px; height:36px; place-items:center; border-radius:10px; }
.cadence-palette-icon.email { background:var(--signal-50); color:var(--signal); }
.cadence-palette-icon.wait { background:#fff4df; color:#c67700; }
html[data-theme="dark"] .cadence-palette-icon.wait { background:rgba(198,119,0,.16); color:#f5ad42; }
.cadence-palette-help { margin-top:16px; line-height:1.55; }

.cadence-canvas-wrap { display:flex; min-width:0; min-height:0; flex-direction:column; background-color:var(--app-bg); background-image:radial-gradient(var(--border) 1px, transparent 1px); background-size:22px 22px; }
.cadence-canvas-toolbar { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px 18px; border-bottom:1px solid var(--border); background:color-mix(in srgb, var(--surface-raised) 91%, transparent); color:var(--text-soft); font-size:10px; font-weight:700; }
.cadence-canvas-toolbar i { margin-right:5px; color:var(--signal); }
.cadence-canvas { width:min(620px, calc(100% - 36px)); margin:auto; padding:32px 0 80px; overflow-y:auto; }
.cadence-flow-node { position:relative; padding:18px; border:1px solid var(--border); border-top:4px solid var(--signal); border-radius:17px; background:var(--surface-raised); box-shadow:var(--shadow-card); cursor:pointer; }
.cadence-flow-node.is-selected { border-color:var(--signal); box-shadow:0 0 0 3px var(--signal-50), var(--shadow-card); }
.cadence-flow-node.trigger { border-top-color:#7357e8; }
.cadence-flow-node.is-dragging { opacity:.45; }
.cadence-node-kicker { display:block; margin-bottom:9px; color:var(--text-faint); font-size:8px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.cadence-node-title { color:var(--text); font-size:15px; font-weight:750; }
.cadence-node-desc { margin-top:6px; color:var(--text-soft); font-size:10px; line-height:1.45; }
.cadence-node-grip { position:absolute; top:15px; right:16px; color:var(--text-faint); }
.cadence-connector { display:flex; height:42px; align-items:center; justify-content:center; }
.cadence-connector::before { width:2px; height:100%; content:""; background:var(--border-strong); }
.cadence-wait-node { display:flex; width:max-content; max-width:90%; margin:0 auto; align-items:center; gap:8px; padding:8px 12px; border:1px solid var(--border); border-radius:999px; background:var(--surface-raised); color:var(--text-soft); font-size:9px; font-weight:700; }
.cadence-wait-node i { color:#c67700; }
.cadence-empty-flow { padding:34px; border:1px dashed var(--border-strong); border-radius:17px; background:color-mix(in srgb, var(--surface-raised) 72%, transparent); color:var(--text-faint); text-align:center; font-size:11px; }

.cadence-config-panel label { display:flex; flex-direction:column; gap:6px; margin:16px 0; color:var(--text-soft); font-size:9px; font-weight:700; text-transform:uppercase; letter-spacing:.045em; }
.cadence-config-panel input, .cadence-config-panel select { width:100%; padding:10px 11px; border:1px solid var(--border); border-radius:10px; background:var(--surface); color:var(--text); font-size:11px; text-transform:none; letter-spacing:0; }
.cadence-config-tag { display:inline-flex; padding:5px 8px; border-radius:8px; background:rgba(115,87,232,.1); color:#7357e8; font-size:8px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.cadence-config-tag.email { background:var(--signal-50); color:var(--signal); }
.cadence-help-card { margin-top:22px; padding:13px; border-radius:12px; background:rgba(115,87,232,.08); color:var(--text-soft); font-size:9px; line-height:1.55; }
.cadence-template-preview { margin:18px 0; padding:13px; border:1px solid var(--border); border-radius:12px; background:var(--surface-soft); color:var(--text-soft); font-size:9px; line-height:1.5; }
.cadence-template-preview strong { display:block; margin-bottom:5px; color:var(--text); font-size:10px; }
.cadence-preview-list { display:flex; flex-direction:column; gap:10px; }
.cadence-preview-item { padding:12px; border:1px solid var(--border); border-radius:12px; background:var(--surface-soft); }
.cadence-preview-item strong { display:block; margin-bottom:4px; color:var(--text); font-size:11px; }
.cadence-preview-item p { color:var(--text-soft); font-size:9px; line-height:1.45; }

@media (max-width: 1100px) {
  .cadence-builder-grid { grid-template-columns:190px minmax(380px,1fr) 280px; }
}
@media (max-width: 850px) {
  .cadence-builder-overlay { padding:0; }
  .modal.cadence-builder-modal { width:100vw; height:100vh; border-radius:0; }
  .cadence-builder-header { align-items:flex-start; flex-direction:column; }
  .cadence-builder-title input { width:80vw; }
  .cadence-builder-actions { width:100%; overflow-x:auto; }
  .cadence-builder-grid { grid-template-columns:1fr; overflow-y:auto; }
  .cadence-palette { display:none; }
  .cadence-canvas-wrap { min-height:480px; }
  .cadence-config-panel { border-top:1px solid var(--border); border-left:0; }
  .cadence-list-row { grid-template-columns:38px minmax(0,1fr) auto; }
  .cadence-list-stats { display:none; }
}

/* ========================================================================== 
   Revisão de consistência de layout — controles, tabelas e barras responsivas
   ========================================================================== */

/* Todos os botões textuais mantêm ícone e rótulo centralizados na mesma linha. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  max-width: 100%;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}
.btn-block { display: flex; }
.btn i { flex: 0 0 auto; line-height: 1; }
.btn.btn-sm { padding: 9px 13px; font-size: 12px; }

/* Cabeçalhos não deixam ações "cair" fora do alinhamento do título. */
.page-header-row > * { min-width: 0; }
.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.page-header-actions .btn { flex: 0 0 auto; }
.page-header-actions .muted.small { margin: 0; }
.subnav-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.subnav-toolbar > .entity-tabs { margin-bottom: 0; }

/* Barras de filtro usam a mesma altura e suportam conteúdo estreito sem quebrar um item isolado. */
.filter-bar { min-width: 0; }
.filter-bar > * { min-width: 0; }
.filter-bar .btn, .filter-bar .filter-select, .filter-bar .view-toggle { min-height: 42px; }
.filter-bar .btn { flex: 0 0 auto; }
.filter-select { max-width: 100%; }

/* O Pipeline separa a ação de importação da barra de filtros. */
.pipeline-page-header { align-items: flex-end; margin-bottom: 14px; }
.pipeline-toolbar {
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
}
.pipeline-toolbar .view-toggle { flex: 0 0 auto; }
.pipeline-toolbar .filter-select { width: auto; min-width: 0; flex: 1 1 170px; }
.pipeline-toolbar #filter-pipeline-owner { flex-basis: 200px; }
.pipeline-toolbar #filter-pipeline-label { flex-basis: 170px; }
.pipeline-toolbar #filter-pipeline-sort { flex-basis: 220px; }
.pipeline-toolbar #open-advanced-filter-btn { flex: 0 0 auto; }

/* Evita o recuo duplicado dentro do contêiner que já possui padding. */
.page-wrap-fluid { height: calc(100vh - 72px); min-height: 0; overflow: hidden; }
.page-wrap-fluid .kanban-board { padding-right: 0; padding-left: 0; }
.page-wrap-fluid .page-wrap-inner-scroll { padding-right: 0; padding-left: 0; }
.page-wrap-fluid .inbox-layout { min-height: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; }

/* Tabelas: conteúdo longo ganha rolagem horizontal e ações ficam sempre lado a lado. */
.data-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}
.data-table { min-width: 720px; }
.data-table thead th, .data-table tbody td { vertical-align: middle; }
.data-table-actions { width: 1%; min-width: 92px; text-align: right; white-space: nowrap; }
.table-action-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  white-space: nowrap;
}
.directory-open-btn { display: inline-grid; vertical-align: middle; }
.data-table-actions .icon-btn-danger {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  line-height: 1;
  vertical-align: middle;
}
.data-table-actions .icon-btn-danger:hover { border-color: color-mix(in srgb, var(--signal) 30%, var(--border)); background: var(--signal-50); }

/* Títulos de gerenciadores continuam alinhados quando filtros ou ações precisam quebrar. */
.settings-manager-heading { flex-wrap: wrap; }
.settings-manager-heading > .filter-bar { flex: 1 1 480px; }
.settings-manager-heading > .btn { flex: 0 0 auto; }
.inline-form { align-items: center; flex-wrap: wrap; }
.inline-form > input, .inline-form > select { min-width: 180px; }
.entity-tab { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; line-height: 1.15; }

@media (max-width: 1000px) {
  .pipeline-toolbar {
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-gutter: stable;
  }
  .pipeline-toolbar .filter-select { min-width: 180px; flex: 0 0 180px; }
  .pipeline-toolbar #filter-pipeline-sort { min-width: 220px; flex-basis: 220px; }
}

@media (max-width: 760px) {
  .page-wrap-fluid { height: calc(100vh - 62px); }
  .pipeline-page-header { align-items: flex-start; }
  .page-header-actions { justify-content: flex-start; }
  .settings-manager-heading { align-items: stretch; flex-direction: column; }
  .settings-manager-heading > .filter-bar { width: 100%; flex-basis: auto; }
  .settings-manager-heading > .btn { align-self: flex-start; }
  .data-table { min-width: 660px; }
}

@media (max-width: 600px) {
  .page-header-row { align-items: stretch; flex-direction: column; }
  .page-header-actions { width: 100%; justify-content: flex-start; }
  .page-header-actions .btn { flex: 1 1 auto; }
  .subnav-toolbar { align-items: flex-start; flex-direction: column; }
}

.soft-note {
  padding: 12px 14px;
  border: 1px solid var(--paper-200);
  border-radius: 12px;
  background: var(--paper-100);
  color: var(--ink-500);
  font-size: 13px;
  line-height: 1.5;
}
.soft-note.success { border-color: rgba(14,165,160,.28); background: rgba(14,165,160,.08); }
.soft-note.warning { border-color: rgba(245,158,11,.32); background: rgba(245,158,11,.08); }
.profile-email-advanced {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--paper-200);
  border-radius: 12px;
}
.profile-email-advanced summary { cursor: pointer; font-weight: 700; color: var(--ink-700); }
.profile-email-advanced[open] summary { margin-bottom: 12px; }

/* ========================================================================== 
   Administração SaaS — tenants, planos e provisionamento
   ========================================================================== */
.platform-admin-page { padding-bottom: 60px; }
.platform-hero { margin-bottom: 22px; }
.platform-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.platform-stat-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--paper-200);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.platform-stat-card span, .platform-stat-card small { display:block; color:var(--ink-500); }
.platform-stat-card span { font-size:12px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.platform-stat-card strong { display:block; margin:7px 0 4px; color:var(--ink-900); font-size:30px; line-height:1; }
.platform-stat-card small { font-size:12px; }
.platform-stat-alert { border-color:rgba(245,158,11,.28); background:rgba(245,158,11,.06); }
.platform-tabs { margin-bottom:18px; }
.platform-panel { min-height:260px; }
.platform-filter-bar { margin-bottom:14px; }
.platform-filter-bar input { flex:1 1 360px; }
.platform-filter-bar select { flex:0 1 220px; }
.platform-table-wrap { border:1px solid var(--paper-200); border-radius:18px; background:var(--surface); box-shadow:var(--shadow-card); }
.platform-table { min-width:1000px; }
.platform-table td:first-child small, .platform-table td:nth-child(5) small { display:block; margin-top:4px; color:var(--ink-400); }
.platform-tenant-name { padding:0; border:0; background:none; color:var(--ink-900); font:inherit; font-weight:800; cursor:pointer; text-align:left; }
.platform-tenant-name:hover { color:var(--signal-600); }
.platform-domain { display:inline-block; max-width:230px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--ink-600); }
.status-pill { display:inline-flex; align-items:center; min-height:26px; padding:4px 9px; border-radius:999px; font-size:11px; font-weight:800; white-space:nowrap; }
.status-pill.neutral, .status-provisioning { background:var(--paper-100); color:var(--ink-600); }
.status-active { background:rgba(16,185,129,.12); color:#047857; }
.status-trial { background:rgba(14,165,233,.12); color:#0369a1; }
.status-past_due { background:rgba(245,158,11,.14); color:#b45309; }
.status-suspended, .status-cancelled { background:rgba(239,68,68,.11); color:#b91c1c; }
.platform-plan-grid { display:grid; grid-template-columns:repeat(3,minmax(250px,1fr)); gap:16px; margin-top:16px; }
.platform-plan-card { padding:20px; border:1px solid var(--paper-200); border-radius:18px; background:var(--surface); box-shadow:var(--shadow-card); }
.platform-plan-card.is-inactive { opacity:.62; }
.platform-plan-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.platform-plan-card-head h3 { margin:10px 0 4px; font-size:22px; }
.platform-plan-price { display:block; margin:16px 0; font-size:28px; color:var(--ink-900); }
.platform-plan-price small { margin-left:4px; color:var(--ink-400); font-size:12px; font-weight:600; }
.platform-plan-limits, .platform-plan-features-list { display:grid; gap:8px; }
.platform-plan-limits { padding-bottom:14px; margin-bottom:14px; border-bottom:1px solid var(--paper-200); color:var(--ink-600); font-size:13px; }
.platform-plan-limits i { width:18px; color:var(--signal-600); }
.platform-plan-features-list span { font-size:12px; }
.platform-plan-features-list span i { width:18px; }
.platform-plan-features-list .enabled { color:var(--ink-700); }
.platform-plan-features-list .enabled i { color:#059669; }
.platform-plan-features-list .disabled { color:var(--ink-400); }
.platform-modal-lg { width:min(900px,calc(100vw - 32px)); max-height:calc(100vh - 32px); overflow:auto; }
.platform-modal-lg .form-section-title { margin:20px 0 10px; padding-bottom:8px; border-bottom:1px solid var(--paper-200); color:var(--ink-700); font-size:12px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.platform-feature-overrides { margin-top:18px; padding:16px; border:1px solid var(--paper-200); border-radius:14px; background:var(--paper-50); }
.platform-feature-grid { display:grid; grid-template-columns:repeat(2,minmax(220px,1fr)); gap:10px; margin-top:12px; }
.platform-feature-option { display:flex; align-items:center; gap:9px; min-height:42px; padding:9px 11px; border:1px solid var(--paper-200); border-radius:11px; background:var(--surface); color:var(--ink-700); font-size:13px; font-weight:600; }
.platform-feature-option input { width:17px; height:17px; margin:0; accent-color:var(--signal); }
.platform-feature-select { justify-content:space-between; }
.platform-feature-select select { width:auto; min-width:135px; padding:7px 9px; font-size:12px; }
.platform-modal-actions { justify-content:space-between; gap:12px; }
.platform-danger-actions { display:flex; flex-wrap:wrap; gap:8px; }
.platform-audit-row .list-row-title { font-family:'IBM Plex Mono',monospace; font-size:13px; }
.platform-tab-badge { display:inline-grid; place-items:center; min-width:20px; height:20px; margin-left:5px; padding:0 5px; border-radius:99px; background:#ef4444; color:#fff; font-size:9px; font-weight:800; }
.platform-support-list { display:grid; gap:8px; margin-top:14px; }
.platform-support-card { display:grid; grid-template-columns:8px 1fr 18px; align-items:center; gap:12px; width:100%; padding:16px; border:1px solid var(--paper-200); border-radius:15px; background:var(--surface); color:var(--ink-500); text-align:left; cursor:pointer; box-shadow:var(--shadow-card); }
.platform-support-card.is-unread { border-color:rgba(0,182,171,.5); background:rgba(0,182,171,.04); }
.platform-support-priority { width:8px; height:36px; border-radius:99px; background:var(--ink-200); }
.platform-support-priority.priority-high { background:#ef4444; }
.platform-support-priority.priority-normal { background:#f59e0b; }
.platform-support-priority.priority-low { background:#22c55e; }
.platform-support-main { display:grid; gap:6px; min-width:0; }
.platform-support-main>span { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.platform-support-main strong { color:var(--ink-900); font-size:14px; }
.platform-support-main small { color:var(--ink-400); }
.platform-support-meta { display:flex; align-items:center; flex-wrap:wrap; gap:8px 14px; margin:-4px 0 14px; color:var(--ink-500); font-size:11px; }
.platform-support-messages { display:flex; flex-direction:column; gap:10px; max-height:46vh; overflow-y:auto; padding:14px; border:1px solid var(--paper-200); border-radius:15px; background:var(--paper-50); }
.platform-support-messages .from-support { align-self:flex-end; border-color:rgba(0,182,171,.22); border-radius:14px 14px 4px 14px; background:rgba(0,182,171,.09); }
.platform-support-messages .from-user { align-self:flex-start; border-radius:14px 14px 14px 4px; }
.platform-support-status-field { width:220px; margin:0!important; }

@media (max-width:1100px) {
  .platform-stat-grid { grid-template-columns:repeat(3,minmax(150px,1fr)); }
  .platform-plan-grid { grid-template-columns:repeat(2,minmax(250px,1fr)); }
}
@media (max-width:760px) {
  .platform-stat-grid { grid-template-columns:repeat(2,minmax(130px,1fr)); }
  .platform-plan-grid { grid-template-columns:1fr; }
  .platform-feature-grid { grid-template-columns:1fr; }
  .platform-modal-actions { align-items:stretch; flex-direction:column; }
  .platform-danger-actions { order:2; }
}
@media (max-width:480px) {
  .platform-stat-grid { grid-template-columns:1fr 1fr; }
  .platform-stat-card { padding:14px; }
  .platform-stat-card strong { font-size:25px; }
}

/* Saída de usuários e transferência de responsabilidades */
.user-management-actions { justify-content:flex-end; }
.user-offboarding-modal { width:min(680px,calc(100vw - 28px)); max-height:calc(100vh - 28px); overflow:auto; }
.user-offboarding-person { display:flex; align-items:center; gap:12px; margin:0 0 18px; padding:14px; border:1px solid var(--paper-200); border-radius:14px; background:var(--paper-50); }
.user-offboarding-person .avatar { flex:0 0 auto; }
.user-offboarding-person div { display:grid; gap:3px; min-width:0; }
.user-offboarding-person strong { color:var(--ink-900); }
.user-offboarding-person small { color:var(--ink-500); overflow:hidden; text-overflow:ellipsis; }
.user-offboarding-options { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:8px 0 16px; }
.user-offboarding-option { display:flex!important; align-items:flex-start; gap:10px!important; margin:0!important; padding:14px; border:1px solid var(--paper-200); border-radius:14px; background:var(--surface); cursor:pointer; text-transform:none!important; }
.user-offboarding-option:has(input:checked) { border-color:var(--signal); box-shadow:0 0 0 3px color-mix(in srgb,var(--signal) 12%,transparent); }
.user-offboarding-option-danger:has(input:checked) { border-color:#ef4444; box-shadow:0 0 0 3px rgba(239,68,68,.1); }
.user-offboarding-option input { width:17px!important; height:17px; margin:2px 0 0; accent-color:var(--signal); }
.user-offboarding-option span { display:grid; gap:5px; }
.user-offboarding-option strong { color:var(--ink-800); font-size:13px; }
.user-offboarding-option small { color:var(--ink-500); font-size:11px; line-height:1.45; }
.user-transfer-summary { margin:16px 0; padding:16px; border:1px solid var(--paper-200); border-radius:14px; background:var(--paper-50); }
.user-transfer-summary>div:first-child { display:flex; justify-content:space-between; gap:12px; margin-bottom:12px; color:var(--ink-800); font-size:13px; }
.user-transfer-summary>div:first-child span { color:var(--signal-700); font-weight:800; }
.user-transfer-counts { display:flex; flex-wrap:wrap; gap:7px; }
.user-transfer-counts>span { display:inline-flex; align-items:center; gap:5px; padding:6px 9px; border:1px solid var(--paper-200); border-radius:999px; background:var(--surface); color:var(--ink-600); font-size:11px; }
.user-transfer-counts>span strong { color:var(--ink-900); }
.user-transfer-summary>p { margin:13px 0 0; color:var(--ink-500); font-size:11px; line-height:1.5; }
.user-transfer-summary>p i { margin-right:5px; color:var(--signal-600); }
.user-delete-confirm { margin:2px 0 14px!important; padding:12px; border-radius:11px; background:rgba(239,68,68,.07); color:#b91c1c!important; }
@media (max-width:620px) {
  .user-offboarding-options { grid-template-columns:1fr; }
  .user-management-actions .reset-pw-btn { display:none; }
}

/* Proteção contra perda acidental de formulários em modais */
.modal-guard-overlay { z-index:10050; padding:20px; }
.modal-guard-dialog { width:min(520px,calc(100vw - 32px)); display:grid; grid-template-columns:48px 1fr; gap:16px; align-items:start; }
.modal-guard-dialog h3 { margin:3px 0 8px; }
.modal-guard-icon { display:grid; place-items:center; width:48px; height:48px; border-radius:14px; background:rgba(245,158,11,.14); color:#b45309; font-size:20px; }
.modal-guard-actions { grid-column:1/-1; display:flex; justify-content:flex-end; flex-wrap:wrap; gap:9px; margin-top:8px; }

/* Apresentação guiada do primeiro acesso */
.guided-tour-layer { position:fixed; inset:0; z-index:10020; background:rgba(8,18,28,.66); }
.guided-tour-focus { position:fixed; z-index:1; border:2px solid var(--signal); border-radius:14px; background:transparent; box-shadow:0 0 0 9999px rgba(8,18,28,.14),0 0 0 6px rgba(0,182,171,.18); pointer-events:none; transition:all .22s ease; }
.guided-tour-card { position:fixed; z-index:2; padding:24px; border:1px solid rgba(255,255,255,.14); border-radius:20px; background:var(--surface); box-shadow:0 24px 80px rgba(0,0,0,.28); }
.guided-tour-card.is-centered { top:50%; left:50%; width:min(440px,calc(100vw - 28px)); transform:translate(-50%,-50%); }
.guided-tour-card h3 { margin:6px 0 9px; color:var(--ink-900); font-size:22px; }
.guided-tour-text { margin:0; color:var(--ink-600); font-size:14px; line-height:1.6; }
.guided-tour-close { position:absolute; top:14px; right:14px; width:34px; height:34px; border:0; border-radius:10px; background:var(--paper-100); color:var(--ink-500); cursor:pointer; }
.guided-tour-icon { display:grid; place-items:center; width:44px; height:44px; margin-bottom:14px; border-radius:14px; background:rgba(0,182,171,.13); color:var(--signal-700); font-size:18px; }
.guided-tour-footer { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:22px; }
.guided-tour-footer>div { display:flex; gap:8px; }
.guided-tour-progress { color:var(--ink-400); font-size:12px; font-weight:700; }
body.guided-tour-open { overflow:hidden; }

/* Central de ajuda e atendimento dentro do CRM */
.support-launcher { position:fixed; right:92px; bottom:28px; z-index:820; display:grid; place-items:center; width:54px; height:54px; border:0; border-radius:18px; background:var(--ink-900); color:#fff; box-shadow:0 14px 35px rgba(8,28,40,.24); cursor:pointer; font-size:20px; transition:transform .18s ease; }
.support-launcher:hover { transform:translateY(-2px); }
.support-launcher-badge { position:absolute; top:-6px; right:-6px; display:grid; place-items:center; min-width:22px; height:22px; padding:0 5px; border:2px solid var(--surface); border-radius:999px; background:#ef4444; color:#fff; font-size:10px; font-weight:800; }
.support-backdrop { position:fixed; inset:0; z-index:900; background:rgba(8,18,28,.38); backdrop-filter:blur(2px); }
.support-drawer { position:fixed; top:0; right:0; bottom:0; z-index:910; width:min(440px,100vw); overflow-y:auto; padding:22px; border-left:1px solid var(--paper-200); background:var(--surface); box-shadow:-24px 0 60px rgba(8,28,40,.18); }
.support-drawer-header { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.support-drawer-header h3 { margin:5px 0 0; font-size:22px; }
.support-tabs { display:grid; grid-template-columns:1fr 1fr; gap:5px; margin:22px 0; padding:5px; border-radius:13px; background:var(--paper-100); }
.support-tabs button { min-height:40px; border:0; border-radius:10px; background:transparent; color:var(--ink-500); cursor:pointer; font:inherit; font-size:12px; font-weight:800; }
.support-tabs button.active { background:var(--surface); color:var(--ink-900); box-shadow:var(--shadow-card); }
.support-tabs button span { display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px; margin-left:3px; border-radius:99px; background:#ef4444; color:#fff; font-size:9px; }
.support-view { display:grid; gap:14px; }
.support-drawer form { display:grid; gap:13px; width:100%; }
.support-drawer form label { display:grid; grid-template-columns:minmax(0,1fr); gap:7px; width:100%; margin:0; color:var(--ink-600); font-size:11px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.support-drawer form input,
.support-drawer form select,
.support-drawer form textarea { display:block; width:100%; min-width:0; margin:0; box-sizing:border-box; font-weight:500; letter-spacing:normal; text-transform:none; }
.support-drawer form textarea { min-height:130px; resize:vertical; }
.support-drawer form .field-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px; width:100%; }
.support-quick-list { display:grid; gap:8px; }
.support-quick-list details { border:1px solid var(--paper-200); border-radius:13px; background:var(--paper-50); }
.support-quick-list summary { display:flex; justify-content:space-between; gap:12px; padding:14px; color:var(--ink-800); cursor:pointer; font-size:13px; font-weight:700; list-style:none; }
.support-quick-list summary::-webkit-details-marker { display:none; }
.support-quick-list details p { margin:0; padding:0 14px 14px; color:var(--ink-600); font-size:12px; line-height:1.55; }
.support-ticket-toolbar { display:flex; justify-content:flex-end; }
.support-ticket-card { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; margin-bottom:8px; padding:14px; border:1px solid var(--paper-200); border-radius:13px; background:var(--surface); color:var(--ink-600); text-align:left; cursor:pointer; }
.support-ticket-card>span { display:grid; gap:5px; min-width:0; }
.support-ticket-card strong { overflow:hidden; color:var(--ink-800); font-size:13px; text-overflow:ellipsis; white-space:nowrap; }
.support-ticket-card small { color:var(--ink-400); font-size:10px; }
.support-ticket-card.is-unread { border-color:rgba(0,182,171,.5); background:rgba(0,182,171,.05); }
.support-ticket-card.is-unread strong::before { content:''; display:inline-block; width:7px; height:7px; margin-right:7px; border-radius:99px; background:var(--signal); }
.support-empty { display:grid; place-items:center; gap:8px; padding:36px 15px; color:var(--ink-400); text-align:center; }
.support-empty i { font-size:28px; }
.support-back-link { width:max-content; padding:0; border:0; background:transparent; color:var(--signal-700); cursor:pointer; font-weight:700; }
.support-conversation-title h4, .support-view>h4 { margin:7px 0; color:var(--ink-900); font-size:18px; }
.support-messages { display:flex; flex-direction:column; gap:10px; max-height:48vh; overflow-y:auto; padding:8px 2px; }
.support-message { max-width:88%; padding:12px 14px; border:1px solid var(--paper-200); border-radius:14px 14px 14px 4px; background:var(--paper-50); }
.support-message.from-user { align-self:flex-end; border-color:rgba(0,182,171,.2); border-radius:14px 14px 4px 14px; background:rgba(0,182,171,.09); }
.support-message strong { color:var(--ink-700); font-size:10px; }
.support-message p { margin:5px 0; color:var(--ink-800); font-size:12px; line-height:1.55; }
.support-message time { color:var(--ink-400); font-size:9px; }
body.support-open { overflow:hidden; }

.help-center-page { max-width:1180px; }
.help-hero { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:30px; border-radius:24px; background:linear-gradient(135deg,var(--ink-900),#123948); color:#fff; box-shadow:var(--shadow-card); }
.help-hero h1 { margin:7px 0; color:#fff; }
.help-hero p:not(.eyebrow) { margin:0; color:rgba(255,255,255,.7); }
.help-hero-actions { display:flex; flex-wrap:wrap; gap:10px; }
.help-search-wrap { position:relative; margin:24px 0; }
.help-search-wrap i { position:absolute; top:50%; left:17px; color:var(--ink-400); transform:translateY(-50%); }
.help-search-wrap input { width:100%; min-height:58px; padding-left:48px; border-radius:17px; font-size:15px; }
.help-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.help-faq-card { border:1px solid var(--paper-200); border-radius:16px; background:var(--surface); box-shadow:var(--shadow-card); }
.help-faq-card summary { display:flex; align-items:center; justify-content:space-between; gap:15px; min-height:82px; padding:18px; cursor:pointer; list-style:none; }
.help-faq-card summary::-webkit-details-marker { display:none; }
.help-faq-card summary span { display:grid; gap:6px; color:var(--ink-800); font-size:14px; font-weight:750; }
.help-faq-card summary small { color:var(--signal-700); font-size:9px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; }
.help-faq-card summary i { color:var(--ink-400); transition:transform .18s ease; }
.help-faq-card[open] summary i { transform:rotate(180deg); }
.help-faq-card>p { margin:0; padding:0 18px 19px; color:var(--ink-600); font-size:13px; line-height:1.65; }
.help-empty { display:grid; place-items:center; gap:8px; padding:60px 20px; text-align:center; }
.help-empty>i { color:var(--ink-300); font-size:36px; }
.help-empty h3, .help-empty p { margin:0; }
.profile-help-card { display:grid; grid-template-columns:46px 1fr; gap:13px; align-items:start; }
.profile-help-icon { display:grid; place-items:center; width:46px; height:46px; border-radius:14px; background:rgba(0,182,171,.12); color:var(--signal-700); }
.profile-help-card h2 { margin:0; }
.profile-help-actions { grid-column:1/-1; display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
@media (max-width:560px) {
  .modal-guard-dialog { grid-template-columns:40px 1fr; gap:12px; }
  .modal-guard-icon { width:40px; height:40px; }
  .modal-guard-actions { display:grid; grid-template-columns:1fr; }
  .modal-guard-actions .btn { width:100%; }
  .guided-tour-card { padding:20px; }
  .guided-tour-footer { align-items:stretch; flex-direction:column; }
  .guided-tour-footer>div { display:grid; grid-template-columns:1fr 1fr; }
  .support-launcher { right:82px; bottom:21px; width:50px; height:50px; }
  .support-drawer { padding:18px; }
  .support-drawer form .field-row { grid-template-columns:1fr; }
  .help-hero { align-items:flex-start; flex-direction:column; padding:23px; }
  .help-hero-actions, .help-hero-actions .btn { width:100%; }
  .help-grid { grid-template-columns:1fr; }
  .profile-help-actions { grid-template-columns:1fr; }
}
