:root {
  --wg-primary: #0f9d76;
  --wg-primary-600: #0b7a5d;
  --wg-primary-700: #075c46;
  --wg-accent: #25d366;
  --wg-ink: #10211b;
  --wg-muted: #6b7f78;
  --wg-bg: #f3f7f5;
  --wg-surface: #ffffff;
  --wg-border: #e4ebe7;
  --wg-soft: #eaf7f1;
  --wg-danger: #e5484d;
  --wg-warning: #f59f00;
  --wg-radius: 20px;
  --wg-radius-sm: 13px;
  --wg-shadow: 0 14px 34px -22px rgba(7, 48, 36, .45);
  --wg-shadow-lg: 0 24px 60px -28px rgba(7, 48, 36, .55);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 500px at 100% -10%, rgba(37, 211, 102, .10), transparent 60%),
    radial-gradient(900px 480px at -10% 110%, rgba(15, 157, 118, .08), transparent 60%),
    var(--wg-bg);
  color: var(--wg-ink);
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: .95rem;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: var(--wg-primary-600); }
a:hover { color: var(--wg-primary-700); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 2000;
  background: var(--wg-primary-700);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: 0 0 12px 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* ============ Sidebar ============ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 264px;
  z-index: 1045;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--wg-border);
  transition: transform .22s ease;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: 1.1rem 1.1rem .9rem;
}

.brand { display: flex; align-items: center; gap: .7rem; color: var(--wg-ink); }
.brand:hover { color: var(--wg-ink); }

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--wg-accent), var(--wg-primary-600));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 10px 22px -10px rgba(11, 122, 93, .65);
  flex: 0 0 auto;
}
.brand-mark-sm { width: 36px; height: 36px; border-radius: 11px; font-size: 1.05rem; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 1rem; font-weight: 800; letter-spacing: -.01em; }
.brand-text small { color: var(--wg-muted); font-size: .72rem; }

.sidebar-close {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--wg-border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-scroll { flex: 1; overflow-y: auto; padding: .25rem .8rem 1rem; }

.nav-label {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #93a39c;
  padding: .6rem .7rem .35rem;
}

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

.nav-menu .nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .66rem .75rem;
  border-radius: 13px;
  color: #34463f;
  font-size: .89rem;
  font-weight: 600;
  transition: background .16s ease, color .16s ease;
}
.nav-menu .nav-link i { font-size: 1.08rem; color: #7f938b; transition: color .16s ease; }
.nav-menu .nav-link:hover { background: #f1f8f4; color: var(--wg-primary-700); }
.nav-menu .nav-link:hover i { color: var(--wg-primary); }
.nav-menu .nav-link.active {
  background: linear-gradient(90deg, #e3f7ee, #eefaf4);
  color: var(--wg-primary-700);
  box-shadow: inset 0 0 0 1px rgba(15, 157, 118, .10);
}
.nav-menu .nav-link.active i { color: var(--wg-primary); }

/* Balloon jumlah pesan masuk belum dibaca di samping menu */
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1;
}

.sidebar-foot {
  border-top: 1px solid var(--wg-border);
  padding: .9rem 1rem 1.05rem;
  display: grid;
  gap: .7rem;
}

.user-mini { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.user-mini-name { font-weight: 700; font-size: .85rem; }
.user-mini-role { font-size: .72rem; color: var(--wg-muted); }

.bridge-note {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .72rem;
  color: var(--wg-muted);
}
.bridge-note .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--wg-accent);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, .18);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 25, 19, .45);
  backdrop-filter: blur(2px);
  z-index: 1040;
  display: none;
}

/* ============ Main & topbar ============ */
.main {
  margin-left: 264px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1.4rem;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(228, 235, 231, .9);
}

.page-title {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -.01em;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 13px;
  border: 1px solid var(--wg-border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--wg-ink);
  flex: 0 0 auto;
}
.btn-icon:hover { background: var(--wg-soft); border-color: #cfe8dd; color: var(--wg-primary-700); }

.btn-user {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: #fff;
  border: 1px solid var(--wg-border);
  border-radius: 999px;
  padding: .22rem .7rem .22rem .25rem;
  font-size: .84rem;
  font-weight: 600;
  color: var(--wg-ink);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wg-accent), var(--wg-primary-600));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .78rem;
  flex: 0 0 auto;
}
.avatar-sm { width: 26px; height: 26px; font-size: .7rem; }

