/* ======= RESET & BASE ======= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg-primary: #0d1418;
  --bg-secondary: #17232a;
  --bg-tertiary: #1f2e35;
  --bg-hover: #243640;
  --bg-active: #00a884;
  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #667781;
  --accent: #00a884;
  --accent-dark: #008f72;
  --accent-light: #00c49a;
  --accent-soft: rgba(0, 168, 132, .1);
  --msg-out: #005c4b;
  --msg-in: #17232a;
  --border: #233038;
  --border-soft: #1b2830;
  --danger: #f15c6d;
  --warning: #f0a500;
  --online: #00a884;
  --shadow: 0 8px 32px rgba(0,0,0,.4);
  --shadow-glow: 0 8px 32px rgba(0,168,132,.15);
  --radius: 14px;
  --radius-sm: 8px;

  /* Gradient palette */
  --grad-primary: linear-gradient(135deg, #00a884, #00c49a);
  --grad-primary-hover: linear-gradient(135deg, #00b893, #00d4aa);
  --grad-accent: linear-gradient(135deg, #00c49a 0%, #00a884 50%, #059669 100%);
  --grad-subtle: linear-gradient(180deg, rgba(0,168,132,.03) 0%, transparent 100%);
  --grad-mesh:
    radial-gradient(60% 50% at 20% 0%, rgba(0,168,132,.08), transparent 70%),
    radial-gradient(50% 50% at 80% 10%, rgba(37,211,102,.06), transparent 70%),
    radial-gradient(40% 40% at 50% 100%, rgba(168,85,247,.04), transparent 70%);

  font-size: 15px;
}
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  position: relative;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background: var(--grad-mesh);
}
body > * { position: relative; z-index: 1; }
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; border: none; background: transparent; font-family: inherit; }
input, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
  transition: background .2s;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ======= LAYOUT ======= */
#app { display: flex; height: 100vh; }
.main-panel { display: flex; flex: 1; overflow: hidden; }

/* ======= SIDEBAR AKUN (kiri jauh) ======= */
.sidebar-accounts {
  width: 68px;
  background: var(--bg-secondary);
  display: flex; flex-direction: column; align-items: center;
  border-right: 1px solid var(--border);
  padding: 8px 0;
  gap: 4px;
  z-index: 10;
  flex-shrink: 0;
}
.sa-header { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 12px; border-bottom: 1px solid var(--border); width: 100%; }
.sa-title { font-size: 9px; font-weight: 600; color: var(--accent); letter-spacing: .5px; text-transform: uppercase; }
.sa-list { flex: 1; overflow-y: auto; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; }
.sa-empty { font-size: 9px; color: var(--text-muted); text-align: center; padding: 8px 4px; }
.sa-footer { padding: 6px 2px 4px; border-top: 1px solid var(--border); width: 100%; text-align: center; }
#sa-count { font-size: 9px; color: var(--text-muted); }

