:root {
  --bg: #eef4f8;
  --panel: #ffffff;
  --sidebar: #101928;
  --sidebar-soft: #1d2939;
  --text: #101828;
  --muted: #667085;
  --border: #e4e7ec;
  --green: #16c79a;
  --green-dark: #0f9f7b;
  --blue: #2563eb;
  --orange: #f59e0b;
  --red: #ef4444;
  --shadow: 0 20px 45px rgba(16, 24, 40, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Inter, Arial, sans-serif;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at top left, #e0f7ef, transparent 34%),
              linear-gradient(135deg, #f6fbff, var(--bg));
  color: var(--text);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 290px;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: linear-gradient(180deg, #101928, #07111f);
  color: white;
  padding: 24px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--green), #7dd3fc);
  display: grid;
  place-items: center;
  font-size: 31px;
  font-weight: 900;
  box-shadow: 0 12px 25px rgba(22, 199, 154, 0.35);
}

.brand h2 {
  font-size: 24px;
  line-height: 1;
}

.brand p {
  color: #98a2b3;
  font-size: 13px;
  margin-top: 5px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link {
  color: #cbd5e1;
  text-decoration: none;
  padding: 13px 15px;
  border-radius: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-weight: 650;
  transition: 0.2s ease;
}

.nav-link span {
  width: 24px;
  text-align: center;
}

.nav-link:hover,
.nav-link.active {
  color: white;
  background: rgba(255,255,255,0.09);
  transform: translateX(4px);
}

.sidebar-card {
  margin-top: auto;
  background: linear-gradient(135deg, rgba(22,199,154,0.22), rgba(37,99,235,0.18));
  border: 1px solid rgba(255,255,255,0.12);
  padding: 18px;
  border-radius: 22px;
}

.sidebar-card p {
  color: #cbd5e1;
  font-size: 13px;
}

.sidebar-card h3 {
  margin: 8px 0;
  font-size: 18px;
}

.sidebar-card span {
  color: #86efac;
  font-size: 13px;
}

/* Main */
.main-content {
  margin-left: 290px;
  width: calc(100% - 290px);
  padding: 30px;
}

.topbar {
  background: rgba(255,255,255,0.68);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 28px;
  padding: 26px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}

.eyebrow {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.topbar h1 {
  font-size: 34px;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  width: 330px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0 14px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 14px;
}

.primary-btn,
.ghost-btn,
.small-btn {
  border: none;
  cursor: pointer;
  font-weight: 850;
  border-radius: 16px;
  transition: 0.2s ease;
}

.primary-btn {
  height: 48px;
  padding: 0 20px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
  box-shadow: 0 14px 26px rgba(22, 199, 154, 0.25);
}

.ghost-btn {
  height: 48px;
  padding: 0 18px;
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}

.small-btn {
  padding: 10px 14px;
  background: #ecfdf3;
  color: #067647;
}

.primary-btn:hover,
.ghost-btn:hover,
.small-btn:hover {
  transform: translateY(-2px);
}

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--panel);
  padding: 24px;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: "";
  position: absolute;
  width: 95px;
  height: 95px;
  border-radius: 50%;
  right: -35px;
  top: -35px;
  background: rgba(22,199,154,0.12);
}

.kpi-card.warning::after {
  background: rgba(245,158,11,0.16);
}

.kpi-card.danger::after {
  background: rgba(239,68,68,0.14);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.kpi-top p {
  color: var(--muted);
  font-weight: 750;
}

.kpi-card h2 {
  font-size: 34px;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.pill.green {
  background: #dcfce7;
  color: #15803d;
}

.pill.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.pill.orange {
  background: #fef3c7;
  color: #b45309;
}

.pill.red {
  background: #fee2e2;
  color: #b91c1c;
}

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 22px;
}

.panel {
  background: rgba(255,255,255,0.9);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.85);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  gap: 14px;
}

.panel-header h3 {
  font-size: 22px;
  letter-spacing: -0.03em;
  margin-bottom: 5px;
}

.panel-header select {
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 0 12px;
  background: white;
  outline: none;
  font-weight: 700;
}

.chart-panel canvas {
  width: 100% !important;
  height: 290px !important;
}

/* Health */
.health-score {
  display: flex;
  align-items: center;
  gap: 18px;
  background: #f8fafc;
  padding: 18px;
  border-radius: 22px;
  margin-bottom: 20px;
}

.circle-score {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: conic-gradient(var(--green) 86%, #e5e7eb 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.circle-score span {
  width: 72px;
  height: 72px;
  background: white;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 950;
  font-size: 20px;
}

.health-score p {
  color: var(--muted);
  line-height: 1.5;
}

.progress-item {
  margin-bottom: 16px;
}

.progress-item > div:first-child {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 8px;
}

.progress-item span {
  color: var(--muted);
}

.progress-bar {
  height: 10px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), #60a5fa);
  border-radius: 999px;
}

/* Table */
.table-panel {
  min-height: 330px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  color: var(--muted);
  font-size: 13px;
  padding-bottom: 14px;
}

td {
  padding: 16px 0;
  border-top: 1px solid #eef2f6;
  font-weight: 650;
  font-size: 14px;
}

.status {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status.paid {
  background: #dcfce7;
  color: #15803d;
}

.status.pending {
  background: #fef3c7;
  color: #92400e;
}

/* Alerts */
.alert-card {
  padding: 16px;
  border-radius: 20px;
  margin-bottom: 14px;
  background: #f8fafc;
  border: 1px solid #eef2f6;
}

.alert-card strong {
  display: block;
  margin-bottom: 6px;
}

.alert-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.red-alert {
  border-left: 5px solid var(--red);
}

.orange-alert {
  border-left: 5px solid var(--orange);
}

.blue-alert {
  border-left: 5px solid var(--blue);
}

.green-alert {
  border-left: 5px solid var(--green);
}

/* Responsive */
@media (max-width: 1250px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-box {
    width: 100%;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 850px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
  }

  .app-shell {
    flex-direction: column;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 18px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .top-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-btn,
  .ghost-btn {
    width: 100%;
  }
}