* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f5f7;
  color: #1a1a1a;
}

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: 230px;
  flex-shrink: 0;
  background: #14161a;
  color: #d7d9de;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  padding: 6px 10px 20px;
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #25d366;
  display: inline-block;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b6f78;
  padding: 14px 10px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: #c7c9d1;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.nav-item:hover { background: #1f2229; color: #fff; }
.nav-item.active { background: #25d366; color: #0a2b17; font-weight: 600; }
.nav-ic { width: 16px; display: inline-block; text-align: center; font-size: 12px; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  padding: 14px 22px;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 { font-size: 17px; margin: 0; flex: 1; }
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}
.content { padding: 20px 22px 60px; max-width: 1000px; }

/* ---------- Cards / stats ---------- */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card h2 { font-size: 15px; margin: 0 0 14px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stat-label { font-size: 12px; color: #888; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; }

.status-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.open { background: #d7f7e3; color: #0a7a3f; }
.badge.close { background: #fde2e1; color: #b3261e; }
.badge.connecting { background: #fff4d6; color: #8a6100; }
.badge.yes { background: #d7f7e3; color: #0a7a3f; }
.badge.no { background: #fde2e1; color: #b3261e; }
.hint { font-size: 12px; color: #888; margin-top: 6px; }
#qrBox { text-align: center; margin-top: 12px; }
#qrBox img { width: 220px; height: 220px; border: 1px solid #eee; border-radius: 8px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; margin: 10px 0 4px; color: #444; }
input, textarea, select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
button {
  margin-top: 14px;
  padding: 10px 18px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
#sendResult { margin-top: 10px; font-size: 13px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #333; }
.checkbox-row input { width: auto; }
.schedule-fields { border-left: 3px solid #eee; padding-left: 12px; margin-top: 8px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) { .form-row-3 { grid-template-columns: 1fr; } }

/* ---------- Tabs / target picker ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.tab-btn {
  margin-top: 0;
  padding: 7px 14px;
  background: #f0f1f3;
  color: #444;
  border-radius: 999px;
  font-size: 13px;
}
.tab-btn.active { background: #1a1a1a; color: #fff; }
.picker-toolbar { display: flex; gap: 10px; margin-bottom: 10px; }
.picker-toolbar select { width: 200px; flex-shrink: 0; }
.contact-picker { max-height: 260px; overflow-y: auto; border: 1px solid #eee; border-radius: 8px; padding: 6px; }
.picker-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; font-size: 13px; margin: 0; }
.picker-row input { width: auto; }
.picker-row:hover { background: #f7f7f8; border-radius: 6px; }
.target-preview { margin-top: 14px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { background: #eef2ff; color: #2b3b8f; border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.empty-hint { color: #999; font-size: 13px; }

/* ---------- List cards (template) ---------- */
.list-cards { display: flex; flex-direction: column; gap: 10px; }
.list-card { border: 1px solid #eee; border-radius: 10px; padding: 12px 14px; }
.list-card-head { display: flex; justify-content: space-between; align-items: center; }
.list-card-body { font-size: 13px; color: #444; margin-top: 6px; white-space: pre-wrap; }
.link-btn {
  background: none;
  color: #2b3b8f;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}
.link-btn.danger { color: #b3261e; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #eee; }
th { color: #888; font-weight: 600; font-size: 12px; text-transform: uppercase; }
.status-terkirim { color: #0a7a3f; }
.status-gagal { color: #b3261e; }
.status-ditolak { color: #8a6100; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 50;
  pointer-events: none;
}
.toast-error { background: #b3261e; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hamburger { display: block; }
  .sidebar {
    position: fixed;
    left: -240px;
    z-index: 20;
    transition: left 0.2s;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
  }
  .sidebar.open { left: 0; }
  .content { padding: 16px; }
}
