/* =====================================================
   MIX AGÊNCIA CRIATIVA — Sistema Interno
   Versão 1.0
   ===================================================== */

:root {
  --cor-primaria: #5B4FBE;
  --cor-sidebar-bg: #1e1b4b;
  --cor-sidebar-text: #c7c3f0;
  --cor-topbar: #ffffff;
  --sidebar-width: 250px;
  --topbar-height: 60px;
  --transition: .25s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.mix-layout {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #f1f3f8;
  color: #2d2d3a;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==================== SIDEBAR ==================== */
.mix-sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--cor-sidebar-bg);
  color: var(--cor-sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 1000;
  transition: transform var(--transition), width var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.mix-sidebar::-webkit-scrollbar { width: 4px; }
.mix-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: 72px;
}

.sidebar-logo {
  height: 40px;
  width: 40px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
  background: rgba(255,255,255,.06);
}

/* Selo só com ícone — evita sobrepor o nome (antes: ícone + 3 letras em caixa 40px) */
.sidebar-brand-mark {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--cor-primaria);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.sidebar-brand-mark .bi {
  line-height: 1;
  display: block;
}

.sidebar-brand-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.sidebar-name {
  font-size: .8125rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
  line-height: 1.35;
  text-shadow: none;
  -webkit-font-smoothing: antialiased;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.sidebar-menu {
  list-style: none;
  padding: 8px 0;
  flex: 1;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--cor-sidebar-text);
  text-decoration: none;
  font-size: .875rem;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}

.sidebar-menu li a:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}

.sidebar-menu li.active > a,
.sidebar-menu li.active > a:hover {
  background: var(--cor-primaria);
  color: #fff;
  font-weight: 600;
}

.sidebar-menu li a i.bi:first-child { font-size: 1rem; min-width: 20px; }

.sidebar-divider {
  border-top: 1px solid rgba(255,255,255,.08);
  margin: 6px 16px;
}

.sidebar-sub {
  list-style: none;
  padding: 0;
  background: rgba(0,0,0,.15);
}

.sidebar-sub li a {
  padding-left: 50px !important;
  font-size: .82rem;
}

.sidebar-sub li.active a {
  color: #fff;
  font-weight: 600;
}

.sidebar-arrow { transition: transform var(--transition); font-size: .75rem !important; }
a:not(.collapsed) .sidebar-arrow { transform: rotate(180deg); }

.sidebar-footer {
  padding: 12px 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.avatar-initials {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--cor-primaria);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ==================== MAIN ==================== */
.mix-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex: 1;
  transition: margin-left var(--transition);
}

/* ==================== TOPBAR ==================== */
.mix-topbar {
  height: var(--topbar-height);
  background: var(--cor-topbar);
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.sidebar-toggle {
  border: none;
  background: transparent;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 6px;
  transition: background var(--transition);
}
.sidebar-toggle:hover { background: #f0f0f5; }

/* ==================== CONTENT ==================== */
.mix-content {
  padding: 24px;
  flex: 1;
}

.mix-footer {
  text-align: center;
  padding: 12px 24px;
  border-top: 1px solid #e5e7eb;
  color: #9ca3af;
  background: #fff;
}

/* ==================== CARDS DASHBOARD ==================== */
.card-kpi {
  border: none;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  transition: transform .2s, box-shadow .2s;
  overflow: hidden;
}
.card-kpi:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }

.card-kpi .icon-box {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}

.card-kpi .kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
}
.card-kpi .kpi-label { font-size: .78rem; color: #6b7280; font-weight: 500; }

/* ==================== TABLES ==================== */
.table { font-size: .875rem; }
.table th { font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; border-bottom: 2px solid #e5e7eb; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8f9ff; }

/* ==================== KANBAN ==================== */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: calc(100vh - 200px);
}

.kanban-column {
  min-width: 260px;
  max-width: 280px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #f0f0f5;
}

.kanban-column-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kanban-column-title { font-weight: 600; font-size: .85rem; flex: 1; }
.kanban-column-count { background: #f0f0f5; border-radius: 20px; padding: 1px 8px; font-size: .72rem; font-weight: 700; }

.kanban-cards {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}

.kanban-card {
  background: #fff;
  border: 1px solid #e8e8f0;
  border-radius: 10px;
  padding: 12px;
  cursor: grab;
  transition: box-shadow .2s, transform .2s;
  border-left: 4px solid var(--cor-primaria);
}
.kanban-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); transform: translateY(-2px); }
.kanban-card.sortable-ghost { opacity: .4; }
.kanban-card.sortable-drag { cursor: grabbing; box-shadow: 0 8px 24px rgba(0,0,0,.15); }

