/* ── VARIÁVEIS ──────────────────────────────────────────────────── */
:root {
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active-bg: rgba(59,130,246,.15);
  --sidebar-active-text: #60a5fa;
  --sidebar-hover-bg: rgba(255,255,255,.05);
  --page-bg: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --primary: #3b82f6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-dark: #374151;
}

/* ── RESET / BASE ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif;
       background: var(--page-bg); color: var(--text-main); }

/* ── SIDEBAR ────────────────────────────────────────────────────── */
#sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto; overflow-x: hidden;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  color: #f1f5f9; font-size: 1.05rem; font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-logo {
  height: 32px; width: auto; flex-shrink: 0;
  object-fit: contain;
}

.sidebar-nav {
  list-style: none; padding: 12px 0; margin: 0; flex: 1;
}
.sidebar-nav li { margin: 2px 8px; }

.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 8px;
  color: var(--sidebar-text); text-decoration: none;
  font-size: .9rem; font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar-link i { font-size: 1.1rem; flex-shrink: 0; }
.sidebar-link:hover { background: var(--sidebar-hover-bg); color: #e2e8f0; }
.sidebar-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }

.sidebar-divider {
  height: 1px; background: rgba(255,255,255,.07);
  margin: 8px 16px;
}

.sidebar-footer { padding: 12px 8px 16px; flex-shrink: 0; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 4px;
}
.sidebar-user i { font-size: 1.6rem; color: var(--sidebar-text); }
.sidebar-user-info { display: flex; flex-direction: column; overflow: hidden; }
.sidebar-user-name { color: #e2e8f0; font-size: .875rem; font-weight: 600;
                     white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-cargo { color: var(--sidebar-text); font-size: .75rem;
                      white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-logout {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px; border-radius: 8px;
  color: #f87171; text-decoration: none; font-size: .875rem;
  transition: background .15s;
}
.sidebar-logout:hover { background: rgba(239,68,68,.1); }
.sidebar-logout i { font-size: 1rem; }

/* ── SIDEBAR SUBMENU ─────────────────────────────────────────── */
.sidebar-group-toggle { cursor: pointer; }
.sidebar-group-toggle:hover { background: var(--sidebar-hover-bg); color: #e2e8f0; }
.sidebar-group-toggle.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }

.sidebar-chevron {
  font-size: .72rem !important;
  transition: transform .22s ease;
  margin-left: auto;
}
.sidebar-group-toggle.open .sidebar-chevron { transform: rotate(180deg); }

.sidebar-submenu {
  list-style: none; padding: 0; margin: 0;
  overflow: hidden; max-height: 0;
  transition: max-height .25s ease;
}
.sidebar-submenu.open { max-height: 500px; }
.sidebar-submenu li { margin: 1px 0 1px 12px; }

.sidebar-sublink {
  padding: 7px 14px 7px 32px !important;
  font-size: .85rem !important;
  border-radius: 6px !important;
}
.sidebar-sublink i { font-size: .95rem !important; }

/* ── TOPBAR ─────────────────────────────────────────────────────── */
#topbar {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--card-bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; z-index: 99;
  transition: left .25s;
}

#sidebar-toggle {
  display: none; background: none; border: none;
  font-size: 1.4rem; color: var(--text-muted); cursor: pointer; padding: 4px;
}

.topbar-breadcrumb { flex: 1; font-size: .9rem; color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-icon-btn {
  position: relative; background: none; border: none;
  font-size: 1.2rem; color: var(--text-muted); cursor: pointer;
  padding: 6px; border-radius: 8px; transition: background .15s, color .15s;
}
.topbar-icon-btn:hover { background: var(--page-bg); color: var(--text-main); }

.notif-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: #fff;
  font-size: .65rem; font-weight: 700; line-height: 1;
  padding: 2px 4px; border-radius: 10px; min-width: 16px; text-align: center;
}

.notif-wrapper { position: relative; }

