:root {
  --wa:     #25d366;
  --teal:   #128c7e;
  --dark:   #075e54;
  --bg:     #f0f2f5;
  --card:   #fff;
  --text:   #111b21;
  --muted:  #667781;
  --border: #e9edef;
  --danger: #dc3545;
  --online: #00a884;
  --shadow: 0 1px 4px rgba(0,0,0,.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* ── Top Bar ──────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  background: var(--teal);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.topbar-logo { font-size: 1.1rem; font-weight: 700; letter-spacing: .3px; }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  background: rgba(255,255,255,.18);
  border: none; border-radius: 50%;
  width: 36px; height: 36px;
  color: #fff; font-size: 1.1rem;
  cursor: pointer; display: grid; place-items: center;
  transition: background .15s;
}
.icon-btn:active { background: rgba(255,255,255,.35); }

/* ── Tab Nav ──────────────────────────────────────────── */
.tab-nav {
  position: sticky; top: 56px; z-index: 100;
  display: flex;
  background: var(--dark);
  border-bottom: 2px solid rgba(255,255,255,.1);
}
.tab-btn {
  flex: 1; padding: 11px 4px;
  background: none; border: none;
  color: rgba(255,255,255,.65);
  font-size: .82rem; font-weight: 600;
  cursor: pointer; letter-spacing: .2px;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s;
}
.tab-btn.active {
  color: #fff;
  border-bottom-color: var(--wa);
}
.tab-btn:active { background: rgba(255,255,255,.08); }

/* ── Layout ───────────────────────────────────────────── */
.wrap { max-width: 680px; margin: 0 auto; padding: 12px 12px 32px; }
.tab-content { display: block; }
.tab-content.hidden { display: none; }

/* ── Card ─────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card-title {
  font-weight: 700; font-size: 1rem;
  margin-bottom: 6px; color: var(--teal);
}
.card-desc {
  font-size: .82rem; color: var(--muted);
  margin-bottom: 4px;
}

/* ── Form Fields ──────────────────────────────────────── */
.field-group { margin-bottom: 10px; }
label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, .select-input {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .95rem;
  color: var(--text); background: #fff;
  outline: none; -webkit-appearance: none;
}
input:focus, .select-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(18,140,126,.12);
}
.input-row {
  display: flex; gap: 8px;
}
.input-row input { flex: 1; }
.input-row .btn-primary { white-space: nowrap; flex-shrink: 0; }

/* ── Buttons ──────────────────────────────────────────── */
.btn-primary {
  background: var(--teal); color: #fff;
  border: none; border-radius: 8px;
  padding: 11px 18px; font-size: .95rem; font-weight: 700;
  cursor: pointer; -webkit-appearance: none;
  transition: opacity .15s;
}
.btn-primary:active { opacity: .82; }
.full-btn { width: 100%; margin-top: 6px; }

.ghost-btn {
  background: none; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  font-size: .82rem; color: var(--muted); cursor: pointer;
}
.ghost-btn:active { background: var(--bg); }