.content {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.35rem 1.4rem 1.6rem;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .9rem 1.4rem;
  color: var(--wg-muted);
  font-size: .76rem;
  border-top: 1px solid var(--wg-border);
  background: rgba(255, 255, 255, .6);
}

/* ============ Mobile nav ============ */
.mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: end;
  padding: .35rem .35rem calc(.35rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--wg-border);
}

.mnav-item, .mnav-fab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  padding: .4rem .2rem .3rem;
  color: #7d918a;
  border-radius: 12px;
  min-height: 52px;
  justify-content: center;
  position: relative;
}
.mnav-item i { font-size: 1.25rem; }
.mnav-label { font-size: .64rem; font-weight: 700; letter-spacing: .01em; }
.mnav-item.active { color: var(--wg-primary-600); }
.mnav-item.active i { color: var(--wg-primary); }

.mnav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.mnav-fab { position: relative; top: -12px; gap: .1rem; color: var(--wg-primary-700); }
.mnav-fab-btn {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  background: linear-gradient(135deg, var(--wg-accent), var(--wg-primary-600));
  box-shadow: 0 14px 26px -12px rgba(11, 122, 93, .8);
}
.mnav-fab.active .mnav-fab-btn { outline: 3px solid rgba(37, 211, 102, .25); }

/* ============ Cards & stats ============ */
.card {
  border: 1px solid var(--wg-border);
  border-radius: var(--wg-radius);
  background: var(--wg-surface);
  box-shadow: var(--wg-shadow);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--wg-border);
  font-weight: 700;
  font-size: .92rem;
  padding: .95rem 1.15rem;
  border-radius: var(--wg-radius) var(--wg-radius) 0 0 !important;
}
.card-body { padding: 1.1rem 1.15rem; }