.notif-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 320px; max-height: 420px; overflow-y: auto;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 200;
}
.notif-header { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-item {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background .15s;
}
.notif-item:hover { background: var(--page-bg); }
.notif-unread { background: #eff6ff; }
.notif-icon { flex-shrink: 0; font-size: 1.1rem; margin-top: 2px; }
.notif-body { flex: 1; min-width: 0; }
.notif-titulo { margin: 0; font-size: .875rem; font-weight: 600; }
.notif-corpo { margin: 2px 0 0; font-size: .8rem; color: var(--text-muted);
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-tempo { font-size: .75rem; }
.notif-empty { display: flex; flex-direction: column; align-items: center;
               padding: 24px; color: var(--text-muted); font-size: .875rem; gap: 6px; }

.topbar-user-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
  color: var(--text-main); font-size: .875rem; font-weight: 500;
  padding: 6px 10px; border-radius: 8px; transition: background .15s;
}
.topbar-user-btn:hover { background: var(--page-bg); }

.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; flex-shrink: 0;
}

.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 200px; background: var(--card-bg);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 200;
}
.user-dropdown-header { padding: 14px 16px; }
.user-dropdown-header strong { display: block; font-size: .875rem; }
.user-dropdown-header small { color: var(--text-muted); font-size: .8rem; }
.user-dropdown-divider { height: 1px; background: var(--border); }
.user-dropdown-item {
  display: flex; align-items: center; padding: 10px 16px;
  font-size: .875rem; text-decoration: none; color: inherit;
  transition: background .15s; border-radius: 0 0 12px 12px;
}
.user-dropdown-item:hover { background: var(--page-bg); }

#user-menu-wrapper { position: relative; }

/* ── MAIN CONTENT ───────────────────────────────────────────────── */
#content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 24px;
  min-height: calc(100vh - var(--topbar-h));
}

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px;
}
.page-title { font-size: 1.25rem; font-weight: 700; margin: 0; }
.page-subtitle { font-size: .875rem; }

/* ── CARDS ──────────────────────────────────────────────────────── */
.card { border: 1px solid var(--border); border-radius: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.card-header { background: none; border-bottom: 1px solid var(--border);
               padding: 14px 16px; font-size: .9rem; }

/* ── STAT CARDS ─────────────────────────────────────────────────── */
.stat-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.bg-blue-soft   { background: #dbeafe; }
.bg-green-soft  { background: #d1fae5; }
.bg-orange-soft { background: #fef3c7; }
.bg-teal-soft   { background: #d1fae5; }

.stat-body { display: flex; flex-direction: column; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* ── ALERT LISTS (dashboard) ───────────────────────────────────── */
.alert-list { list-style: none; padding: 0; margin: 0; }
.alert-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: var(--page-bg); }
.alert-item-body { display: flex; flex-direction: column; gap: 2px; }
.alert-item-body span { font-size: .875rem; }
.alert-item-body small { font-size: .78rem; }
.alert-danger-soft  { background: #fef2f2; }
.alert-warning-soft { background: #fffbeb; }

.empty-state {
  display: flex; flex-direction: column; align-items: center;
  color: var(--text-muted); text-align: center;
}

/* ── DRAWER ─────────────────────────────────────────────────────── */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 300;
}
.drawer {
  position: fixed; top: 0; right: 0; width: 480px; height: 100vh;
  background: var(--card-bg); z-index: 301;
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  overflow-y: auto; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s ease;
}
.drawer.open { transform: translateX(0); }
.hidden { display: none !important; }

/* ── DRAWER CONTEÚDO ────────────────────────────────────────────── */
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card-bg); z-index: 1;
}
.drawer-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.drawer-body { padding: 20px 24px; flex: 1; }
.drawer-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--card-bg);
}

/* ── TABS ───────────────────────────────────────────────────────── */
.nav-tabs .nav-link { color: var(--text-muted); font-size: .875rem; }
.nav-tabs .nav-link.active { color: var(--primary); font-weight: 600; }

/* ── INFO LIST (dados gerais) ───────────────────────────────────── */
.info-list dt { font-size: .8rem; color: var(--text-muted); font-weight: 500;
                padding-top: 4px; }
.info-list dd { font-size: .875rem; padding-top: 4px; margin-bottom: 8px; }

/* ── USER AVATARS ───────────────────────────────────────────────── */
.user-avatar-sm {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem;
}

/* ── CONTACT CARDS ──────────────────────────────────────────────── */
.contact-card { transition: box-shadow .15s; }
.contact-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }

/* ── MISC ───────────────────────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.font-monospace { font-family: 'Courier New', monospace; font-size: .875rem; }
.min-w-0 { min-width: 0; }
.table th { font-size: .8rem; font-weight: 600; text-transform: uppercase;
            letter-spacing: .03em; color: var(--text-muted); }

/* ── LOGIN ──────────────────────────────────────────────────────── */
.login-body {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: var(--sidebar-bg);
}
.login-wrapper { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  background: var(--card-bg); border-radius: 16px;
  padding: 36px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo { height: 64px; width: auto; display: block; margin: 0 auto 12px; object-fit: contain; }
.login-brand h1 { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; }
.login-brand p { color: var(--text-muted); font-size: .875rem; margin: 0; }
.btn-login { padding: 10px; font-weight: 600; font-size: .95rem; }
.btn-senha-toggle { background: var(--page-bg); border: 1px solid var(--border); cursor: pointer; }

/* ── MODELOS ────────────────────────────────────────────────────── */
.modelo-card { transition: box-shadow .15s; }
.modelo-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.opacity-60 { opacity: .6; }

/* ── TAREFAS ────────────────────────────────────────────────────── */
.tarefa-progress { display: flex; align-items: center; gap: 6px; }
.tarefa-progress-bar {
  flex: 1; height: 5px; background: var(--border);
  border-radius: 10px; overflow: hidden;
}
.tarefa-progress-fill {
  height: 100%; background: var(--primary);
  border-radius: 10px; transition: width .3s;
}
.tarefa-progress-label { font-size: .72rem; color: var(--text-muted); white-space: nowrap; }
.tarefa-prazo { font-size: .78rem; }

/* Etapas */
.etapa-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.etapa-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; border-radius: 8px; transition: background .15s;
}
.etapa-item:hover { background: var(--page-bg); }
.etapa-concluida .etapa-titulo { text-decoration: line-through; color: var(--text-muted); }
.etapa-check {
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: 1.05rem; flex-shrink: 0; margin-top: 1px;
}
.etapa-body { flex: 1; min-width: 0; }
.etapa-titulo { font-size: .875rem; font-weight: 500; display: block; }
.etapa-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }

/* Comentários */
.comentarios-lista { display: flex; flex-direction: column; gap: 10px; }
.comentario-item {
  background: var(--page-bg); border-radius: 8px; padding: 10px 12px;
}
.comentario-header { display: flex; align-items: center; margin-bottom: 4px; font-size: .82rem; }
.comentario-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 700; flex-shrink: 0;
}
.comentario-texto { font-size: .875rem; white-space: pre-line; }

/* ── KANBAN ─────────────────────────────────────────────────────── */
.kanban-board {
  display: flex; gap: 14px;
  overflow-x: auto; padding-bottom: 20px;
  min-height: calc(100vh - 220px);
  align-items: flex-start;
}

.kanban-col {
  flex: 0 0 272px; min-width: 272px;
  display: flex; flex-direction: column;
}

.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; margin-bottom: 10px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px;
}
.kanban-col-title { display: flex; align-items: center; gap: 8px; font-size: .875rem; }
.kanban-col-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}

.kanban-cards,
.etapas-kanban-cards { display: flex; flex-direction: column; gap: 8px; }

.kanban-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px;
  cursor: pointer; transition: box-shadow .15s, transform .1s;
}
.kanban-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,.1);
  transform: translateY(-1px);
}

.kanban-card-title {
  font-size: .875rem; font-weight: 600; margin-bottom: 6px;
  line-height: 1.35; color: var(--text-main);
}
.kanban-card-cliente {
  font-size: .78rem; color: var(--text-muted); margin-bottom: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kanban-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 8px; border-top: 1px solid var(--border);
}
.kanban-card-valor { font-size: .78rem; font-weight: 600; color: var(--success); }
.kanban-card-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 700; flex-shrink: 0;
}
.kanban-card-dias { font-size: .75rem; font-weight: 600; }

