/* ============================================================
   Holding II Caciques — Estilos Globais
   Design: Azul escuro premium, moderno e responsivo
   ============================================================ */

/* ---------- Variáveis ---------- */
:root {
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --sidebar-bg: #0d1b2e;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active: rgba(37,99,235,.25);
  --sidebar-text: #b8c9e4;
  --sidebar-text-active: #ffffff;
  --topbar-h: 64px;
  --topbar-bg: #ffffff;
  --content-bg: #f0f4f8;
  --primary: #2563eb;
  --primary-dark: #1a3a6e;
  --card-radius: 14px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --transition: .2s ease;
}

/* ---------- Reset base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .9375rem;
  color: #1e293b;
  background: var(--content-bg);
  overflow-x: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: width var(--transition);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

/* Header */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  min-height: 72px;
  overflow: hidden;
}

.sidebar-logo {
  flex-shrink: 0;
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #1a3a6e, #2563eb);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff;
}

.sidebar-brand { overflow: hidden; white-space: nowrap; }
.brand-name { display: block; color: #fff; font-weight: 800; font-size: .95rem; }
.brand-sub  { display: block; color: #7a92b5; font-size: .72rem; }

/* Nav */
.sidebar-nav {
  list-style: none;
  margin: 12px 0 0;
  padding: 0 10px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-item { margin-bottom: 2px; }

/* Grupo separador do menu */
.sidebar-separator {
  list-style: none;
  margin: 18px 0 5px;
  padding: 0 8px;
}
.sidebar-separator span {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.55);
  white-space: nowrap;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,.12);
  padding-bottom: 4px;
}
/* Quando sidebar colapsada, ocultar texto do separador */
.sidebar.collapsed .sidebar-separator span { visibility: hidden; height: 0; margin: 6px 0; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: all var(--transition);
}

.sidebar-link i { font-size: 1.1rem; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-link:hover { background: var(--sidebar-hover); color: #fff; }

.sidebar-item.active .sidebar-link {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 600;
}

/* Footer */
.sidebar-footer {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-footer .sidebar-link { font-size: .82rem; }
.text-danger-light { color: #f87171 !important; }
.text-danger-light:hover { color: #ef4444 !important; }

/* ---------- Main Wrapper ---------- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.main-wrapper.collapsed { margin-left: var(--sidebar-collapsed); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 1030;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.btn-toggle {
  background: none; border: none;
  width: 38px; height: 38px;
  border-radius: 8px;
  font-size: 1.4rem; color: #64748b;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition);
  flex-shrink: 0;
}
.btn-toggle:hover { background: #f1f5f9; color: #1e293b; }

.topbar-breadcrumb .breadcrumb { font-size: .82rem; }
.topbar-breadcrumb .breadcrumb-item a { color: var(--primary); text-decoration: none; }

/* User button */
.user-btn {
  background: none; border: none;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 10px;
  cursor: pointer; transition: background var(--transition);
}
.user-btn:hover { background: #f1f5f9; }

.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #1a3a6e, #2563eb);
  color: #fff; font-weight: 700; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name  { font-size: .875rem; font-weight: 600; color: #1e293b; line-height: 1.2; }
.user-role  { font-size: .72rem; color: #94a3b8; }

/* Bell */
.btn-icon {
  background: none; border: none;
  width: 38px; height: 38px; border-radius: 8px;
  font-size: 1.2rem; color: #64748b;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background var(--transition);
}
.btn-icon:hover { background: #f1f5f9; color: #1e293b; }

.badge-dot {
  position: absolute; top: -2px; right: -2px;
  background: #ef4444; color: #fff;
  font-size: .6rem; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}

/* ---------- Page Content ---------- */
.page-content {
  flex: 1;
  padding: 28px 28px 16px;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.page-title { font-size: 1.5rem; font-weight: 800; color: #0f172a; margin: 0; }
.page-subtitle { color: #64748b; font-size: .875rem; margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Card Panel ---------- */
.card-panel {
  background: #fff;
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.card-panel-title {
  font-size: .9rem;
  font-weight: 700;
  color: #374151;
  margin: 0;
  display: flex;
  align-items: center;
}

.card-panel-body { padding: 20px; }

/* ---------- KPI Cards ---------- */
.kpi-card {
  border-radius: var(--card-radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.kpi-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}

.kpi-value { font-size: 1.4rem; font-weight: 900; line-height: 1.1; }
.kpi-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; opacity: .75; margin-top: 2px; }
.kpi-sub   { font-size: .72rem; opacity: .65; margin-top: 3px; }

/* KPI color schemes */
.kpi-blue   { background: linear-gradient(135deg,#eff6ff,#dbeafe); }
.kpi-blue   .kpi-icon { background: #2563eb; color: #fff; }
.kpi-blue   .kpi-value { color: #1e40af; }

.kpi-green  { background: linear-gradient(135deg,#f0fdf4,#dcfce7); }
.kpi-green  .kpi-icon { background: #22c55e; color: #fff; }
.kpi-green  .kpi-value { color: #166534; }

.kpi-red    { background: linear-gradient(135deg,#fff1f2,#ffe4e6); }
.kpi-red    .kpi-icon { background: #ef4444; color: #fff; }
.kpi-red    .kpi-value { color: #991b1b; }

.kpi-purple { background: linear-gradient(135deg,#faf5ff,#ede9fe); }
.kpi-purple .kpi-icon { background: #8b5cf6; color: #fff; }
.kpi-purple .kpi-value { color: #5b21b6; }

.kpi-teal   { background: linear-gradient(135deg,#f0fdfa,#ccfbf1); }
.kpi-teal   .kpi-icon { background: #14b8a6; color: #fff; }
.kpi-teal   .kpi-value { color: #0f766e; }

.kpi-orange { background: linear-gradient(135deg,#fff7ed,#ffedd5); }
.kpi-orange .kpi-icon { background: #f97316; color: #fff; }
.kpi-orange .kpi-value { color: #9a3412; }

.kpi-dark   { background: linear-gradient(135deg,#f8fafc,#e2e8f0); }
.kpi-dark   .kpi-icon { background: #334155; color: #fff; }
.kpi-dark   .kpi-value { color: #0f172a; }

.ring-active { outline: 3px solid #ef4444; }

/* ---------- Tables ---------- */
.table thead th {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 2px solid #e5e7eb;
  white-space: nowrap;
}
.table tbody tr { transition: background var(--transition); }
.table-hover tbody tr:hover { background: #f8fafc; }
.table td { vertical-align: middle; padding: .75rem 1rem; }
.table th { padding: .75rem 1rem; }

/* ---------- Avatar sm ---------- */
.avatar-sm {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; flex-shrink: 0;
}

.bg-primary-light { background: #dbeafe; }
.text-primary { color: #2563eb !important; }
.bg-success-light { background: #dcfce7; }
.text-success { color: #16a34a !important; }

/* ---------- Buttons ---------- */
.btn-primary {
  background: linear-gradient(135deg, #1a3a6e, #2563eb);
  border: none;
  font-weight: 600;
  letter-spacing: .2px;
  transition: all var(--transition);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #162f5e, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
}

.btn-xs {
  padding: 2px 8px;
  font-size: .75rem;
  border-radius: 6px;
}

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-radius: 10px;
  border-color: #e2e8f0;
  font-size: .9rem;
  transition: all var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-label { font-size: .83rem; font-weight: 600; color: #374151; margin-bottom: 5px; }

/* ---------- Footer ---------- */
.page-footer {
  display: flex;
  align-items: center;
  padding: 12px 28px;
  border-top: 1px solid #e5e7eb;
  font-size: .78rem;
  color: #94a3b8;
  background: #fff;
}

/* ---------- Responsividade ---------- */
@media (max-width: 768px) {
  :root { --sidebar-width: 260px; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition), width var(--transition);
  }
  .sidebar.mobile-open { transform: translateX(0); }

  .main-wrapper { margin-left: 0 !important; }

  .page-content { padding: 16px; }

  .kpi-value { font-size: 1.1rem; }

  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1039;
  }
  .sidebar-overlay.active { display: block; }
}

@media (max-width: 576px) {
  .page-header { flex-direction: column; }
  .topbar { padding: 0 12px; gap: 8px; }
}

/* ---------- Utilities ---------- */
.w-40 { width: 40%; }
code { color: #6366f1; font-size: .85rem; background: #f1f0ff; padding: 2px 6px; border-radius: 4px; }

/* Scrollbar global */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Sticky thead */
.table-responsive { border-radius: var(--card-radius); }

/* Alert customizado */
.alert { border-radius: 10px; }