.kanban-card-title { font-size: .83rem; font-weight: 600; line-height: 1.3; margin-bottom: 6px; }
.kanban-card-meta { font-size: .72rem; color: #9ca3af; display: flex; justify-content: space-between; align-items: center; }

.priority-urgente { border-left-color: #dc2626 !important; }
.priority-alta    { border-left-color: #f97316 !important; }
.priority-normal  { border-left-color: var(--cor-primaria) !important; }
.priority-baixa   { border-left-color: #9ca3af !important; }

/* ==================== FORMS ==================== */
.form-label { font-size: .83rem; font-weight: 600; color: #374151; margin-bottom: .35rem; }
.form-control, .form-select {
  border-color: #d1d5db;
  border-radius: 8px;
  font-size: .875rem;
  padding: .5rem .75rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--cor-primaria);
  box-shadow: 0 0 0 3px rgba(91,79,190,.15);
}

/* ==================== BADGES STATUS ==================== */
.badge { font-size: .72rem; font-weight: 600; border-radius: 6px; padding: .3em .65em; }

/* ==================== PÁGINA DE LOGIN ==================== */
body.login-page {
  background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 50%, #5B4FBE 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  width: 72px; height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, #5B4FBE, #3730a3);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  color: #fff;
  margin: 0 auto 20px;
}

/* Logotipo enviado em Configurações → Empresa (substitui o ícone) */
.login-logo--brand {
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  padding: 8px;
}

.login-logo-img {
  display: block;
  max-width: 100%;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Conteúdo vindo do editor rico (Summernote) */
.rich-content { font-size: .9rem; line-height: 1.55; word-break: break-word; }
.rich-content img { max-width: 100%; height: auto; border-radius: 8px; }
.rich-content iframe { max-width: 100%; border: 0; border-radius: 8px; min-height: 220px; }

/* ==================== ÁREA DO CLIENTE ==================== */
body.client-area {
  background: #f8f9fb;
  min-height: 100vh;
}

.client-header {
  background: var(--cor-primaria);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* Portal do cliente (layout com sidebar) */
body.client-portal {
  background: #eef0f6;
  min-height: 100vh;
  margin: 0;
}

.client-sidebar-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1100;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

.client-portal-layout {
  display: flex;
  min-height: 100vh;
}

.client-portal-sidebar {
  width: 268px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
  color: #c7c3f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  z-index: 1050;
  transition: transform .25s ease;
}

.client-portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.client-portal-brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}

.client-portal-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--cor-primaria);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.client-portal-brand-name {
  font-weight: 800;
  color: #fff;
  font-size: .9rem;
  line-height: 1.2;
}

.client-portal-brand-sub {
  font-size: .68rem;
  opacity: .75;
}

.client-portal-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.client-portal-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: inherit;
  text-decoration: none;
  font-size: .88rem;
  transition: background .2s, color .2s;
}

.client-portal-nav a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.client-portal-nav a.active {
  background: rgba(91, 79, 190, .45);
  color: #fff;
  font-weight: 600;
  border-left: 3px solid #fff;
}

.client-portal-sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
}

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

.client-portal-topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 14px 28px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.client-portal-topbar-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1f2937;
}

.client-portal-content {
  padding: 24px 28px 40px;
  flex: 1;
}

.client-dashboard-hero h2 { color: #1f2937; }

.client-kpi {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
  height: 100%;
}

.client-kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.client-kpi-value { font-size: 1.15rem; font-weight: 800; color: #1f2937; }
.client-kpi-label { font-size: .72rem; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }

.client-timeline { padding: 8px 16px 16px; }
.client-timeline-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f5;
}
.client-timeline-item:last-child { border-bottom: none; }
.client-timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cor-primaria);
  margin-top: 6px;
  flex-shrink: 0;
}

@media (max-width: 991px) {
  .client-portal-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    box-shadow: 8px 0 24px rgba(0,0,0,.2);
  }
  .client-portal-sidebar.open {
    transform: translateX(0);
  }
  .client-portal-content { padding: 20px 16px 32px; }
  .client-portal-topbar { display: none !important; }
}

/* ==================== SIDEBAR COLLAPSED ==================== */
.sidebar-collapsed .mix-sidebar { width: 66px; }
.sidebar-collapsed .mix-sidebar .sidebar-brand-title,
.sidebar-collapsed .mix-sidebar li a span,
.sidebar-collapsed .mix-sidebar .sidebar-arrow,
.sidebar-collapsed .mix-sidebar .sidebar-footer .overflow-hidden { display: none; }
.sidebar-collapsed .mix-sidebar .sidebar-brand {
  justify-content: center;
  padding: 16px 12px;
}
.sidebar-collapsed .mix-sidebar .sidebar-logo {
  height: 36px;
  width: 36px;
}
.sidebar-collapsed .mix-sidebar li a { padding: 10px 16px; justify-content: center; }
.sidebar-collapsed .mix-sidebar .sidebar-footer .d-flex { justify-content: center; }
.sidebar-collapsed .mix-main { margin-left: 66px; }

/* ==================== PDV ==================== */
.pdv-item-list { max-height: 320px; overflow-y: auto; }

.pdv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 6px;
}

/* ==================== UTILITÁRIOS ==================== */
.btn-primary { background: var(--cor-primaria); border-color: var(--cor-primaria); }
.btn-primary:hover { background: #4c3db0; border-color: #4c3db0; }
.btn-outline-primary { color: var(--cor-primaria); border-color: var(--cor-primaria); }
.btn-outline-primary:hover { background: var(--cor-primaria); border-color: var(--cor-primaria); }

.text-primary { color: var(--cor-primaria) !important; }
.bg-primary   { background-color: var(--cor-primaria) !important; }
.border-primary { border-color: var(--cor-primaria) !important; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title { font-size: 1.35rem; font-weight: 800; color: #1f2937; margin: 0; }
.page-subtitle { font-size: .82rem; color: #6b7280; margin-top: 2px; }

.section-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  margin-bottom: 24px;
  overflow: hidden;
}

.section-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-card-title { font-weight: 700; font-size: .9rem; margin: 0; }
.section-card-body  { padding: 20px; }

/* Overdue alert */
.overdue-badge { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.6; } }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .mix-sidebar {
    transform: translateX(-100%);
  }
  .mix-sidebar.open {
    transform: translateX(0);
  }
  .mix-main {
    margin-left: 0;
  }
  .mix-content { padding: 16px; }
  .kanban-board { padding-bottom: 24px; }
}