/* ── FILTER CHIPS ───────────────────────────────────────────── */
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: #eff6ff; color: #1d4ed8;
  border: 1px solid #bfdbfe; border-radius: 20px;
  padding: 2px 8px 2px 10px; font-size: .75rem; font-weight: 500;
  white-space: nowrap;
}
.filter-chip button {
  background: none; border: none; cursor: pointer;
  color: #3b82f6; font-size: .85rem; line-height: 1;
  padding: 0 0 0 2px; margin: 0;
  display: flex; align-items: center;
}
.filter-chip button:hover { color: #1d4ed8; }

/* ── CARD VISUAL ENHANCEMENTS ───────────────────────────────── */
.kanban-card-numero {
  font-size: .68rem; color: var(--text-muted);
  font-family: 'Courier New', monospace; letter-spacing: .03em;
}

.prio-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.prio-urgente { background: var(--danger); box-shadow: 0 0 0 2px rgba(239,68,68,.2); }
.prio-alta    { background: var(--warning); }
.prio-normal  { background: var(--primary); }
.prio-baixa   { background: var(--text-muted); }

@keyframes pulse-overdue {
  0%, 100% { box-shadow: 0 0 0 1px rgba(239,68,68,.25), 0 2px 6px rgba(0,0,0,.06); }
  50%       { box-shadow: 0 0 0 2px rgba(239,68,68,.50), 0 4px 12px rgba(239,68,68,.15); }
}
.kanban-card-overdue {
  animation: pulse-overdue 2.5s ease-in-out infinite;
}

/* Drag-and-drop */
.kanban-card-ghost  { opacity: .35; background: var(--page-bg) !important; }
.kanban-card-chosen { box-shadow: 0 10px 28px rgba(0,0,0,.18); transform: rotate(1.5deg); cursor: grabbing; }
.kanban-card-drag   { opacity: .9; }
.etapa-ghost        { opacity: .35; background: var(--page-bg) !important; border-radius: 6px; }
.kanban-cards,
.etapas-kanban-cards { min-height: 80px; } /* evita colapso de colunas vazias durante drag */
.kanban-cards.sortable-over,
.etapas-kanban-cards.sortable-over { background: rgba(59,130,246,.06); border-radius: 8px; }
.kanban-card        { cursor: grab; }
.kanban-card:active { cursor: grabbing; }

.kanban-col-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 12px; color: var(--text-muted); font-size: .8rem;
  border: 2px dashed var(--border); border-radius: 10px; gap: 6px;
}
.kanban-col-empty i { font-size: 1.4rem; }

/* ── FASES DE ETAPAS ────────────────────────────────────────────── */
.fase-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.fase-header:not(:first-child) { margin-top: 12px; }

.fase-numero {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
}
.fase-nome {
  font-size: .78rem; font-weight: 600; color: var(--text-main);
}
.fase-paralela-badge {
  font-size: .65rem; padding: 2px 6px; border-radius: 10px;
  background: #eff6ff; color: #3b82f6; font-weight: 500;
}
.fase-etapas { padding-left: 8px; }

/* Cabeçalho de fase no drawer de tarefa (lista de etapas) */
.fase-header-task {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0 3px; margin-top: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── PAINEL DE PRAZOS ───────────────────────────────────────────── */
.prazo-faixa { border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }

.prazo-faixa-header {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--card-bg); border: none; cursor: pointer;
  transition: background .15s;
  text-align: left;
}
.prazo-faixa-header:hover { background: var(--page-bg); }
.prazo-faixa-header[aria-expanded="false"] .prazo-chevron { transform: rotate(-90deg); }
.prazo-chevron { font-size: .75rem; color: var(--text-muted); transition: transform .2s; }

.prazo-lista { background: var(--card-bg); }

.prazo-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.prazo-item:last-child { border-bottom: none; }
.prazo-item:hover { background: var(--page-bg); }