.action-btn {
  border: none; border-radius: 6px;
  padding: 6px 10px; font-size: .8rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: opacity .15s;
}
.action-btn.start   { background: #e7f8f1; color: #00704a; }
.action-btn.restart { background: #fff4e0; color: #b35e00; }
.action-btn.stop    { background: #f2f2f2; color: var(--muted); }
.action-btn.log-btn { background: #eff3ff; color: #2962ff; }
.action-btn.del     { background: #ffeaea; color: var(--danger); }
.action-btn:active  { opacity: .72; }

/* ── Section label ────────────────────────────────────── */
.section-label {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted);
  padding: 0 4px 8px;
}

/* ── Account Cards ────────────────────────────────────── */
#accounts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.acc-card {
  background: var(--card);
  border-radius: 12px; padding: 14px 14px 12px;
  box-shadow: var(--shadow);
}
.acc-row1 { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.acc-name  { font-weight: 700; font-size: 1rem; }
.acc-phone { font-size: .82rem; color: var(--muted); margin-top: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px;
  font-size: .76rem; font-weight: 700;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.online  { background: #e7f8f1; color: var(--online); }
.badge.stopped { background: #ffeaea; color: var(--danger); }
.badge.unknown { background: #f0f0f0; color: var(--muted); }

.acc-meta { font-size: .78rem; color: var(--muted); margin-bottom: 10px; }
.acc-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Blacklist ────────────────────────────────────────── */
#blList { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.bl-item {
  background: var(--card);
  border-radius: 10px; padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.bl-phone { font-size: .9rem; font-weight: 600; color: var(--text); }

/* ── Stats ────────────────────────────────────────────── */
.stats-total-card {
  background: linear-gradient(135deg, var(--teal), var(--dark));
  border-radius: 14px; padding: 20px 16px;
  text-align: center; color: #fff;
  box-shadow: 0 4px 12px rgba(7,94,84,.25);
  margin-bottom: 0;
}
.stats-total-num {
  font-size: 3rem; font-weight: 800; line-height: 1;
  letter-spacing: -1px;
}
.stats-total-label {
  font-size: .85rem; opacity: .85; margin-top: 4px;
}

.chart-wrap { padding: 4px 0; }
.bar-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.bar-label {
  width: 46px; font-size: .74rem; color: var(--muted);
  text-align: right; flex-shrink: 0;
}
.bar-track {
  flex: 1; height: 18px; background: var(--bg);
  border-radius: 99px; overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 99px;
  transition: width .4s ease;
  min-width: 3px;
}
.bar-val {
  width: 32px; font-size: .74rem; font-weight: 700;
  color: var(--text); text-align: right; flex-shrink: 0;
}

/* ── Empty / Notice ───────────────────────────────────── */
.empty-state {
  text-align: center; padding: 28px 16px;
  color: var(--muted); font-size: .9rem;
  background: var(--card); border-radius: 12px;
  box-shadow: var(--shadow);
}

.notice {
  margin-top: 10px; padding: 10px 12px;
  border-radius: 8px; font-size: .85rem;
  background: #e7f8f1; color: #00704a;
  white-space: pre-wrap;
}
.notice.err { background: #ffeaea; color: var(--danger); }
.hidden { display: none !important; }

/* ── Log Box ──────────────────────────────────────────── */
.log-wrap { margin-bottom: 12px; }
.log-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.log-title { font-weight: 700; font-size: .95rem; color: var(--teal); }
.logbox {
  background: #0d1f17; color: #a8ffce;
  border-radius: 10px; padding: 12px;
  font-size: .78rem; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  min-height: 160px; max-height: 42vh; overflow-y: auto;
  font-family: "JetBrains Mono", "Fira Code", monospace, sans-serif;
}

/* ── Footer ───────────────────────────────────────────── */
.footer { text-align: center; font-size: .75rem; color: var(--muted); padding: 12px 0 4px; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 400px) {
  .acc-actions { gap: 5px; }
  .action-btn  { padding: 5px 8px; font-size: .76rem; }
  .logbox      { font-size: .73rem; }
  .tab-btn     { font-size: .78rem; padding: 10px 2px; }
}


/* ── Kontak ───────────────────────────────────────────── */
.contact-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
#ctList { display:flex; flex-direction:column; gap:8px; margin-bottom:12px; }
.ct-item {
  background: var(--card);
  border-radius: 10px; padding: 12px 14px;
  box-shadow: var(--shadow);
  display:flex; align-items:center; justify-content:space-between; gap:10px;
}
.ct-name { font-size:.94rem; font-weight:700; color:var(--text); }
.ct-phone { font-size:.82rem; color:var(--muted); margin-top:2px; }
.ct-tag {
  display:inline-block; margin-left:6px; padding:1px 7px; border-radius:99px;
  background:#fff4e0; color:#b35e00; font-size:.70rem; font-weight:700;
}
.ct-tag.sync { background:#e7f8f1; color:#00704a; }
