:root {
  /* Identidade AP Bebidas: bronze/café escuro + dourado âmbar (logo). */
  --sf-primary: #3D2711;
  --sf-primary-light: #5C3A1A;
  --sf-accent: #E29A3A;
  --sf-accent-dark: #C97F1E;
  --sf-bg: #f4f6f9;
  --sf-border: #e5e9f0;
  --sf-text-muted: #6b7280;
  --sf-radius: 0.65rem;

  /* Faz os utilitários do próprio Bootstrap (text-primary, bg-primary,
     border-primary, btn-outline-primary...) seguirem a marca em vez do
     azul padrão, sem precisar reescrever cada view. */
  --bs-primary: var(--sf-primary);
  --bs-primary-rgb: 61, 39, 17;
}

body {
  background-color: var(--sf-bg);
  color: #1f2937;
  font-size: 0.925rem;
}

/* ---------------- Layout admin ---------------- */
.sf-shell {
  display: flex;
  min-height: 100vh;
}

.sf-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--sf-primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1030;
}

.sf-sidebar-brand {
  padding: 1.35rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sf-logo-img {
  height: 42px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  flex-shrink: 0;
}

.sf-logo-img-lg {
  height: 72px;
  width: auto;
  object-fit: contain;
}

.sf-sidebar-brand .sf-logo-badge {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--sf-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.sf-sidebar-brand small {
  color: rgba(255, 255, 255, 0.65);
  display: block;
  font-size: 0.7rem;
}

.sf-nav {
  flex: 1;
  padding: 0.75rem 0.75rem;
  overflow-y: auto;
}

.sf-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: rgba(255, 255, 255, 0.75);
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 0.15rem;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.sf-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sf-nav a.active {
  /* Faixa dourada + fundo translúcido em vez de preenchimento sólido:
     texto branco sobre dourado puro tem contraste ruim (~2.4:1). */
  background: rgba(226, 154, 58, 0.16);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--sf-accent);
}

.sf-nav a i {
  font-size: 1rem;
  width: 18px;
  text-align: center;
}

.sf-sidebar-footer {
  padding: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sf-main {
  margin-left: 250px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sf-topbar {
  background: #fff;
  border-bottom: 1px solid var(--sf-border);
  padding: 0.85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.sf-content {
  padding: 1.75rem;
  flex: 1;
}

@media (max-width: 991.98px) {
  .sf-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sf-sidebar.show {
    transform: translateX(0);
  }
  .sf-main {
    margin-left: 0;
  }
}

/* ---------------- Componentes ---------------- */
.sf-card {
  background: #fff;
  border: 1px solid var(--sf-border);
  border-radius: var(--sf-radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.sf-stat-card {
  background: #fff;
  border: 1px solid var(--sf-border);
  border-radius: var(--sf-radius);
  padding: 1.25rem 1.4rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.sf-stat-card .sf-stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--sf-primary);
  line-height: 1.1;
}

.sf-stat-card .sf-stat-label {
  color: var(--sf-text-muted);
  font-size: 0.82rem;
  margin-top: 0.35rem;
}

.sf-stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.badge-status {
  font-weight: 500;
  font-size: 0.72rem;
  padding: 0.4em 0.7em;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.sf-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sf-text-muted);
  border-bottom: 1px solid var(--sf-border);
  font-weight: 600;
  background: #fafbfc;
}

.sf-table td {
  vertical-align: middle;
  font-size: 0.875rem;
}

.sf-timeline {
  position: relative;
  padding-left: 1.75rem;
  border-left: 2px solid var(--sf-border);
  margin-left: 0.4rem;
}

.sf-timeline-item {
  position: relative;
  padding-bottom: 1.4rem;
}

.sf-timeline-item::before {
  content: '';
  position: absolute;
  left: -2.05rem;
  top: 0.15rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sf-accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--sf-accent);
}

.sf-timeline-time {
  font-size: 0.75rem;
  color: var(--sf-text-muted);
}

.sf-brand-link {
  color: inherit;
  text-decoration: none;
}

.sf-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--sf-text-muted);
}

.btn-primary {
  background-color: var(--sf-accent);
  border-color: var(--sf-accent);
  /* Texto branco sobre o dourado não teria contraste suficiente. */
  color: #2b1a0c;
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--sf-accent-dark);
  border-color: var(--sf-accent-dark);
  color: #2b1a0c;
}