.stat-card { padding: 1.1rem 1.15rem; height: 100%; }
.stat-card .label {
  color: var(--wg-muted);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.stat-card .value { font-size: 1.8rem; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex: 0 0 auto;
}

/* ============ Buttons ============ */
.btn { border-radius: 12px; font-weight: 600; }
.btn-sm { border-radius: 10px; }
.btn-success {
  background: linear-gradient(135deg, var(--wg-primary), var(--wg-primary-600));
  border: 0;
  box-shadow: 0 10px 20px -12px rgba(11, 122, 93, .8);
}
.btn-success:hover, .btn-success:focus { background: linear-gradient(135deg, var(--wg-primary-600), var(--wg-primary-700)); }
.btn-outline-success { color: var(--wg-primary-600); border-color: #bfe4d6; }
.btn-outline-success:hover { background: var(--wg-primary); border-color: var(--wg-primary); color: #fff; }
.btn-light { background: #f3f7f5; border-color: var(--wg-border); }
.btn-send {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--wg-accent), var(--wg-primary-600));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

/* ============ Tables ============ */
.table { --bs-table-hover-bg: #f6fbf8; font-size: .86rem; margin: 0; }
.table thead th {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--wg-muted);
  background: #f8fbf9;
  border-bottom: 1px solid var(--wg-border);
  white-space: nowrap;
  padding: .6rem .8rem;
}
.table td { vertical-align: middle; padding: .7rem .8rem; }
.table-responsive { -webkit-overflow-scrolling: touch; }

.msg-cell { max-width: 380px; min-width: 140px; }
.msg-preview {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.msg-preview a { text-decoration: underline; text-underline-offset: 2px; }
.msg-thumb {
  height: 50px;
  width: 50px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #dbe6e1;
  cursor: pointer;
}
.msg-thumb-sticker { object-fit: contain; background: transparent; border: 0; }
.msg-body-text { white-space: pre-wrap; word-break: break-word; }
.msg-body-text a { text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }

.min-w-0 { min-width: 0; }
.badge { font-weight: 600; border-radius: 8px; }

/* ============ Devices, QR, code ============ */
.device-card .device-head { display: flex; align-items: center; gap: .75rem; }
.device-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--wg-soft);
  color: var(--wg-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex: 0 0 auto;
}

.qr-box {
  background: #fff;
  border: 1px dashed #cfe0d8;
  border-radius: 18px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}
.qr-box img { width: 260px; max-width: 100%; height: auto; image-rendering: pixelated; }

.api-block {
  background: #0d211a;
  color: #d6e9e1;
  border-radius: 14px;
  padding: .9rem 1rem;
  font-family: Consolas, "Courier New", monospace;
  font-size: .8rem;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.55;
}
.api-block .k { color: #7ee2b8; }

.code-inline {
  background: #edf5f1;
  color: #1d4f3f;
  border-radius: 7px;
  padding: .1rem .35rem;
  font-family: Consolas, monospace;
  font-size: .84em;
  overflow-wrap: anywhere;
}

/* ============ Forms ============ */
.form-label { font-size: .8rem; font-weight: 700; color: #3b4f47; margin-bottom: .35rem; }
.form-text { font-size: .74rem; color: var(--wg-muted); }
.form-control, .form-select {
  border-radius: 12px;
  border-color: #dde7e2;
  padding: .58rem .8rem;
  font-size: .88rem;
  background-color: #fff;
}
.form-control:focus, .form-select:focus {
  border-color: #9fd8c3;
  box-shadow: 0 0 0 4px rgba(15, 157, 118, .12);
}
.form-control::placeholder { color: #9aaba4; }
.form-check-input:checked { background-color: var(--wg-primary); border-color: var(--wg-primary); }

.empty-state { text-align: center; padding: 2.6rem 1rem; color: var(--wg-muted); }
.empty-state i { font-size: 2.1rem; display: block; margin-bottom: .55rem; color: #b7c9c1; }

/* ============ Emoji picker ============ */
.emoji-wrap { position: relative; display: inline-block; flex: 0 0 auto; }
.emoji-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.emoji-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 1080;
  width: 322px;
  max-width: calc(100vw - 28px);
  max-height: 306px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--wg-border);
  border-radius: 16px;
  box-shadow: var(--wg-shadow-lg);
  padding: .55rem;
  text-align: left;
}
.emoji-group-label {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--wg-muted);
  padding: .35rem .25rem .2rem;
  font-weight: 700;
}
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-btn {
  border: 0;
  background: transparent;
  font-size: 1.15rem;
  line-height: 1;
  padding: .28rem .1rem;
  border-radius: 9px;
  cursor: pointer;
}
.emoji-btn:hover { background: var(--wg-soft); }

/* ============ Notifikasi ============ */
.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--wg-danger);
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 0 0 2px #fff;
}
.notif-menu { width: 350px; max-width: calc(100vw - 24px); border-radius: 16px; box-shadow: var(--wg-shadow-lg); border-color: var(--wg-border); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-empty { text-align: center; color: var(--wg-muted); padding: 2rem 1rem; font-size: .85rem; }
.notif-empty i { display: block; font-size: 1.5rem; margin-bottom: .4rem; }
.notif-item {
  display: flex;
  gap: .6rem;
  padding: .65rem .9rem;
  color: var(--wg-ink);
  border-bottom: 1px solid #f2f6f4;
  align-items: flex-start;
}
.notif-item:hover { background: #f6fbf8; color: var(--wg-ink); }
.notif-item > i { color: var(--wg-primary); font-size: 1rem; margin-top: .15rem; }
.notif-item.unread { background: #edf9f3; }
.notif-item.unread .notif-title { font-weight: 700; }
.notif-text { display: flex; flex-direction: column; min-width: 0; }
.notif-title { font-size: .82rem; }
.notif-body { font-size: .75rem; color: var(--wg-muted); }
.notif-time { font-size: .68rem; color: #9aaba4; margin-top: .1rem; }
.notif-page-icon { color: var(--wg-primary); font-size: 1.2rem; }

/* ============ Toast ============ */
.wg-toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1090;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  width: min(340px, calc(100vw - 24px));
}
.wg-toast {
  display: flex;
  gap: .6rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--wg-border);
  border-left: 4px solid var(--wg-primary);
  border-radius: 14px;
  padding: .65rem .8rem;
  box-shadow: var(--wg-shadow-lg);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
}
.wg-toast.show { opacity: 1; transform: translateY(0); }
.wg-toast > i { color: var(--wg-primary); font-size: 1.1rem; }

/* ============ Grup & chat ============ */
.group-link { color: var(--wg-ink); }
.group-link:hover { color: var(--wg-primary-700); }
.group-open-hint {
  display: none;
  font-size: .7rem;
  font-weight: 700;
  color: var(--wg-primary-600);
  margin-top: .1rem;
}
.group-link:hover .group-open-hint { display: inline-flex; align-items: center; gap: .25rem; }

.group-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--wg-soft);
  color: var(--wg-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex: 0 0 auto;
}
.group-avatar-lg { width: 54px; height: 54px; border-radius: 50%; font-size: 1.4rem; }

/* Info grup: anggota & media */
.member-list { display: flex; flex-direction: column; }
.member-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .65rem 1rem;
  border-bottom: 1px solid #f0f5f2;
}
.member-row:last-child { border-bottom: 0; }
.member-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--wg-soft);
  color: var(--wg-primary-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .82rem;
  flex: 0 0 auto;
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: .5rem;
}
.media-thumb {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: #eef4f1;
  border: 1px solid var(--wg-border);
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .62rem;
}

.chat-card { overflow: hidden; }
.chat-list {
  min-height: 300px;
  max-height: 62vh;
  overflow-y: auto;
  padding: 1.1rem;
  background:
    radial-gradient(circle at 18% 8%, #eaf7f1 0, transparent 42%),
    radial-gradient(circle at 84% 86%, #eef8f3 0, transparent 42%),
    #f6faf8;
}
.chat-row { display: flex; margin-bottom: .5rem; }
.chat-row.out { justify-content: flex-end; }
.chat-row.in { justify-content: flex-start; align-items: flex-start; }
.chat-avatar {
  position: relative;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--wg-soft);
  color: var(--wg-primary-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 800;
  margin-right: .45rem;
  user-select: none;
  box-shadow: 0 0 0 1px rgba(7, 48, 36, .06);
}
.chat-avatar-initial { line-height: 1; }
.chat-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}
.chat-bubble {
  max-width: 78%;
  background: #fff;
  border-radius: 4px 16px 16px 16px;
  padding: .5rem .7rem .32rem;
  box-shadow: 0 2px 10px -6px rgba(7, 48, 36, .35);
  border: 1px solid #e9f0ec;
}
.chat-row.out .chat-bubble {
  background: #ddf8c6;
  border-color: #cdf0b0;
  border-radius: 16px 4px 16px 16px;
}
.chat-sender { font-size: .72rem; font-weight: 700; color: var(--wg-primary-700); margin-bottom: .1rem; }
.chat-text { white-space: pre-wrap; word-break: break-word; font-size: .9rem; line-height: 1.35; }
.chat-text a { text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.chat-media {
  max-width: 240px;
  max-height: 240px;
  border-radius: 10px;
  display: block;
  margin-top: .25rem;
  cursor: pointer;
  border: 1px solid #e2eae6;
}
.chat-file {
  display: flex;
  align-items: center;
  gap: .4rem;
  max-width: 240px;
  width: 100%;
  margin-top: .25rem;
  background: #f5f9f7;
  border: 1px solid #e2eae6;
  border-radius: 10px;
  padding: .45rem .55rem;
  font-size: .82rem;
  text-align: left;
  cursor: pointer;
}
.chat-meta {
  font-size: .65rem;
  color: #7f958c;
  text-align: right;
  margin-top: .15rem;
  display: flex;
  gap: .25rem;
  justify-content: flex-end;
  align-items: center;
}
/* Stiker: tampil tanpa gelembung, seperti WA. */
.chat-row.sticker { margin-bottom: .25rem; }
.chat-bubble.sticker {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
.chat-bubble.sticker .chat-meta {
  color: #6b7f77;
  text-shadow: 0 1px 2px rgba(255, 255, 255, .8);
}
.chat-sticker {
  max-width: 160px;
  max-height: 160px;
  display: block;
  cursor: pointer;
}
.chat-compose { padding: .65rem .8rem .55rem; background: #fff; }
.chat-input-wrap { display: flex; align-items: flex-end; gap: .45rem; }
.chat-input-wrap textarea {
  resize: none;
  max-height: 120px;
  min-height: 42px;
  border-radius: 14px;
  background: #f7faf9;
}
.chat-input-wrap .emoji-panel { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; }
.chat-hint { font-size: .68rem; color: var(--wg-muted); margin-top: .35rem; padding-left: .1rem; }
.composer-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 13px;
  border: 1px solid var(--wg-border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 1.05rem;
}
.composer-btn:hover { background: var(--wg-soft); color: var(--wg-primary-700); }

.attach-chip {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: var(--wg-soft);
  border: 1px solid #d4ece1;
  color: #205845;
  border-radius: 11px;
  padding: .4rem .6rem;
  font-size: .78rem;
  margin-bottom: .5rem;
}
.attach-chip i { color: var(--wg-primary-600); }
.attach-chip .btn-close { font-size: .55rem; }

/* Balasan (quote) */
.reply-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: #eef6f1;
  border-left: 3px solid var(--wg-primary-600);
  border-radius: 8px;
  padding: .4rem .6rem;
  margin-bottom: .5rem;
  font-size: .78rem;
}
.reply-chip > i { color: var(--wg-primary-600); }
.reply-chip-name { font-weight: 700; color: var(--wg-primary-700); font-size: .74rem; }
.reply-chip-text { color: var(--wg-muted); }
.reply-chip .btn-close { font-size: .55rem; }

/* Blok kutipan di dalam bubble */
.chat-quote {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  border-left: 3px solid var(--wg-primary-600);
  background: rgba(7, 48, 36, .05);
  border-radius: 6px;
  padding: .28rem .5rem;
  margin-bottom: .3rem;
  max-width: 100%;
}
.chat-quote-title { font-size: .7rem; font-weight: 800; color: var(--wg-primary-700); }
.chat-quote-text { font-size: .78rem; color: #4a6259; display: block; }
button.chat-quote {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
button.chat-quote:hover { background: rgba(7, 48, 36, .09); border-left-color: var(--wg-primary); }

/* Kutipan yang membalas media (gambar/video/dokumen) */
.chat-quote.has-media {
  flex-direction: row;
  align-items: center;
  gap: .5rem;
}
.chat-quote-body { min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.chat-quote-thumb {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(0,0,0,.06);
}
.chat-quote-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 48, 36, .08);
  color: var(--wg-primary-700);
  font-size: 1.2rem;
}
.chat-row-flash {
  animation: chatRowFlash 1.4s ease;
  border-radius: 14px;
}
@keyframes chatRowFlash {
  0%, 60% { background: rgba(255, 214, 10, .45); box-shadow: 0 0 0 4px rgba(255, 214, 10, .30); }
  100% { background: transparent; box-shadow: none; }
}

/* Reaksi emoji */
.chat-reactions { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; }
.chat-react-chip {
  display: inline-flex;
  align-items: center;
  gap: .15rem;
  background: #fff;
  border: 1px solid #e2eae6;
  border-radius: 12px;
  padding: .05rem .4rem;
  font-size: .78rem;
  line-height: 1.4;
}
.chat-react-chip b { font-size: .66rem; color: #5c736a; font-weight: 700; }
.chat-row.out .chat-react-chip { background: #f2fbe9; }

/* Tombol aksi per bubble (balas / reaksi) */
.chat-actions {
  display: flex;
  gap: .15rem;
  justify-content: flex-end;
  margin-top: .2rem;
  opacity: .55;
  transition: opacity .15s ease;
}
.chat-bubble:hover .chat-actions { opacity: 1; }
.chat-action {
  border: 0;
  background: transparent;
  color: #6b7f77;
  padding: .1rem .25rem;
  border-radius: 6px;
  line-height: 1;
  font-size: .9rem;
  cursor: pointer;
}
.chat-action:hover { background: rgba(7, 48, 36, .08); color: var(--wg-primary-700); }

/* Menu tag @ di komposer */
.chat-input-wrap { position: relative; }
.mention-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--wg-border);
  border-radius: 12px;
  box-shadow: 0 12px 30px -12px rgba(7, 48, 36, .4);
  z-index: 30;
  padding: .25rem;
}
.mention-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: .35rem .5rem;
  border-radius: 8px;
  font-size: .82rem;
  cursor: pointer;
}
.mention-item:hover, .mention-item.active { background: var(--wg-soft); }
.mention-item .mention-name { font-weight: 600; }
.mention-item .mention-phone { color: var(--wg-muted); font-size: .72rem; margin-left: auto; }

/* Popover reaksi */
.react-popover {
  position: fixed;
  z-index: 60;
  display: flex;
  gap: .15rem;
  background: #fff;
  border: 1px solid var(--wg-border);
  border-radius: 999px;
  padding: .3rem .45rem;
  box-shadow: 0 12px 30px -10px rgba(7, 48, 36, .45);
}
.react-popover button {
  border: 0;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: .1rem .15rem;
  border-radius: 50%;
  transition: transform .1s ease;
}
.react-popover button:hover { transform: scale(1.25); }

/* Tautan tag @ di chat grup */
.chat-mention {
  color: var(--wg-primary-700);
  font-weight: 700;
  text-decoration: none;
  background: rgba(7, 48, 36, .07);
  border-radius: 10px;
  padding: 0 .2rem;
}
.chat-mention:hover { text-decoration: underline; }

/* Menu hapus pesan */
.delete-menu {
  position: fixed;
  z-index: 60;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--wg-border);
  border-radius: 12px;
  padding: .25rem;
  box-shadow: 0 12px 30px -10px rgba(7, 48, 36, .45);
}
.delete-menu-item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: .45rem .6rem;
  border-radius: 8px;
  font-size: .84rem;
  cursor: pointer;
}
.delete-menu-item:hover { background: var(--wg-soft); }
.delete-menu-item.danger { color: #b42318; }
.delete-menu-item.danger:hover { background: #fef3f2; }

/* Modal "Teruskan pesan" */
.forward-list { max-height: 55vh; overflow-y: auto; padding: .25rem .4rem .6rem; }
.forward-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: .55rem .6rem;
  border-radius: 10px;
  font-size: .9rem;
  cursor: pointer;
}
.forward-item:hover { background: var(--wg-soft); }
.forward-item-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--wg-soft);
  color: var(--wg-primary-700);
  font-size: 1rem;
}
.forward-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.forward-empty { text-align: center; color: var(--wg-muted); padding: 1.5rem 1rem; font-size: .86rem; }
.forward-empty i { font-size: 1.6rem; display: block; margin-bottom: .4rem; color: #c7d6cf; }

/* Avatar daftar/header: foto profil menutupi fallback di belakangnya */
.member-avatar,
.group-avatar,
.avatar { position: relative; overflow: hidden; }
.member-avatar .chat-avatar-img,
.group-avatar .chat-avatar-img,
.avatar .chat-avatar-img { background: #fff; }

/* ============ Pagination ============ */
.pagination { --bs-pagination-border-radius: 10px; gap: 3px; }
.page-link {
  border: 1px solid var(--wg-border);
  border-radius: 10px !important;
  color: var(--wg-primary-700);
  font-size: .8rem;
  font-weight: 600;
  min-width: 34px;
  text-align: center;
  padding: .35rem .5rem;
}
.page-item.active .page-link { background: var(--wg-primary-600); border-color: var(--wg-primary-600); }
.page-link:hover { background: var(--wg-soft); color: var(--wg-primary-700); }
.page-item.disabled .page-link { color: #b4c3bd; background: #fff; }

/* ============ Modals ============ */
.modal-content { border: 0; border-radius: 20px; box-shadow: var(--wg-shadow-lg); }
.modal-header { border-bottom-color: var(--wg-border); padding: 1rem 1.15rem; }
.modal-body { padding: 1.15rem; }
.modal-footer { border-top-color: var(--wg-border); padding: .8rem 1.15rem; }

/* ============ Responsive ============ */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-105%); width: 290px; box-shadow: var(--wg-shadow-lg); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  body.sidebar-open { overflow: hidden; }
  .main { margin-left: 0; }
  .content { padding: 1rem 1rem calc(86px + env(safe-area-inset-bottom)); }
  .app-footer { display: none; }
  .topbar { padding: .55rem .9rem; gap: .5rem; }
  .page-title { font-size: .98rem; }
  .wg-toast-host { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

@media (max-width: 575.98px) {
  body { font-size: .92rem; }
  .content { padding: .8rem .8rem calc(84px + env(safe-area-inset-bottom)); }
  .card { border-radius: 16px; }
  .card-header { border-radius: 16px 16px 0 0 !important; padding: .85rem .95rem; }
  .card-body { padding: .95rem; }
  .stat-card { padding: .9rem 1rem; }
  .stat-card .value { font-size: 1.5rem; }
  .topbar-brand { display: inline-flex; }
  .btn-user > span.d-none { display: none !important; }
  .notif-menu { width: calc(100vw - 20px); }
  .chat-list { max-height: 58vh; padding: .85rem; }
  .chat-bubble { max-width: 86%; }
  .chat-media { max-width: 200px; max-height: 200px; }
  .chat-compose { padding: .55rem .6rem .5rem; }
  .chat-hint { display: none; }
  .chat-input-wrap { gap: .35rem; }
  .chat-input-wrap .composer-btn, .chat-input-wrap .emoji-toggle { width: 38px; height: 38px; }
  .chat-input-wrap textarea { min-height: 40px; font-size: .92rem; }
  .btn-send { width: 40px; height: 40px; }
  .table { font-size: .82rem; }
  .table thead th, .table td { padding: .55rem .6rem; }
  .msg-cell { max-width: 240px; min-width: 120px; }
  .modal-dialog { margin: .6rem; }
  .modal-content { border-radius: 18px; }
  .emoji-panel { position: fixed; left: 50% !important; right: auto !important; transform: translateX(-50%);
    top: auto !important; bottom: calc(78px + env(safe-area-inset-bottom)) !important;
    width: calc(100vw - 24px); max-width: 380px; max-height: 46vh; }
  .pagination { gap: 2px; }
  .page-link { min-width: 32px; font-size: .76rem; padding: .3rem .45rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ============ Halaman Status (ala WhatsApp) ============ */
.status-row {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .8rem 1rem;
  cursor: pointer;
  transition: background .15s ease;
}
.status-row:hover { background: #f7faf8; }
.status-row + .status-row { border-top: 1px solid #f1f4f2; }
.status-avatar-wrap { position: relative; flex: 0 0 auto; }
.status-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--wg-soft);
  color: var(--wg-primary);
  font-weight: 800;
  font-size: 1.1rem;
  overflow: hidden;
}
.status-avatar .chat-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.status-avatar-wrap.unviewed .status-avatar {
  outline: 3px solid var(--wg-primary-600);
  outline-offset: 2px;
}
.status-add {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  font-size: .8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  cursor: pointer;
}
.status-row-body { min-width: 0; flex: 1 1 auto; }
.status-row-name { font-weight: 700; font-size: .92rem; }
.status-row-meta { font-size: .74rem; color: var(--wg-muted); display: flex; gap: .35rem; align-items: center; }
.status-dot { opacity: .6; }
.status-chevron { color: var(--wg-muted); }
.status-add-alone { flex: 0 0 auto; }
.status-section-title {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--wg-primary-700);
  padding: .7rem 1rem .35rem;
  border-top: 1px solid #f1f4f2;
}
.status-empty { text-align: center; color: var(--wg-muted); padding: 2rem 1rem; font-size: .86rem; }
.status-empty i { font-size: 1.8rem; display: block; margin-bottom: .5rem; color: #c7d6cf; }

/* Komposer */
.status-textarea { resize: none; font-size: 1rem; }
.status-bg-row { display: flex; gap: .5rem; margin: .7rem 0; }
.status-bg {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08); cursor: pointer;
}
.status-bg.sel { outline: 3px solid var(--wg-primary-600); }
.status-text-preview {
  min-height: 90px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 1rem;
  margin-top: .3rem;
}

/* Pemilih musik latar (pencarian online ala WA) */
.music-picker {
  border: 1px solid var(--wg-border);
  border-radius: 12px;
  padding: .6rem;
  background: #fafcfb;
}
.music-results { max-height: 240px; overflow-y: auto; }
.music-hint { padding: .4rem .2rem; }
.music-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .4rem .35rem;
  border-radius: 10px;
}
.music-item:hover { background: var(--wg-soft); }
.music-item-art {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--wg-soft);
  color: var(--wg-primary-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.music-item-meta {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.music-item-title { font-size: .82rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-item-artist { font-size: .72rem; color: var(--wg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-item-meta audio { width: 100%; height: 30px; margin-top: .25rem; }
.music-item-preview { flex: 0 0 auto; color: var(--wg-primary-700); }
.music-item-pick { flex: 0 0 auto; }
.music-selected {
  display: flex;
  align-items: center;
  gap: .6rem;
  border: 1px solid var(--wg-primary-600);
  background: var(--wg-soft);
  border-radius: 12px;
  padding: .5rem .6rem;
}
.music-selected-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--wg-primary-600);
  color: #fff;
  font-size: 1rem;
}
.music-selected-meta { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.music-selected-title { font-size: .84rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-selected-artist { font-size: .72rem; color: var(--wg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Viewer status */
body.sv-open { overflow: hidden; }
.status-viewer {
  position: fixed;
  inset: 0;
  z-index: 1080;
  background: #111;
  color: #fff;
  display: flex;
  flex-direction: column;
}
.sv-top { flex: 0 0 auto; }
.sv-progress { display: flex; gap: 4px; padding: .5rem .5rem .25rem; }
.sv-seg { flex: 1 1 0; height: 3px; background: rgba(255,255,255,.35); border-radius: 2px; overflow: hidden; }
.sv-seg-fill { display: block; height: 100%; width: 0; background: #fff; border-radius: 2px; }
.sv-header { display: flex; align-items: center; gap: .6rem; padding: .4rem .7rem; }
.sv-close { color: #fff; }
.sv-avatar .chat-avatar { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.2); font-weight: 800; }
.sv-avatar .chat-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.sv-meta { display: flex; flex-direction: column; line-height: 1.25; }
.sv-meta strong { font-size: .9rem; }
.sv-meta span { font-size: .7rem; opacity: .8; }
.sv-actions .btn-icon { color: #fff; }
.sv-stage { flex: 1 1 auto; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; }
.sv-media { max-width: 100%; max-height: 100%; object-fit: contain; }
.sv-text {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 2rem; font-size: 1.6rem; font-weight: 800;
}
.sv-audio { display: flex; flex-direction: column; align-items: center; gap: 1rem; width: 90%; max-width: 360px; }
.sv-audio-icon { font-size: 3rem; color: #25d366; }
.sv-audio audio { width: 100%; }
.sv-tap { position: absolute; top: 0; bottom: 0; width: 40%; z-index: 3; cursor: pointer; }
.sv-tap-left { left: 0; }
.sv-tap-right { right: 0; }
.sv-bottom { flex: 0 0 auto; background: linear-gradient(transparent, rgba(0,0,0,.7)); padding: .6rem .7rem calc(.6rem + env(safe-area-inset-bottom)); }
.sv-comments { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .5rem; max-height: 32vh; overflow: auto; }
.sv-comment { background: rgba(255,255,255,.12); border-radius: 12px; padding: .35rem .6rem; font-size: .82rem; }
.sv-reply { display: flex; align-items: center; gap: .5rem; }
.sv-reply-input { flex: 1 1 auto; background: rgba(255,255,255,.16); border: 0; color: #fff; border-radius: 999px; padding: .55rem .9rem; font-size: .9rem; outline: none; }
.sv-reply-input::placeholder { color: rgba(255,255,255,.7); }
.sv-reply-send { color: #25d366; font-size: 1.15rem; }
.sv-quick { display: flex; gap: .35rem; }
.sv-quick button { background: none; border: 0; font-size: 1.15rem; cursor: pointer; }
@media (max-width: 575.98px) {
  .status-avatar { width: 46px; height: 46px; }
  .sv-text { font-size: 1.3rem; }
  .sv-quick { display: none; }
}
