:root {
  --adl-primary: #000F9F;
  --adl-secondary: #DCE3EB;
  --adl-accent: #95E1BF;
  --adl-aux-blue: #3639A4;
  --adl-aux-black: #191817;
  --adl-white: #FFFFFF;
  --sidebar-width: 240px;
  --sidebar-bg: var(--adl-primary);
  --sidebar-text: rgba(255, 255, 255, .95);
  --sidebar-text-muted: rgba(255, 255, 255, .65);
  --sidebar-hover-bg: rgba(149, 225, 191, .15);
  --shadow-sm: 0 2px 8px rgba(0, 15, 159, .08);
  --shadow-md: 0 4px 16px rgba(0, 15, 159, .12);
  --shadow-lg: 0 8px 24px rgba(0, 15, 159, .16);
  --ap-blue: var(--adl-primary);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #F8F9FA;
  color: var(--adl-aux-black);
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--adl-primary) 0%, #000C7A 100%) !important;
  color: var(--sidebar-text);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  padding-top: 0 !important;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, .05);
}

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

.sidebar-logo,
.sidebar .logo {
  min-height: auto;
  text-align: center;
  padding: 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: rgba(0, 0, 0, .15);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
}

.sidebar-logo img,
.sidebar .logo img,
.sidebar > img {
  max-width: 160px;
  height: auto;
  display: block;
  margin: 0 auto 6px;
  filter: brightness(0) invert(1);
}

.sidebar a {
  position: relative;
  display: flex !important;
  align-items: center;
  gap: 0;
  width: 100%;
  margin: 0 !important;
  padding: 7px 12px !important;
  border-left: 3px solid transparent;
  border-radius: 0 !important;
  color: var(--sidebar-text) !important;
  font-size: 12px !important;
  font-weight: 400;
  line-height: 1.25;
  text-decoration: none;
  transition: all .2s cubic-bezier(.4, 0, .2, 1);
}

.sidebar a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--adl-accent);
  transform: scaleY(0);
  transition: transform .2s ease;
}

.sidebar a i {
  width: 18px;
  margin-right: 10px;
  font-size: 12px;
  text-align: center;
  opacity: .9;
  transition: all .2s ease;
}

.sidebar a:hover,
.sidebar a:focus {
  background: var(--sidebar-hover-bg) !important;
  color: var(--adl-white) !important;
  padding-left: 16px !important;
  font-weight: 500;
}

.sidebar a:hover::before,
.sidebar a:focus::before {
  transform: scaleY(1);
}

.sidebar a:hover i,
.sidebar a:focus i {
  opacity: 1;
  transform: scale(1.08);
}

.sidebar .collapse a,
.sidebar .collapsing a {
  padding-left: 38px !important;
  background: rgba(0, 0, 0, .1) !important;
  font-size: 11px !important;
}

.sidebar .collapse a:hover,
.sidebar .collapsing a:hover {
  padding-left: 42px !important;
  background: rgba(149, 225, 191, .12) !important;
}

.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width) !important;
  right: 0;
  height: 52px !important;
  background: var(--adl-white) !important;
  border-bottom: 1px solid #d8dee9 !important;
  box-shadow: 0 1px 5px rgba(15, 23, 42, .06) !important;
  z-index: 1040;
  display: flex;
  align-items: center;
  padding: 0 18px !important;
}

.topbar.full {
  left: 0 !important;
}

.app-title {
  color: var(--adl-primary) !important;
  font-size: 13px;
  font-weight: 800;
}

.content {
  margin-left: var(--sidebar-width) !important;
  margin-top: 52px !important;
  padding: 18px !important;
  background: #F8F9FA;
}

.content.full {
  margin-left: 0 !important;
}

.page-title,
.content > h1,
.content > h2,
.content > h3,
.content > h4,
.content > .h4 {
  color: var(--adl-primary) !important;
  font-weight: 800;
  margin-bottom: 12px;
}

.card,
.ap-card,
.chartbox,
.table-container,
.kpi-card,
.card-mini {
  border: 1px solid #e6eef8 !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow-sm) !important;
}

.card-header,
.ap-card__header,
.ap-card-header {
  background: #f6f9ff !important;
  border-bottom: 1px solid #e6eef8 !important;
  color: var(--adl-primary) !important;
  font-weight: 800 !important;
}

.card-body {
  padding: 12px;
}

.table,
.ap-table {
  margin-bottom: 0;
  font-size: 12px;
  vertical-align: middle;
}

.table > :not(caption) > * > * {
  padding: .42rem .55rem;
}

.table thead th,
.table-light th,
.table-dark th {
  background: #f6f9ff !important;
  border-color: #dce6f3 !important;
  color: #0b2e6b !important;
  font-weight: 800;
  white-space: nowrap;
}

.table-hover tbody tr:hover > * {
  --bs-table-accent-bg: #f4f8ff;
}

.btn {
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.btn-primary {
  background: var(--adl-primary);
  border-color: var(--adl-primary);
}

.btn-primary:hover {
  background: var(--adl-aux-blue);
  border-color: var(--adl-aux-blue);
}

.btn-success {
  background: #198754;
  border-color: #198754;
}

.badge {
  border-radius: 999px;
  font-weight: 800;
}

.form-control,
.form-select {
  border-color: #d8dee9;
  border-radius: 6px;
  font-size: 12px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--adl-primary);
  box-shadow: 0 0 0 .16rem rgba(0, 15, 159, .14);
}

.kpi-card,
.card-mini {
  min-height: 92px;
  padding: 12px;
  color: #fff;
}

.kpi-title,
.card-mini span {
  font-size: 11px;
  font-weight: 800;
  opacity: .95;
}

.kpi-value,
.card-mini h2 {
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  line-height: 1.1;
  font-weight: 900;
  margin: 0;
}

.metric-clientes,
.kpi-card.bg-clients {
  background: var(--adl-primary) !important;
}

.metric-instancias,
.kpi-card.bg-instances {
  background: #0F5AAD !important;
}

.metric-usuarios,
.metric-licencias,
.kpi-card.bg-users {
  background: #198754 !important;
}

.metric-mrr,
.kpi-card.bg-mrr {
  background: #00A3E0 !important;
}

.metric-arr,
.kpi-card.bg-arr {
  background: #3639A4 !important;
}

.chartbox {
  padding: 12px;
  min-height: 0;
  max-height: 250px;
  overflow: hidden;
}

.chartbox h5 {
  color: var(--adl-primary);
  font-size: 13px;
  font-weight: 800;
}

.chart-box,
.chartbox {
  height: 250px;
  max-height: 250px;
}

.chart-box canvas,
.chartbox canvas,
canvas[id*="Chart"],
canvas[id^="chart"] {
  height: 250px !important;
  max-height: 250px !important;
}

@media (max-width: 991.98px) {
  .sidebar {
    left: 0 !important;
    transform: translateX(-100%);
  }

  .sidebar.active,
  .sidebar.collapsed {
    transform: translateX(0);
  }

  .topbar {
    left: 0 !important;
  }

  .content {
    margin-left: 0 !important;
    padding: 14px !important;
  }
}