/* ---------------- Conversas (chat estilo WhatsApp) ---------------- */
.sf-chat-shell {
  display: flex;
  height: calc(100vh - 160px);
  min-height: 480px;
  background: #fff;
  border: 1px solid var(--sf-border);
  border-radius: var(--sf-radius);
  overflow: hidden;
}

.sf-chat-list {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--sf-border);
  overflow-y: auto;
  overflow-x: hidden;
}

.sf-chat-list-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f1f3f6;
  max-width: 100%;
}

/* Bootstrap não tem utilitária ".min-w-0": sem isso, um item flex nunca
   encolhe abaixo do tamanho do seu conteúdo, e "text-truncate" não
   surte efeito nenhum dentro de uma linha flex. */
.sf-chat-list-item > .flex-grow-1 {
  min-width: 0;
}

.sf-chat-list-item .text-truncate {
  display: block;
}

.sf-chat-list-item .d-flex.justify-content-between > .text-truncate {
  min-width: 0;
  flex-shrink: 1;
}

.sf-chat-body {
  min-width: 0;
}

.sf-chat-messages {
  overflow-x: hidden;
}

.sf-chat-compose {
  background: #fff;
  border-top: 1px solid var(--sf-border);
  padding: 0.75rem 1rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
}

.sf-chat-compose textarea {
  resize: none;
}

.sf-chat-list-item:hover {
  background: #f8f9fb;
}

.sf-chat-list-item.active {
  background: #eef4ff;
}

.sf-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--sf-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.sf-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #e9edf2;
}

.sf-chat-header {
  background: #fff;
  border-bottom: 1px solid var(--sf-border);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.sf-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sf-chat-bubble {
  max-width: 65%;
  padding: 0.55rem 0.8rem;
  border-radius: 0.7rem;
  font-size: 0.85rem;
  white-space: pre-line;
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.06);
}

.sf-chat-bubble.outbound {
  align-self: flex-end;
  background: #dcf8c6;
  border-bottom-right-radius: 0.15rem;
}

.sf-chat-bubble.inbound {
  align-self: flex-start;
  background: #fff;
  border-bottom-left-radius: 0.15rem;
}

.sf-chat-meta {
  font-size: 0.68rem;
  color: var(--sf-text-muted);
  margin-top: 0.25rem;
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

/* ---------------- Kanban ---------------- */
.kanban-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  align-items: flex-start;
}

.kanban-column {
  background: #f4f6f9;
  border: 1px solid var(--sf-border);
  border-radius: var(--sf-radius);
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.kanban-column.drag-over {
  border-color: var(--sf-accent);
  background: #eef4ff;
}

.kanban-column-header {
  padding: 0.85rem 1rem;
  font-weight: 600;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--sf-border);
}

.kanban-cards {
  padding: 0.6rem;
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
}

.kanban-card {
  background: #fff;
  border: 1px solid var(--sf-border);
  border-radius: 0.5rem;
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.6rem;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  transition: opacity 0.15s ease;
}

.kanban-card.dragging {
  opacity: 0.4;
}

.kanban-empty {
  color: var(--sf-text-muted);
  font-size: 0.78rem;
  text-align: center;
  padding: 1rem 0.5rem;
}

.sf-toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 2000;
  max-width: 320px;
}

/* ---------------- Página pública de assinatura ---------------- */
.sf-public-page {
  background: linear-gradient(180deg, #f4f6f9 0%, #eef1f6 100%);
  min-height: 100vh;
}

.sf-public-card {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 4px 24px rgba(16, 24, 40, 0.08);
  border: 1px solid var(--sf-border);
}

#signature-pad-canvas {
  border: 2px dashed #cbd5e1;
  border-radius: 0.5rem;
  width: 100%;
  touch-action: none;
  background: #fff;
  cursor: crosshair;
}

.sf-pdf-frame {
  width: 100%;
  height: 60vh;
  border: 1px solid var(--sf-border);
  border-radius: 0.5rem;
  background: #525659;
}

.sf-success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto;
}