/* Item akun di sidebar */
.account-item {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform .15s;
  border: 2px solid transparent;
  overflow: visible;
}
.account-item:hover { transform: scale(1.05); border-color: var(--text-muted); }
.account-item.active { border-color: var(--accent); }
.account-item img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.account-item .ai-fallback { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.account-item .ai-label { font-size: 8px; color: var(--text-secondary); position: absolute; bottom: -14px; white-space: nowrap; overflow: hidden; max-width: 60px; text-overflow: ellipsis; text-align: center; }
.account-item .status-dot {
  position: absolute; bottom: 2px; right: 2px;
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}
.status-dot.connected { background: var(--online); }
.status-dot.connecting { background: var(--warning); }
.status-dot.qr { background: #7c89ff; }
.status-dot.pairing { background: #c084fc; }
.status-dot.disconnected { background: var(--text-muted); }

/* ======= SIDEBAR CHAT ======= */
.sidebar-chat {
  width: 360px; flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}
.sc-account-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sc-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.sc-avatar svg { width: 24px; height: 24px; color: var(--text-muted); }
.sc-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.sc-account-meta { min-width: 0; }
.sc-name { font-size: 15px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-phone { font-size: 12px; color: var(--text-secondary); }
.sc-actions { display: flex; gap: 4px; }
.sc-search { padding: 8px 10px; background: var(--bg-secondary); flex-shrink: 0; }
.sc-search input {
  width: 100%; padding: 8px 14px;
  background: var(--bg-tertiary); border: none; border-radius: 8px;
  color: var(--text-primary); font-size: 14px;
  outline: none;
}
.sc-search input::placeholder { color: var(--text-muted); }
.sc-tabs { display: flex; padding: 0 10px; gap: 4px; background: var(--bg-secondary); flex-shrink: 0; }
.sc-tab {
  flex: 1; padding: 8px; border-radius: 8px 8px 0 0;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  transition: all .2s;
}
.sc-tab.active { color: var(--accent); border-bottom: 2px solid var(--accent); }
.sc-tab:hover:not(.active) { color: var(--text-primary); background: var(--bg-hover); }
.sc-list { flex: 1; overflow-y: auto; }
.sc-empty { color: var(--text-muted); text-align: center; padding: 32px 16px; font-size: 14px; }

/* Item chat/kontak */
.chat-item, .contact-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
  position: relative;
}
.chat-item:hover, .contact-item:hover { background: var(--bg-hover); }
.chat-item.active { background: var(--bg-tertiary); }
.ci-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.ci-avatar svg { width: 26px; height: 26px; color: var(--text-muted); }
.ci-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.ci-meta { flex: 1; min-width: 0; }
.ci-top { display: flex; justify-content: space-between; align-items: baseline; }
.ci-name { font-size: 15px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.ci-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.ci-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
.ci-last-msg { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.ci-badge {
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 600;
  border-radius: 50%; min-width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  flex-shrink: 0;
}

/* ======= AREA CHAT ======= */
.chat-area {
  flex: 1; display: flex; flex-direction: column;
  background: var(--bg-primary); position: relative; overflow: hidden;
}
.chat-welcome {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-secondary); gap: 16px;
}
.cw-icon { opacity: .6; }
.chat-welcome h2 { font-size: 28px; font-weight: 300; color: var(--text-primary); }
.chat-welcome p { font-size: 14px; }

/* Header chat aktif */
.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-contact-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.chat-contact-avatar svg { width: 22px; height: 22px; color: var(--text-muted); }
.chat-contact-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.chat-contact-info { flex: 1; min-width: 0; }
.chat-contact-name { font-size: 16px; font-weight: 600; }
.chat-contact-status { font-size: 12px; color: var(--text-muted); }
.chat-header-actions { display: flex; gap: 4px; }
.back-btn { display: none; }

/* Pesan */
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 16px 10%;
  display: flex; flex-direction: column; gap: 2px;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.msg-bubble {
  max-width: 65%; padding: 7px 12px;
  border-radius: 8px; font-size: 14.5px; line-height: 1.5;
  position: relative; word-break: break-word;
  margin-bottom: 1px;
}
.msg-bubble.out { background: var(--msg-out); align-self: flex-end; border-bottom-right-radius: 2px; }
.msg-bubble.in { background: var(--msg-in); align-self: flex-start; border-bottom-left-radius: 2px; }
.msg-bubble.out + .msg-bubble.out { border-top-right-radius: 8px; }
.msg-bubble.in + .msg-bubble.in { border-top-left-radius: 8px; }
.msg-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 3px; }
.msg-time { font-size: 11px; color: var(--text-muted); }
.msg-tick { font-size: 12px; color: var(--text-muted); }
.msg-tick.read { color: #53bdeb; }
.msg-sender-name { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 3px; }
.msg-media { max-width: 100%; border-radius: 6px; margin-bottom: 4px; display: block; }
.msg-media-label { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.msg-media-label svg { width: 16px; height: 16px; }
.date-separator {
  align-self: center; background: var(--bg-tertiary);
  font-size: 12px; color: var(--text-secondary);
  padding: 4px 14px; border-radius: 8px; margin: 10px 0;
}

/* Input pesan */
.chat-input-area {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input-wrap {
  flex: 1; background: var(--bg-tertiary); border-radius: 24px;
  padding: 8px 14px; display: flex; align-items: center;
}
.chat-input-wrap textarea {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: 15px; resize: none;
  max-height: 120px; line-height: 1.5; overflow-y: auto;
}
.chat-input-wrap textarea::placeholder { color: var(--text-muted); }
.attach-btn { color: var(--text-muted); }
.attach-btn:hover { color: var(--text-primary); }
.btn-send {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .2s;
}
.btn-send:hover { background: var(--accent-dark); }
.btn-send svg { width: 22px; height: 22px; }

/* ======= BUTTONS ======= */
.btn-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all .2s;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon svg { width: 20px; height: 20px; }
.btn-primary {
  background: var(--grad-primary); color: #fff;
  padding: 10px 22px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  transition: transform .15s, box-shadow .22s, filter .22s;
  box-shadow:
    0 4px 16px rgba(0,168,132,.25),
    inset 0 1px 0 rgba(255,255,255,.15);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.btn-primary::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--grad-primary-hover);
  opacity: 0;
  transition: opacity .22s;
}
.btn-primary:hover::before { opacity: 1; }
.btn-primary:hover {
  box-shadow:
    0 8px 26px rgba(0,168,132,.4),
    inset 0 1px 0 rgba(255,255,255,.18);
  filter: brightness(1.02);
}
.btn-primary:active { transform: translateY(1px); }
.btn-primary > * { position: relative; z-index: 1; }
.btn-primary.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-secondary {
  background: var(--bg-tertiary); color: var(--text-primary);
  padding: 10px 22px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500;
  transition: background .18s, transform .1s;
  border: 1px solid transparent;
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border); }
.btn-secondary:active { transform: translateY(1px); }
.btn-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: transparent; color: var(--text-muted);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.btn-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger { background: var(--danger); color: #fff; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; }

/* ======= MODALS ======= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65); backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; animation: overlayIn .22s ease;
}
.modal {
  background: var(--bg-secondary);
  border-radius: 16px; box-shadow: var(--shadow);
  width: 420px; max-width: 95vw;
  animation: modalIn .4s cubic-bezier(.2, 1.1, .3, 1);
  max-height: 90vh; overflow-y: auto;
}
@keyframes overlayIn {
  from { opacity: 0; backdrop-filter: blur(0); }
  to   { opacity: 1; backdrop-filter: blur(6px); }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-qr { width: 380px; }
.modal-profile { width: 460px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.modal-body.center { align-items: center; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.form-group input, .form-group textarea {
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--text-primary); font-size: 14px; outline: none;
  transition: border .2s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--accent); }
.radio-group { display: flex; gap: 20px; }
.radio-opt { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.radio-opt input { accent-color: var(--accent); }

/* Method selector (QR / Pairing cards) */
.method-group { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.method-opt { position: relative; cursor: pointer; }
.method-opt input { position: absolute; opacity: 0; pointer-events: none; }
.method-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px;
  padding: 16px 10px;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  transition: all .18s;
}
.method-opt:hover .method-card { border-color: var(--text-muted); }
.method-opt input:checked + .method-card {
  border-color: var(--accent);
  background: rgba(0,168,132,.08);
}
.method-icon {
  width: 28px; height: 28px;
  color: var(--text-secondary);
  transition: color .18s;
}
.method-opt input:checked + .method-card .method-icon { color: var(--accent); }
.method-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.method-desc  { font-size: 11.5px; color: var(--text-muted); text-align: center; }

/* ======= INTERCHAT CONFIG MODAL ======= */
.jeda-inputs {
  display: flex; align-items: center; gap: 10px;
}
.jeda-inputs input[type="number"] {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  text-align: center;
}
.jeda-inputs input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,168,132,.2);
}
.jeda-sep { color: var(--text-muted); font-weight: 600; font-size: 18px; }

.ic-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color .18s, background .18s;
}
.ic-toggle-row:has(input:checked) {
  border-color: rgba(0,168,132,.4);
  background: rgba(0,168,132,.08);
}
.ic-toggle-info { flex: 1; min-width: 0; }
.ic-toggle-title {
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.ic-toggle-desc {
  font-size: 12px; color: var(--text-muted);
  line-height: 1.4;
}

.ic-pairs-preview {
  max-height: 200px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ic-pair-item {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  animation: pairItemIn .3s cubic-bezier(.4, 0, .2, 1) both;
}
.ic-pair-item:nth-child(1) { animation-delay: .02s; }
.ic-pair-item:nth-child(2) { animation-delay: .05s; }
.ic-pair-item:nth-child(3) { animation-delay: .08s; }
.ic-pair-item:nth-child(4) { animation-delay: .11s; }
.ic-pair-item:nth-child(5) { animation-delay: .14s; }
.ic-pair-item:nth-child(n+6) { animation-delay: .17s; }
.ic-pair-name {
  color: var(--text-primary); font-weight: 500;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ic-pair-arrow {
  color: var(--accent);
  font-size: 14px;
}
@keyframes pairItemIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.form-hint {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* ======= LOG CHAT TERMINAL STYLE ======= */
#chatlog-panel {
  background: #080b0e !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.chatlog-toolbar {
  background: #0d1117 !important;
  border-bottom: 1px solid rgba(37,211,102,.15);
}
.chatlog-select {
  background: #080b0e !important;
  border: 1px solid rgba(37,211,102,.2) !important;
  color: #7ee8b0 !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 12.5px !important;
}
.chatlog-clear-btn {
  background: transparent !important;
  border: 1px solid rgba(37,211,102,.25) !important;
  color: #7ee8b0 !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 12px !important;
  text-transform: lowercase;
}
.chatlog-clear-btn:hover {
  background: rgba(248,81,73,.12) !important;
  border-color: rgba(248,81,73,.5) !important;
  color: #ff8b82 !important;
}

#chatlog-entries {
  padding: 12px 14px !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  color: #86d9aa;
}
#chatlog-entries .sc-empty {
  color: #4a8a66 !important;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 12.5px !important;
  text-align: left !important;
  padding: 14px !important;
}
#chatlog-entries .sc-empty::before {
  content: '$ claussbot --status';
  display: block;
  color: #25D366;
  margin-bottom: 8px;
  font-weight: 600;
}
#chatlog-entries .sc-empty::after {
  content: '_';
  display: inline-block;
  color: #25D366;
  animation: cmdBlink 1s steps(1) infinite;
  margin-left: 2px;
}
@keyframes cmdBlink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Log entries — terminal look */
#chatlog-entries .chatlog-entry,
#chatlog-entries .chatlog-start-entry {
  background: transparent !important;
  border: none !important;
  border-bottom: 1px dashed rgba(37,211,102,.1) !important;
  border-radius: 0 !important;
  padding: 8px 0 !important;
  margin: 0 !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
  font-size: 12.5px !important;
  color: #c7e8d6 !important;
  animation: cmdTypeIn .25s ease;
  position: relative;
}
#chatlog-entries .chatlog-entry::before,
#chatlog-entries .chatlog-start-entry::before {
  content: '› ';
  color: #25D366;
  font-weight: 700;
}
#chatlog-entries .chatlog-header {
  display: inline;
  font-size: 12px;
  color: #86d9aa;
}
#chatlog-entries .chatlog-from,
#chatlog-entries .chatlog-to,
#chatlog-entries .chatlog-pair {
  color: #7ee8b0 !important;
  font-weight: 600 !important;
  font-size: 12px !important;
}
#chatlog-entries .chatlog-arrow {
  color: #4a8a66 !important;
  margin: 0 4px !important;
}
#chatlog-entries .chatlog-time {
  color: #4a8a66 !important;
  font-size: 11px !important;
  margin-left: 8px !important;
  float: right;
}
#chatlog-entries .chatlog-exchange {
  background: rgba(37,211,102,.12) !important;
  color: #25D366 !important;
  padding: 1px 6px !important;
  border-radius: 3px !important;
  font-size: 10px !important;
  margin-left: 6px !important;
}
#chatlog-entries .chatlog-incoming {
  color: #7a9e8b !important;
  font-size: 11.5px !important;
  padding-left: 14px !important;
  margin-top: 2px !important;
}
#chatlog-entries .chatlog-reply {
  color: #e6f5ed !important;
  font-size: 12.5px !important;
  padding-left: 14px !important;
  margin-top: 2px !important;
  animation: cmdTypeReveal .4s ease;
}
#chatlog-entries .chatlog-msg {
  color: #e6f5ed !important;
  padding-left: 14px !important;
  font-size: 12.5px !important;
}
#chatlog-entries .chatlog-pause {
  color: #8baa9a !important;
  font-size: 11px !important;
  font-style: italic;
  padding-left: 14px !important;
  margin-top: 4px !important;
  opacity: .7;
}
@keyframes cmdTypeIn {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes cmdTypeReveal {
  from { clip-path: inset(0 100% 0 0); opacity: .5; }
  to   { clip-path: inset(0 0 0 0); opacity: 1; }
}
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }

/* QR */
.qr-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-muted); padding: 40px 0; }
.qr-hint { font-size: 13px; color: var(--text-secondary); text-align: center; }
#qr-container img { border-radius: 10px; background: #fff; padding: 10px; }
.pairing-label { font-size: 14px; color: var(--text-secondary); }
.pairing-code {
  font-size: 34px; font-weight: 700; letter-spacing: 8px;
  color: var(--accent); font-family: monospace;
  padding: 16px 24px; background: var(--bg-tertiary);
  border-radius: var(--radius); margin: 8px 0;
}
.pairing-hint { font-size: 12px; color: var(--text-muted); text-align: center; max-width: 260px; }

/* Profil foto */
.profile-pic-section { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-bottom: 8px; }
.profile-pic-preview {
  width: 100px; height: 100px; border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.profile-pic-preview svg { width: 54px; height: 54px; color: var(--text-muted); }
.profile-pic-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ======= SPINNER ======= */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ======= TOAST ======= */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000;
}
.toast {
  background: var(--bg-tertiary); color: var(--text-primary);
  padding: 12px 18px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size: 14px;
  border-left: 4px solid var(--accent);
  animation: slideUp .2s ease;
  max-width: 340px;
}
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

/* ======= TYPING INDICATOR ======= */
.typing-indicator { align-self: flex-start; display: flex; align-items: center; gap: 4px; padding: 10px 14px; background: var(--msg-in); border-radius: 8px; }
.typing-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); animation: typingBounce 1.2s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }

/* ======= ALL CHAT BAR ======= */
.allchat-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: 8px;
}
.allchat-info { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-secondary); min-width: 0; }
.allchat-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-muted);
}
.allchat-dot.running {
  background: var(--online);
  box-shadow: 0 0 0 3px rgba(0,168,132,.25);
  animation: pulse 1.4s infinite;
}
.allchat-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px; border: none;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  cursor: pointer; font-family: inherit; transition: all .2s;
  flex-shrink: 0;
}
.allchat-btn.start { background: var(--accent); color: #fff; }
.allchat-btn.start:hover { background: var(--accent-dark); }
.allchat-btn.stop { background: #f15c6d; color: #fff; }
.allchat-btn.stop:hover { background: #d94455; }
.allchat-btn.start.loading { opacity: .7; pointer-events: none; }

/* ======= CHAT LOG PANEL ======= */
.chatlog-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chatlog-select {
  flex: 1; background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; color: var(--text-primary);
  font-size: 12px; outline: none;
}
.chatlog-select:focus { border-color: var(--accent); }
.chatlog-clear-btn {
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 10px; color: var(--text-muted); font-size: 12px; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.chatlog-clear-btn:hover { border-color: #f15c6d; color: #f15c6d; }

/* Log entry */
.chatlog-entry {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: 13px;
}
.chatlog-entry:hover { background: var(--bg-hover); }
.chatlog-entry-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 5px; gap: 6px;
}
.chatlog-pair {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
}
.chatlog-pair .from { color: var(--accent); }
.chatlog-pair .arrow { color: var(--text-muted); }
.chatlog-pair .to { color: #7c89ff; }
.chatlog-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.chatlog-incoming {
  font-size: 12px; color: var(--text-muted); margin-bottom: 3px;
  display: flex; align-items: flex-start; gap: 4px;
}
.chatlog-incoming::before { content: '←'; color: var(--text-muted); flex-shrink: 0; }
.chatlog-reply {
  color: var(--text-primary);
  display: flex; align-items: flex-start; gap: 4px;
}
.chatlog-reply::before { content: '→'; color: var(--accent); flex-shrink: 0; }
.chatlog-exchange { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.chatlog-pause {
  font-size: 11px; color: var(--warning); margin-top: 3px;
  display: flex; align-items: center; gap: 4px;
}
.chatlog-start-entry {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
}
.chatlog-start-badge {
  background: rgba(0,168,132,.12); color: var(--accent);
  border: 1px solid rgba(0,168,132,.2);
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.chatlog-start-msg { color: var(--text-secondary); }
.chatlog-start-time { font-size: 11px; color: var(--text-muted); margin-left: auto; flex-shrink: 0; }

/* ======= RANDOM NAME BUTTON ======= */
.btn-rand-name {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 8px; border: 1px solid var(--border);
  color: var(--text-muted); transition: all .2s;
}
.btn-rand-name:hover { border-color: var(--accent); color: var(--accent); background: rgba(0,168,132,.08); }
.btn-rand-name svg { width: 15px; height: 15px; }
.btn-rand-name.spinning svg { animation: spin .5s linear infinite; }

/* ======= MODAL GENERATE NAMA ======= */
.modal-gen-names { width: 520px; }
.gen-controls { display: flex; gap: 12px; align-items: flex-end; }
.gen-hint { font-size: 12px; color: var(--text-muted); padding: 6px 0 4px; }
.gen-names-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; max-height: 320px; overflow-y: auto; }
.gen-name-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-primary); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; cursor: pointer; gap: 8px;
  transition: all .2s;
}
.gen-name-item:hover { border-color: var(--accent); background: rgba(0,168,132,.06); }
.gen-name-item .gni-name { font-size: 14px; font-weight: 500; }
.gen-name-item .gni-actions { display: flex; gap: 4px; flex-shrink: 0; }
.gni-btn {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; cursor: pointer;
}
.gni-btn:hover { border-color: var(--accent); color: var(--accent); }
.gni-btn.apply-btn:hover { border-color: #7c89ff; color: #7c89ff; }

/* ======= SYNC CONTACTS BUTTON (feedback) ======= */
.btn-icon.syncing svg { animation: spin .8s linear infinite; }

/* ======= INTER-CHAT MODAL ======= */
.modal-interchat { width: 460px; }
.ic-info-box {
  background: rgba(0,168,132,.08); border: 1px solid rgba(0,168,132,.25);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: 13px; color: var(--text-secondary); line-height: 1.6;
}
.ic-info-box strong { color: var(--text-primary); }
.ic-arrow { text-align: center; font-size: 20px; color: var(--text-muted); margin: -4px 0; }
.form-select {
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--text-primary); font-size: 14px; outline: none;
  width: 100%; cursor: pointer;
}
.form-select:focus { border-color: var(--accent); }
.form-select option { background: var(--bg-secondary); }
.ic-limits {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12px; color: var(--text-muted); line-height: 1.5;
}
.ic-limits svg { flex-shrink: 0; margin-top: 1px; stroke: var(--warning); }
.ic-limits strong { color: var(--text-secondary); }

/* Badge interchat di sidebar */
.ai-interchat-badge {
  position: absolute; top: -3px; left: -3px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #7c89ff; border: 2px solid var(--bg-secondary);
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .6; transform: scale(.85); }
}

/* ======= TOGGLE SWITCH ======= */
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--bg-tertiary); border-radius: 26px;
  transition: .3s; border: 1px solid var(--border);
}
.toggle-slider::before {
  content: ''; position: absolute;
  height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: var(--text-muted); border-radius: 50%; transition: .3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); background: #fff; }

/* ======= AUTO-REPLY MODAL ======= */
.modal-autoreply { width: 480px; }
.ar-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ar-toggle-title { font-size: 15px; font-weight: 600; }
.ar-toggle-desc { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.ar-divider { height: 1px; background: var(--border); margin: 4px 0; }
.form-hint { font-size: 12px; color: var(--text-muted); }
.style-options { display: flex; gap: 10px; }
.style-opt { flex: 1; cursor: pointer; }
.style-opt input { display: none; }
.style-card {
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 8px; text-align: center; transition: all .2s;
  background: var(--bg-primary);
}
.style-opt input:checked + .style-card { border-color: var(--accent); background: rgba(0,168,132,.1); }
.style-icon { font-size: 22px; margin-bottom: 6px; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.style-icon svg { width: 24px; height: 24px; }
.style-opt input:checked + .style-card .style-icon { color: var(--accent); }
.modal-header h3 { display: flex; align-items: center; gap: 8px; }
.mh-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--accent); }
.style-label { font-size: 13px; font-weight: 600; }
.style-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.ar-info-box {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(0,168,132,.08); border: 1px solid rgba(0,168,132,.2);
  border-radius: var(--radius-sm); padding: 12px;
  font-size: 13px; color: var(--text-secondary);
}
.ar-info-box svg { flex-shrink: 0; margin-top: 1px; stroke: var(--accent); }

/* Badge auto-reply aktif di sidebar akun */
.ai-badge {
  position: absolute; top: -2px; right: -2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; color: #fff;
}
.btn-icon.ar-active { color: var(--accent); }

/* ======= AUTO-REPLY LOG PANEL ======= */
.ar-log-panel {
  position: fixed; right: -360px; top: 0; bottom: 0;
  width: 360px; background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 500; transition: right .3s ease;
  box-shadow: var(--shadow);
}
.ar-log-panel.open { right: 0; }
.ar-log-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 15px; flex-shrink: 0;
}
.ar-log-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.ar-log-empty { text-align: center; color: var(--text-muted); padding: 32px 16px; font-size: 13px; }
.ar-log-footer { padding: 10px 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
.ar-log-item {
  background: var(--bg-primary); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px;
  border-left: 3px solid var(--accent);
}
.ar-log-item .log-meta { display: flex; justify-content: space-between; margin-bottom: 4px; }
.ar-log-item .log-acc { font-weight: 600; color: var(--accent); font-size: 12px; }
.ar-log-item .log-time { font-size: 11px; color: var(--text-muted); }
.ar-log-item .log-from { color: var(--text-secondary); font-size: 12px; margin-bottom: 4px; }
.ar-log-item .log-reply { color: var(--text-primary); }
.ar-log-item .log-badge {
  display: inline-block; font-size: 10px; padding: 1px 6px;
  border-radius: 10px; margin-left: 6px;
  background: rgba(0,168,132,.15); color: var(--accent);
}

/* ======= RESPONSIVE ======= */
@media (max-width: 768px) {
  body {
    padding-top: 60px;
    padding-bottom: 64px;
  }

  /* ─── Mobile Topbar ─── */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    padding: 0 18px;
    background:
      linear-gradient(180deg, rgba(23,35,42,.95), rgba(13,20,24,.95));
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--border-soft);
    z-index: 200;
  }
  .mobile-topbar::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg,
      transparent 0%,
      rgba(0,168,132,.4) 30%,
      rgba(0,196,154,.5) 50%,
      rgba(0,168,132,.4) 70%,
      transparent 100%
    );
  }
  .mobile-brand {
    display: flex; align-items: center; gap: 12px;
    flex: 1; min-width: 0;
  }
  .mobile-brand-icon {
    flex-shrink: 0;
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--grad-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    line-height: 1;
    box-shadow:
      0 4px 16px rgba(0,168,132,.4),
      inset 0 1px 0 rgba(255,255,255,.2);
    animation: brandPopIn .55s cubic-bezier(.2, 1.5, .3, 1);
    transition: transform .25s cubic-bezier(.2, 1.5, .3, 1);
    position: relative;
  }
  .mobile-brand-icon::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255,255,255,.15), transparent 50%);
    pointer-events: none;
  }
  .mobile-brand-icon:active { transform: scale(.92) rotate(-5deg); }
  .mobile-brand-text {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.3px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: brandTextIn .45s cubic-bezier(.4, 0, .2, 1) .1s both;
  }
  @keyframes brandPopIn {
    from { opacity: 0; transform: scale(.3) rotate(-20deg); }
    to   { opacity: 1; transform: scale(1) rotate(0); }
  }
  @keyframes brandTextIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
  }

  /* ─── Bottom Nav ─── */
  .mobile-bottomnav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    background:
      linear-gradient(180deg, rgba(13,20,24,.85), rgba(13,20,24,.98));
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-top: 1px solid var(--border-soft);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, .4);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-bottomnav::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: -1px;
    height: 1px;
    background: linear-gradient(90deg,
      transparent 0%,
      rgba(0,168,132,.3) 30%,
      rgba(0,196,154,.4) 50%,
      rgba(0,168,132,.3) 70%,
      transparent 100%
    );
  }
  .mobile-tab {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: #8696a0;
    font-size: 11.5px; font-weight: 500;
    letter-spacing: -.1px;
    cursor: pointer;
    position: relative;
    padding: 8px 4px;
    font-family: inherit;
    transition: color .2s ease;
  }
  .mobile-tab:active { transform: scale(.94); transition: transform .1s; }
  .mobile-tab svg {
    width: 22px; height: 22px;
    transition:
      transform .35s cubic-bezier(.4, 1.5, .5, 1),
      stroke-width .25s,
      filter .3s;
  }
  .mobile-tab.active { color: var(--accent); }
  .mobile-tab.active svg {
    stroke-width: 2.2;
    transform: translateY(-2px) scale(1.12);
    filter: drop-shadow(0 4px 10px rgba(0, 168, 132, .55));
    animation: tabIconBounce .5s cubic-bezier(.3, 1.6, .5, 1);
  }
  .mobile-tab.active span {
    animation: tabLabelIn .3s cubic-bezier(.4, 0, .2, 1);
  }
  @keyframes tabIconBounce {
    0%   { transform: translateY(0) scale(1); }
    35%  { transform: translateY(-5px) scale(1.22); }
    65%  { transform: translateY(1px) scale(.96); }
    100% { transform: translateY(-2px) scale(1.12); }
  }
  @keyframes tabLabelIn {
    from { opacity: .4; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .mobile-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%; width: 0;
    height: 2.5px;
    background: var(--accent);
    border-radius: 0 0 4px 4px;
    transform: translateX(-50%);
    transition: width .35s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 0 12px rgba(0, 168, 132, .7);
  }
  .mobile-tab.active::before {
    width: 40%;
  }

  /* ─── #app sebagai positioning context ─── */
  #app {
    position: fixed !important;
    top: 60px; bottom: 64px; left: 0; right: 0;
    width: 100%;
    height: auto !important;
    display: block !important;
    overflow: hidden;
  }

  /* ─── Sidebar Akun — full-screen di view Kelola Akun dengan transition ─── */
  #app .sidebar-accounts {
    display: flex !important;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: auto;
    z-index: 10;
    flex-direction: column;
    background: var(--bg-primary, #0b141a);
    /* transition state: hidden */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateX(24px) scale(.985);
    transition:
      opacity .28s cubic-bezier(.4, 0, .2, 1),
      transform .34s cubic-bezier(.4, 0, .2, 1),
      visibility 0s .28s;
  }
  body.mv-accounts #app .sidebar-accounts {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0) scale(1);
    transition:
      opacity .28s cubic-bezier(.4, 0, .2, 1),
      transform .34s cubic-bezier(.4, 0, .2, 1),
      visibility 0s 0s;
  }

  .sa-header .sa-title { display: none; }
  .sa-header {
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    padding: 16px 14px;
    gap: 14px;
    border-bottom: 1px solid rgba(255,255,255,.06);
  }

  /* Mobile: tampilkan hanya btn-add-account + btn-interchat (stacked) */
  .sa-header #btn-gen-names,
  .sa-header #btn-sync-contacts { display: none !important; }
  .sa-header { flex-direction: column !important; align-items: stretch !important; }
  .sa-header #btn-interchat {
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    padding: 11px 20px !important;
    border-radius: 10px;
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    transition: all .18s, transform .1s;
  }
  .sa-header #btn-interchat:hover {
    background: rgba(0,168,132,.1);
  }
  .sa-header #btn-interchat:active { transform: translateY(1px); }
  .sa-header #btn-interchat svg { width: 16px; height: 16px; }
  .m-ic-label { font-family: inherit; letter-spacing: -.1px; }

  /* Tombol Tambah Akun jadi CTA button dengan label teks */
  .sa-header #btn-add-account {
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    padding: 11px 22px !important;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: background .18s, transform .1s, box-shadow .18s;
    box-shadow: 0 4px 14px rgba(0,168,132,.28), inset 0 1px 0 rgba(255,255,255,.12);
  }
  .sa-header #btn-add-account:hover {
    background: var(--accent-dark);
    box-shadow: 0 6px 20px rgba(0,168,132,.38), inset 0 1px 0 rgba(255,255,255,.12);
  }
  .sa-header #btn-add-account:active { transform: translateY(1px); }
  .sa-header #btn-add-account svg { width: 18px; height: 18px; }
  .m-add-label {
    font-family: inherit;
    letter-spacing: -.1px;
  }

  .sa-list {
    flex: 1;
    overflow-y: auto;
    align-items: stretch !important;
    padding: 12px !important;
    gap: 8px !important;
  }
  #app .sa-list .sa-empty {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    padding: 48px 24px;
    line-height: 1.7;
    animation: emptyStateIn .6s cubic-bezier(.4, 0, .2, 1) .2s both;
  }
  @keyframes emptyStateIn {
    from { opacity: 0; transform: translateY(14px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }

  /* ─── Account card (list item) ─── */
  #app .account-item {
    width: 100% !important;
    height: auto !important;
    border-radius: 12px !important;
    padding: 12px 14px !important;
    background:
      linear-gradient(180deg, rgba(31,46,53,.7), rgba(23,35,42,.7)) !important;
    border: 1px solid var(--border-soft) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    cursor: pointer;
    transition: transform .12s, border-color .2s, background .2s, box-shadow .2s;
    position: relative;
    overflow: visible !important;
  }
  #app .account-item:hover {
    border-color: rgba(0,168,132,.3) !important;
    background: linear-gradient(180deg, rgba(36,54,64,.8), rgba(27,40,48,.8)) !important;
  }
  #app .account-item:active { transform: scale(.98); }
  #app .account-item.active {
    border-color: var(--accent) !important;
    background: linear-gradient(180deg, rgba(0,168,132,.12), rgba(0,168,132,.04)) !important;
    box-shadow: 0 4px 20px rgba(0,168,132,.2);
  }

  /* Avatar circle */
  #app .account-item .ai-avatar {
    position: relative;
    flex-shrink: 0;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-hover));
    display: flex; align-items: center; justify-content: center;
    overflow: visible;
    border: 1.5px solid var(--border);
  }
  #app .account-item .ai-avatar img {
    width: 100% !important; height: 100% !important;
    border-radius: 50%;
    object-fit: cover;
  }
  #app .account-item .ai-avatar .ai-fallback {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    letter-spacing: -.3px;
  }
  #app .account-item .status-dot {
    position: absolute;
    bottom: -2px; right: -2px;
    width: 13px !important; height: 13px !important;
    border: 2.5px solid var(--bg-primary);
    border-radius: 50% !important;
  }

  /* Info stack */
  #app .account-item .ai-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 3px;
  }
  #app .account-item .ai-name-row {
    display: flex; align-items: center; gap: 6px;
  }
  #app .account-item .ai-name {
    font-size: 14.5px; font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -.2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 100%;
  }
  #app .account-item .ai-phone {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: var(--text-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  #app .account-item .ai-badge {
    font-size: 9.5px !important;
    font-weight: 700 !important;
    background: linear-gradient(135deg, var(--accent), var(--accent-light)) !important;
    color: #fff !important;
    padding: 2px 7px !important;
    border-radius: 999px !important;
    letter-spacing: .3px;
    box-shadow: 0 2px 8px rgba(0,168,132,.4);
    position: static !important;
    animation: none !important;
  }

  /* Status badge kanan */
  #app .account-item .ai-status-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    font-weight: 500;
    padding: 4px 9px;
    border-radius: 999px;
    letter-spacing: .2px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .badge-online {
    background: rgba(0,168,132,.12);
    color: var(--accent);
    border: 1px solid rgba(0,168,132,.3);
  }
  .badge-connecting {
    background: rgba(240,165,0,.12);
    color: var(--warning);
    border: 1px solid rgba(240,165,0,.3);
  }
  .badge-qr, .badge-pairing {
    background: rgba(88,166,255,.12);
    color: #58a6ff;
    border: 1px solid rgba(88,166,255,.3);
  }
  .badge-offline {
    background: rgba(113,113,122,.12);
    color: var(--text-muted);
    border: 1px solid var(--border);
  }

  /* Pulse animation untuk status dot connecting */
  #app .account-item .status-dot.connecting,
  #app .account-item .status-dot.qr,
  #app .account-item .status-dot.pairing {
    animation: statusPulse 1.5s ease-in-out infinite;
  }
  @keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .5; transform: scale(1.15); }
  }

  /* Sa-header (btn add) — fade in */
  body.mv-accounts .sa-header #btn-add-account {
    animation: addBtnIn .5s cubic-bezier(.2, 1.4, .3, 1);
  }
  @keyframes addBtnIn {
    from { opacity: 0; transform: translateY(-8px) scale(.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }
  /* Chatlog entries stagger in */
  body.mv-log #chatlog-entries > * {
    animation: cmdTypeIn .35s cubic-bezier(.4, 0, .2, 1) both;
  }

  /* Stagger saat enter mv-accounts */
  body.mv-accounts .account-item {
    animation: accountCardIn .4s cubic-bezier(.4, 0, .2, 1) both;
  }
  body.mv-accounts .account-item:nth-child(1) { animation-delay: .05s; }
  body.mv-accounts .account-item:nth-child(2) { animation-delay: .1s; }
  body.mv-accounts .account-item:nth-child(3) { animation-delay: .15s; }
  body.mv-accounts .account-item:nth-child(4) { animation-delay: .2s; }
  body.mv-accounts .account-item:nth-child(5) { animation-delay: .25s; }
  body.mv-accounts .account-item:nth-child(n+6) { animation-delay: .3s; }
  @keyframes accountCardIn {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }
  /* account-item sizing di-handle di '#app .account-item' di atas (card list) */
  .sa-footer {
    padding: 12px 16px !important;
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
  }
  #app .sa-footer #sa-count { font-size: 13px; }
  #app .sa-footer #btn-logout {
    width: 36px !important;
    height: 36px !important;
  }

  /* ─── Main panel (view Log Chat) dengan transition ─── */
  .main-panel {
    display: flex !important;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    /* transition state: hidden */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-24px) scale(.985);
    transition:
      opacity .28s cubic-bezier(.4, 0, .2, 1),
      transform .34s cubic-bezier(.4, 0, .2, 1),
      visibility 0s .28s;
  }
  body.mv-log .main-panel {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0) scale(1);
    transition:
      opacity .28s cubic-bezier(.4, 0, .2, 1),
      transform .34s cubic-bezier(.4, 0, .2, 1),
      visibility 0s 0s;
  }

  /* Sidebar chat di atas chat-area */
  .sidebar-chat {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: auto;
    z-index: 5;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
  }
  .sidebar-chat.hidden { transform: translateX(-100%); }

  .chat-area {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: auto;
    z-index: 1;
  }
  .back-btn { display: flex !important; }
  .chat-messages { padding: 12px 4%; }
  .msg-bubble { max-width: 80%; }

  .sidebar-chat .sc-header { display: none; }
  .chat-welcome { display: none !important; }

  /* Log Chat view → hanya tampilkan konten log chat.
     Sembunyikan: allchat-bar, search, tabs, chat-list.
     Tampilkan: chatlog-panel saja. */
  .allchat-bar,
  .sc-search,
  .sc-tabs,
  .sidebar-chat #chat-list { display: none !important; }

  .sidebar-chat #chatlog-panel {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
  }

  /* Toast di atas bottom nav */
  .toast-container {
    bottom: 80px !important;
    right: 14px !important;
    left: 14px !important;
    align-items: flex-end;
  }
  .toast { max-width: 100%; border-radius: 10px; }

  /* Modal lebih soft di mobile */
  .modal { border-radius: 14px; }
  .modal-overlay { padding: 20px; }

  .cs-wa-button { bottom: 80px !important; right: 14px !important; }

  /* ─── Animasi umum: fade-in page load ─── */
  .mobile-topbar {
    animation: slideDownIn .4s cubic-bezier(.4, 0, .2, 1);
  }
  .mobile-bottomnav {
    animation: slideUpIn .4s cubic-bezier(.4, 0, .2, 1);
  }
  @keyframes slideDownIn {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }
  @keyframes slideUpIn {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }

  /* Softer, more modern corner radius */
  .sc-search input,
  .modal .form-group input[type="text"],
  .modal .form-group input[type="tel"],
  .modal select,
  .modal textarea {
    border-radius: 10px !important;
    transition: background .18s, box-shadow .18s, border-color .18s;
  }

  /* Input focus glow */
  .modal input:focus,
  .modal select:focus,
  .modal textarea:focus {
    box-shadow: 0 0 0 3px rgba(0,168,132,.2) !important;
  }

  /* Touchable feedback ripple (tap on buttons) */
  button:not(:disabled):active {
    transform: scale(.97);
    transition: transform .08s;
  }
}