.prazo-tipo  { flex-shrink: 0; font-size: .9rem; }
.prazo-numero {
  flex-shrink: 0; min-width: 130px;
  font-family: 'Courier New', monospace; font-size: .72rem; color: var(--text-muted);
}
.prazo-titulo { flex: 1; font-size: .875rem; font-weight: 500; min-width: 0;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prazo-area   { flex-shrink: 0; min-width: 110px; }
.prazo-cliente { flex-shrink: 0; min-width: 130px; font-size: .78rem;
                 white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prazo-resp   { flex-shrink: 0; min-width: 110px; font-size: .78rem; }
.prazo-dias   { flex-shrink: 0; }
.prazo-data-real {
  font-size: .72rem; color: var(--text-muted); font-family: monospace;
  white-space: nowrap; flex-shrink: 0;
}

/* ── Prazos task-centric ─────────────────────────────────── */
.prazos-tarefa-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--card-bg);
  transition: background .12s;
}
.prazos-tarefa-header:hover { background: #f8fafc; }
.prazos-tarefa-titulo {
  flex: 1; font-weight: 600; font-size: .875rem; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.prazos-etapa-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: var(--page-bg);
  border-top: 1px solid var(--border);
  font-size: .82rem;
}
.prazos-etapa-indent {
  width: 20px; flex-shrink: 0;
  border-left: 2px solid var(--border);
  height: 20px; margin-left: 4px;
}
.prazos-etapa-titulo {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── OPORTUNIDADE DRAWER ────────────────────────────────────────── */
.op-info-block { display: flex; flex-direction: column; gap: 2px; }
.op-info-block small { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.op-info-block span { font-size: .875rem; }
.op-section-title {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); font-weight: 600; margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.border-dashed { border-style: dashed !important; }

/* ── TIMELINE (histórico interações) ────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex; gap: 12px; padding-bottom: 16px;
  position: relative;
}
.timeline-item:not(:last-child)::before {
  content: ''; position: absolute;
  left: 7px; top: 20px; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary); flex-shrink: 0; margin-top: 3px;
  border: 2px solid var(--card-bg); box-shadow: 0 0 0 2px var(--primary);
}
.timeline-body { flex: 1; min-width: 0; }

/* ── WHATSAPP INBOX ─────────────────────────────────────────────── */
.wa-inbox {
  display: flex; gap: 0;
  height: calc(100vh - var(--topbar-h) - 48px);
  background: var(--card-bg);
  border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden;
}

/* Sidebar esquerda */
.wa-sidebar {
  width: 320px; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
}
.wa-sidebar-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wa-conversa-lista { flex: 1; overflow-y: auto; }

/* Item de conversa */
.wa-conversa-item {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.wa-conversa-item:hover { background: var(--page-bg); }
.wa-conversa-ativa { background: #eff6ff; }
.wa-conversa-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: #25d366; color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
}
.wa-conversa-body { flex: 1; min-width: 0; }
.wa-conversa-top { display: flex; justify-content: space-between; align-items: baseline; }
.wa-conversa-nome { font-weight: 600; font-size: .875rem;
                    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-conversa-hora { font-size: .72rem; flex-shrink: 0; }
.wa-conversa-bottom { display: flex; justify-content: space-between; align-items: center; }
.wa-conversa-preview {
  font-size: .78rem; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; flex: 1;
}
.wa-badge {
  background: #25d366; color: #fff;
  font-size: .65rem; font-weight: 700; border-radius: 10px;
  padding: 1px 5px; min-width: 18px; text-align: center;
}

/* Painel principal (mensagens) */
.wa-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wa-placeholder {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted);
}
.wa-placeholder i { font-size: 3rem; color: #25d366; margin-bottom: 16px; }

.wa-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; background: var(--card-bg);
}

/* Área de mensagens */
.wa-mensagens-area {
  flex: 1; overflow-y: auto;
  padding: 16px; background: #f0f2f5;
  display: flex; flex-direction: column; gap: 4px;
}

.wa-date-divider {
  text-align: center; margin: 8px 0;
}
.wa-date-divider span {
  background: #fff; border: 1px solid var(--border);
  padding: 2px 10px; border-radius: 10px; font-size: .75rem; color: var(--text-muted);
}

/* Balões */
.wa-msg { display: flex; margin-bottom: 2px; }
.wa-msg-in  { justify-content: flex-start; }
.wa-msg-out { justify-content: flex-end; }

.wa-bubble {
  max-width: 65%; padding: 8px 12px; border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.wa-msg-in  .wa-bubble { background: #fff; border-bottom-left-radius: 3px; }
.wa-msg-out .wa-bubble { background: #d9fdd3; border-bottom-right-radius: 3px; }

.wa-msg-texto { margin: 0; font-size: .875rem; white-space: pre-wrap; line-height: 1.45; }
.wa-msg-media { display: flex; align-items: center; color: var(--text-muted); font-size: .85rem; }
.wa-msg-media-block { flex-direction: column; align-items: flex-start; }
.wa-audio-player { width: 220px; height: 36px; }
.wa-img-preview { max-width: 260px; max-height: 260px; border-radius: 8px; display: block; cursor: zoom-in; }
.wa-video-player { max-width: 280px; border-radius: 8px; display: block; }
.wa-msg-caption { margin: 4px 0 0; font-size: .8rem; color: var(--text-muted); }
.wa-doc-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: #0d6efd; font-size: .85rem; text-decoration: none;
  padding: 4px 8px; border-radius: 6px; border: 1px solid #c5dcfa; background: #f0f7ff;
}
.wa-doc-link:hover { background: #dbeeff; }
.wa-transcricao {
  margin-top: 4px; font-size: .8rem; color: var(--text-muted);
  font-style: italic; border-top: 1px solid var(--border); padding-top: 4px;
}
.wa-msg-meta {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 4px; margin-top: 3px;
}
.wa-msg-hora  { font-size: .68rem; color: var(--text-muted); }
.wa-msg-autor { font-size: .68rem; color: var(--text-muted); }

.wa-empty-msgs {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}

/* Input area */
.wa-input-area {
  padding: 10px 14px; border-top: 1px solid var(--border);
  background: var(--card-bg); flex-shrink: 0;
}
.wa-input-disabled {
  display: flex; align-items: center; justify-content: center;
  padding: 10px; background: var(--page-bg); border-radius: 8px; font-size: .875rem;
}
.wa-input-form {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--page-bg); border-radius: 24px; padding: 6px 6px 6px 16px;
}
.wa-input {
  flex: 1; background: none; border: none; outline: none; resize: none;
  font-size: .9rem; line-height: 1.4; max-height: 120px; overflow-y: auto;
  font-family: inherit; padding: 4px 0;
}
.wa-send-btn {
  background: #25d366; color: #fff; border: none;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0; transition: background .15s;
}
.wa-send-btn:hover { background: #1da851; }
.wa-send-btn:disabled { background: var(--text-muted); cursor: not-allowed; }

/* ── TRILHA DE VÍNCULOS ─────────────────────────────────────────── */
.trilha-vinculos { display: flex; flex-direction: column; gap: 0; }
.trilha-node { display: flex; align-items: flex-start; gap: 10px; }
.trilha-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; flex-shrink: 0; margin-top: 1px;
}
.trilha-wpp  { background: #dcfce7; color: #16a34a; }
.trilha-sol  { background: #e0f2fe; color: #0369a1; }
.trilha-tar  { background: #ede9fe; color: #7c3aed; }
.trilha-op   { background: #fef9c3; color: #b45309; }
.trilha-content { flex: 1; min-width: 0; padding-bottom: 2px; }
.trilha-label { font-size: .7rem; color: #94a3b8; display: block; line-height: 1.2; }
.trilha-link  { font-size: .82rem; font-weight: 500; text-decoration: none; color: inherit; }
.trilha-link:hover { text-decoration: underline; }
.trilha-current { font-size: .82rem; font-weight: 600; color: var(--text-main); }
.trilha-connector {
  width: 28px; display: flex; justify-content: center;
  margin: 1px 0; flex-shrink: 0;
}
.trilha-connector::before {
  content: ''; width: 2px; height: 14px; background: #e2e8f0;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #sidebar-toggle { display: block; }
  #topbar { left: 0; }
  #content { margin-left: 0; padding: 16px; }
  .drawer { width: 100%; }
  .notif-dropdown { width: 280px; }
}
