/* =====================================================
   VisBiz Partner — Design System
   ===================================================== */

:root {
  --primary: #2f5fe0;
  --primary-dark: #2348b8;
  --primary-light: #e9f0ff;

  --green: #16a34a;
  --green-bg: #dcfce7;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --purple: #7c3aed;
  --purple-bg: #f3e8ff;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --blue-bg: #dbeafe;

  --bg: #f5f6fb;
  --card: #ffffff;
  --border: #e7e9f1;
  --text: #14172b;
  --text-soft: #6b7280;
  --text-faint: #9aa0ae;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 23, 43, 0.04), 0 1px 8px rgba(20, 23, 43, 0.04);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
img { max-width: 100%; display: block; }

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

.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform .25s ease;
}
.sidebar-logo {
  padding: 22px 22px 16px;
  font-size: 21px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}
.sidebar-logo span {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 1.5px;
  margin-top: -2px;
}
.sidebar-nav { flex: 1; padding: 6px 14px; overflow-y: auto; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: #44485a;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 3px;
}
.sidebar-nav a:hover { background: #f2f4fa; }
.sidebar-nav a.active { background: var(--primary); color: #fff; }
.sidebar-nav a svg { width: 19px; height: 19px; flex-shrink: 0; }

.sidebar-help {
  margin: 14px;
  padding: 16px;
  background: var(--primary-light);
  border-radius: var(--radius);
  text-align: center;
}
.sidebar-help-icon {
  width: 42px; height: 42px; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px; color: var(--primary);
}
.sidebar-help p { margin: 0 0 2px; font-size: 13px; font-weight: 700; }
.sidebar-help span { font-size: 12px; color: var(--text-soft); }
.btn-wa {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 10px; width: 100%; padding: 9px; border: none;
  background: var(--primary); color: #fff; border-radius: 9px;
  font-size: 13px; font-weight: 700;
}

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.hamburger { display: none; background: none; border: none; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.bell { position: relative; color: #5b5f72; }
.bell .dot {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.profile { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-weight: 700; font-size: 13.5px; line-height: 1.2; }
.profile-id { font-size: 12px; color: var(--text-soft); }

.content { padding: 24px 28px 60px; max-width: 1320px; width: 100%; }

.page-title { font-size: 25px; font-weight: 800; margin: 0 0 4px; }
.breadcrumb { font-size: 13px; color: var(--text-soft); margin-bottom: 18px; }
.breadcrumb a { color: var(--text-soft); }
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; font-weight: 700; font-size: 13.5px;
  border: 1px solid transparent;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: #f7f8fc; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Cards & stat grid ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { display: flex; flex-direction: column; gap: 12px; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-label { font-size: 13px; color: var(--text-soft); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 800; }
.stat-sub { font-size: 12px; font-weight: 700; }
.sub-green { color: var(--green); }
.sub-amber { color: var(--amber); }
.sub-blue  { color: var(--primary); }
.sub-faint { color: var(--text-faint); font-weight: 600; }

.grid-2col { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 800; margin: 0; }
.link-all { font-size: 13px; font-weight: 700; color: var(--primary); }

/* ---------- Lists ---------- */
.activity-row, .client-mini-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.activity-row:last-child, .client-mini-row:last-child { border-bottom: none; }
.row-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 700; font-size: 13.5px; }
.row-sub { font-size: 12.5px; color: var(--text-soft); }
.row-end { text-align: right; }
.row-rank {
  width: 26px; height: 26px; border-radius: 50%; background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12.5px; flex-shrink: 0;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue  { background: var(--blue-bg); color: var(--primary); }
.badge-red   { background: var(--red-bg); color: var(--red); }
.badge-gray  { background: #eef0f4; color: var(--text-soft); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-size: 12px; color: var(--text-soft); font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
table.tbl td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
.tbl-name { font-weight: 700; }
.tbl-sub { font-size: 12px; color: var(--text-soft); }
.cell-thumb {
  width: 34px; height: 34px; border-radius: 9px; background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; flex-shrink: 0;
}
.tbl-flex { display: flex; align-items: center; gap: 10px; }

/* ---------- Filters / toolbar ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 220px; position: relative; }
.toolbar .search input {
  width: 100%; padding: 10px 14px 10px 38px; border-radius: 10px; border: 1px solid var(--border);
  font-size: 13.5px; background: #fff;
}
.toolbar .search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); width: 17px; height: 17px; }
select.input, input.input, textarea.input {
  padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); font-size: 13.5px; background: #fff; font-family: inherit;
}

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a {
  padding: 11px 16px; font-weight: 700; font-size: 13.5px; color: var(--text-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a.active { color: var(--primary); border-color: var(--primary); }

.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; flex-wrap: wrap; gap: 10px; }
.pagination .info { font-size: 13px; color: var(--text-soft); }
.pagination .pages { display: flex; gap: 6px; }
.pagination .pages a, .pagination .pages span {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: #fff;
}
.pagination .pages a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.help-text { font-size: 12px; color: var(--text-soft); margin-top: 5px; }

/* ---------- Donut / chart legend ---------- */
.legend-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.legend-label { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; }
.legend-value { font-weight: 700; font-size: 13.5px; }
.donut-center-label { text-align: center; }
.donut-center-label .v { font-size: 19px; font-weight: 800; }
.donut-center-label .l { font-size: 12px; color: var(--text-soft); }

/* ---------- Banner ---------- */
.banner {
  display: flex; align-items: center; gap: 18px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); flex-wrap: wrap;
}
.banner .emoji { font-size: 34px; }
.banner-input {
  display: flex; gap: 8px; align-items: center; background: #f5f6fb; border-radius: 10px; padding: 6px 6px 6px 14px; flex: 1; min-width: 240px;
}
.banner-input input { border: none; background: none; flex: 1; font-size: 13px; color: var(--text-soft); outline: none; }
.icon-btn { background: #fff; border: 1px solid var(--border); border-radius: 8px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-soft); }
.empty-state svg { margin-bottom: 12px; color: var(--text-faint); }

/* ---------- Marketing materi cards ---------- */
.materi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.materi-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.materi-thumb { position: relative; aspect-ratio: 16/9; background: #000; }
.materi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.materi-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.15);
}
.materi-play svg { width: 46px; height: 46px; color: #fff; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.materi-body { padding: 14px 16px; }
.materi-title { font-weight: 700; font-size: 14px; margin: 0 0 4px; }
.materi-desc { font-size: 12.5px; color: var(--text-soft); margin: 0; }

/* ---------- Auth pages (login/register) ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px 32px; border: 1px solid var(--border); }
.auth-logo { text-align: center; font-size: 24px; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.auth-logo span { display: block; font-size: 11px; letter-spacing: 1.5px; color: var(--text-faint); font-weight: 700; }
.auth-title { text-align: center; font-size: 15px; color: var(--text-soft); margin: 8px 0 24px; }
.alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.alert-error { background: var(--red-bg); color: var(--red); }
.alert-success { background: var(--green-bg); color: var(--green); }
.alert-info { background: var(--blue-bg); color: var(--primary-dark); }
.auth-foot { text-align: center; font-size: 13px; color: var(--text-soft); margin-top: 18px; }
.auth-foot a { color: var(--primary); font-weight: 700; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: #14172b; color: #fff;
  padding: 13px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 100; max-width: 320px;
}

.sidebar-overlay { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid-2col { grid-template-columns: 1fr; }
  .materi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 880px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .hamburger { display: flex; align-items: center; }
  .sidebar-overlay.show {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39;
  }
  .content { padding: 18px 16px 50px; }
  .profile-name, .profile-id { display: none; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .materi-grid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .page-title { font-size: 21px; }
}
