:root {
  --ek-primary: #4759e3;
  --ek-primary-dark: #3140b8;
  --ek-sidebar-bg: #1c2143;
  --ek-sidebar-bg2: #262c58;
  --ek-bg: #f4f6fb;
  --ek-radius: 16px;
  --ek-shadow: 0 6px 24px rgba(39, 48, 100, .08);
  --ek-gradient: linear-gradient(135deg, #4759e3 0%, #7b5cff 100%);
}

* { font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif; }

body { background: var(--ek-bg); color: #26304d; }

.min-w-0 { min-width: 0; }

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: 270px;
  flex: 0 0 270px;
  background: linear-gradient(180deg, var(--ek-sidebar-bg) 0%, var(--ek-sidebar-bg2) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1040;
  transition: margin-left .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 10px; background: #fff; padding: 4px; }
.brand-badge {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--ek-gradient); font-size: 1.3rem;
}
.brand-text strong { display: block; font-size: 1.02rem; letter-spacing: .2px; }
.brand-text small { color: rgba(255,255,255,.6); }
.sidebar-close { color: #fff !important; padding: 0 4px; }

.sidebar-user { border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin-bottom: 4px;
  border-radius: 12px; color: rgba(255,255,255,.78);
  text-decoration: none; font-size: .92rem; font-weight: 500;
  transition: all .15s ease;
}
.sidebar-link i { font-size: 1.05rem; width: 22px; text-align: center; }
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-link.active {
  background: var(--ek-gradient); color: #fff; box-shadow: 0 6px 16px rgba(71,89,227,.4);
}
.sidebar-foot { padding: 14px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-backdrop { display: none; }

/* ---------- Topbar ---------- */
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1030;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 26px;
  background: rgba(255,255,255,.86); backdrop-filter: blur(8px);
  border-bottom: 1px solid #edf0f7;
}
.topbar-title { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.btn-icon { padding: 7px 9px; border-radius: 10px; display: grid; place-items: center; }

.page-content { padding: 26px; }

/* ---------- Avatar ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--ek-gradient); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
  overflow: hidden;
}
.avatar-sm { width: 34px; height: 34px; font-size: .78rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 84px; height: 84px; font-size: 1.6rem; border-radius: 20px; }

/* ---------- Cards ---------- */
.card { border: 0; border-radius: var(--ek-radius); box-shadow: var(--ek-shadow); }
.card-header { background: #fff; border-bottom: 1px solid #eef1f8; border-radius: var(--ek-radius) var(--ek-radius) 0 0 !important; font-weight: 600; }

.stat-card { border-radius: var(--ek-radius); overflow: hidden; box-shadow: var(--ek-shadow); border: 0; }
.stat-card .stat-icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.45rem;
}
.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1.1; }
.stat-label { color: #6b7699; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.bg-soft-primary { background: #e9ecff; color: #4759e3; }
.bg-soft-warning { background: #fff3d6; color: #b97c08; }
.bg-soft-success { background: #e2faec; color: #15965a; }
.bg-soft-info    { background: #e1f5ff; color: #0d7eb0; }
.bg-soft-danger  { background: #ffe4e6; color: #d7263d; }
.bg-soft-purple  { background: #f0e6ff; color: #7b3fe4; }
.bg-soft-teal    { background: #d9f5f0; color: #0f8d78; }

/* ---------- Tables ---------- */
.table thead th {
  font-size: .76rem; text-transform: uppercase; letter-spacing: .4px;
  color: #7a86ab; background: #f7f9ff; border-bottom: 0; white-space: nowrap;
}
.table td { vertical-align: middle; font-size: .9rem; }
.table-hover tbody tr:hover { background: #f7f9ff; }

/* ---------- Forms ---------- */
.form-control, .form-select { border-radius: 10px; border-color: #e1e6f2; padding: .55rem .8rem; }
.form-control:focus, .form-select:focus {
  border-color: var(--ek-primary); box-shadow: 0 0 0 .22rem rgba(71,89,227,.13);
}
.form-label { font-weight: 600; font-size: .85rem; color: #3d4768; }

.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: var(--ek-primary); border-color: var(--ek-primary); }
.btn-primary:hover { background: var(--ek-primary-dark); border-color: var(--ek-primary-dark); }
.btn-soft {
  background: #eef1ff; color: var(--ek-primary); border: 0;
}
.btn-soft:hover { background: #e0e5ff; color: var(--ek-primary-dark); }
.btn-outline-primary { --bs-btn-active-bg: var(--ek-primary); }

/* ---------- Aneka ---------- */
.page-header-title { font-weight: 800; }
.progress { height: 8px; border-radius: 20px; }
.fw-semi { font-weight: 600; }

.chart-box { position: relative; height: 300px; }
.chart-box-sm { position: relative; height: 240px; }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(123,92,255,.25), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(71,89,227,.25), transparent 60%),
    var(--ek-sidebar-bg);
  padding: 20px;
}
.login-card { max-width: 430px; width: 100%; border-radius: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.login-brand { display: flex; align-items: center; gap: 12px; }

.text-danger-soft { color: #d7263d; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- Chat konsultasi ---------- */
.chat-box { max-height: 420px; overflow-y: auto; background: #f7f9ff; border: 1px solid #eef1f8; border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { display: flex; justify-content: flex-start; }
.chat-msg-mine { justify-content: flex-end; }
.chat-bubble {
  max-width: 78%; background: #fff; border: 1px solid #e6eaf6; border-radius: 14px;
  padding: 9px 13px; box-shadow: 0 1px 3px rgba(39,48,100,.06);
}
.chat-msg-mine .chat-bubble { background: #eef1ff; border-color: #dce1ff; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; margin-left: -280px; }
  .sidebar.open { margin-left: 0; }
  .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(15,20,40,.5); z-index: 1035; }
  .page-content { padding: 18px; }
  .topbar { padding: 10px 14px; }
}