:root {
  --ap-primary: #0b3b6f;
  --ap-primary-2: #092f59;
  --ap-primary-3: #154a87;
  --ap-accent: #1f8f5f;
  --ap-bg: #eef2f6;
  --ap-surface: #ffffff;
  --ap-border: #d8e1ea;
  --ap-text: #1d2733;
  --ap-muted: #6c7a89;
  --ap-radius: 8px;
  --ap-shadow: 0 8px 20px rgba(18, 38, 63, .08);
}

body {
  background: var(--ap-bg);
  color: var(--ap-text);
  font-size: 14px;
}

.sidebar {
  background: linear-gradient(180deg, var(--ap-primary) 0%, var(--ap-primary-2) 100%);
  box-shadow: 4px 0 18px rgba(0, 0, 0, .12);
  overflow-y: auto;
  z-index: 1100;
}

.sidebar-logo {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo img {
  max-width: 156px;
  height: auto;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 10px;
  border-radius: 6px;
  font-weight: 500;
}

.sidebar a i {
  width: 18px;
  text-align: center;
}

.sidebar a:hover,
.sidebar a:focus {
  background: rgba(255, 255, 255, .12);
}

.topbar {
  height: 58px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--ap-border);
  box-shadow: 0 4px 14px rgba(18, 38, 63, .04);
}

.app-title {
  color: var(--ap-primary);
  font-size: 15px;
}

.content {
  padding: 22px;
}

.page-title,
.content > h2,
.content > h3,
.content > h4 {
  color: var(--ap-primary);
  font-weight: 700;
  margin-bottom: 18px;
}

.content .text-muted {
  color: var(--ap-muted) !important;
}

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

.card,
.chartbox,
.table-container {
  background: var(--ap-surface);
}

.card-header {
  background: #fff !important;
  border-bottom: 1px solid var(--ap-border);
  color: var(--ap-primary);
  font-weight: 700;
}

.table-container {
  padding: 14px;
  overflow: auto;
}

.table {
  margin-bottom: 0;
  vertical-align: middle;
}

.table > :not(caption) > * > * {
  padding: .62rem .72rem;
}

.table thead th,
.table-dark th {
  background: var(--ap-primary) !important;
  border-color: var(--ap-primary-3) !important;
  color: #fff !important;
  font-weight: 600;
  white-space: nowrap;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: #f7fafc;
}

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

.btn {
  border-radius: 6px;
  font-weight: 600;
}

.btn-success {
  background: var(--ap-accent);
  border-color: var(--ap-accent);
}

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

.badge {
  border-radius: 6px;
  font-weight: 600;
}

.card-mini,
.kpi-card {
  min-height: 104px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.card-mini h2,
.kpi-value {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  line-height: 1.05;
  font-weight: 800;
  margin: 0;
}

.card-mini span,
.kpi-title {
  font-size: .84rem;
  font-weight: 700;
  opacity: .95;
}

.kpi-card.bg-clients,
.metric-clientes {
  background: #0d6efd;
  color: #fff;
}

.kpi-card.bg-instances,
.metric-instancias {
  background: #1f2933;
  color: #fff;
}

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

.kpi-card.bg-mrr,
.metric-mrr {
  background: #0f766e;
  color: #fff;
}

.kpi-card.bg-arr,
.metric-arr {
  background: #5942a9;
  color: #fff;
}

.chartbox {
  padding: 16px;
  min-height: 330px;
}

.chartbox h5 {
  color: var(--ap-primary);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.chartbox canvas,
.chart-box canvas {
  width: 100% !important;
  min-height: 250px;
}

.dataTables_wrapper .dt-buttons .btn,
.dataTables_wrapper .dt-button {
  border: 1px solid var(--ap-border) !important;
  border-radius: 6px !important;
  background: #fff !important;
  color: var(--ap-primary) !important;
  padding: .35rem .7rem !important;
}

.dataTables_filter input,
.dataTables_length select,
.form-control,
.form-select {
  border-color: var(--ap-border);
  border-radius: 6px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ap-primary-3);
  box-shadow: 0 0 0 .18rem rgba(21, 74, 135, .16);
}

@media (max-width: 900px) {
  .content {
    padding: 16px;
  }

  .sidebar a {
    margin-right: 8px;
  }
}
