/* =========================================================
   WaBlaster Design System — modern, calm, responsive
   ========================================================= */

:root {
  /* Brand — WhatsApp green */
  --c-primary: #0f8a72;
  --c-primary-dark: #0b6d5b;
  --c-primary-light: #20c257;
  --c-primary-soft: #e4f6ee;

  /* Status */
  --c-green: #149a4a;
  --c-green-bg: #e3f6e8;
  --c-red: #d92d20;
  --c-red-dark: #b42318;
  --c-red-bg: #fdecea;
  --c-amber: #b54708;
  --c-amber-bg: #fef0c7;
  --c-blue: #1d6ae5;
  --c-blue-bg: #e6effd;
  --c-purple: #6938ef;
  --c-purple-bg: #efe9fd;

  /* Neutrals */
  --c-dark: #0e1521;
  --c-dark-2: #16202e;
  --c-dark-3: #1f2b3a;
  --c-text: #17202c;
  --c-muted: #64748b;
  --c-border: #e3e8ef;
  --c-bg: #f3f5f9;
  --c-surface: #ffffff;
  --c-row-hover: #f8fafc;

  /* Sizing & effects */
  --radius: 14px;
  --radius-lg: 18px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 6px 16px -4px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .05);
  --shadow-lg: 0 18px 40px -12px rgba(16, 24, 40, .22);
  --transition: .18s ease;
  --sidebar-w: 256px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.55rem; font-weight: 750; margin: 0 0 4px; letter-spacing: -.025em; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 28px 0 12px; letter-spacing: -.015em; }
h3 { font-size: 1rem; }
a { color: var(--c-primary); }
code { background: #eef1f5; padding: 2px 6px; border-radius: 5px; font-size: .85em; }
svg { flex-shrink: 0; }

.muted { color: var(--c-muted); font-size: .9rem; }

::selection { background: var(--c-primary-soft); }

/* Scrollbar */
.content ::-webkit-scrollbar { width: 10px; height: 10px; }
.content ::-webkit-scrollbar-thumb { background: #d3dbe4; border-radius: 99px; border: 2px solid var(--c-bg); }
.content ::-webkit-scrollbar-thumb:hover { background: #b7c2cf; }

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

.content {
  flex: 1;
  padding: 32px 40px 56px;
  min-width: 0;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-header p { margin: 0; max-width: 640px; }
.page-header .header-tools { display: flex; align-items: center; gap: 10px; }

/* =========================================================
   Sidebar
   ========================================================= */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--c-dark) 0%, var(--c-dark-2) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  gap: 3px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 750;
  font-size: 1.18rem;
  letter-spacing: -.02em;
  padding: 6px 10px;
  margin-bottom: 22px;
}
.sidebar .brand-icon {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--c-primary-light), var(--c-primary));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(32, 194, 87, .35);
}
.sidebar .brand-icon svg { width: 21px; height: 21px; }

.sidebar .nav-label {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.38);
  padding: 12px 12px 5px;
  font-weight: 700;
}

.sidebar a {
  color: rgba(255,255,255,.7);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .92rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}
.sidebar a svg { width: 19px; height: 19px; opacity: .75; }
.sidebar a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar a:active { transform: scale(.98); }
.sidebar a.active {
  background: linear-gradient(90deg, rgba(32,194,87,.22), rgba(32,194,87,.06));
  color: #fff;
  font-weight: 650;
  box-shadow: inset 0 0 0 1px rgba(32,194,87,.25);
}
.sidebar a.active svg { opacity: 1; color: var(--c-primary-light); }

.logout-form { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.09); }

.sidebar .plan-chip {
  margin: 16px 8px 0;
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  font-size: .82rem;
  color: rgba(255,255,255,.72);
}
.sidebar .plan-chip strong { color: #fff; display: block; margin-bottom: 7px; font-size: .9rem; }
.plan-progress { margin-top: 7px; }

.link-button {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  padding: 10px 12px;
  font-size: .92rem;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: inherit;
  font-weight: 500;
  border-radius: 10px;
  transition: background var(--transition), color var(--transition);
}
.link-button:hover { background: rgba(255,255,255,.08); color: #fff; }
.link-button svg { width: 19px; height: 19px; }

/* Mobile sidebar toggle */
.menu-btn {
  display: none;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.menu-btn svg { width: 20px; height: 20px; color: var(--c-text); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 20, 26, .55);
  backdrop-filter: blur(2px);
  z-index: 40;
}
body.sidebar-open .sidebar-backdrop { display: block; }

/* =========================================================
   Cards & Stats
   ========================================================= */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  margin: 20px 0;
  grid-auto-rows: 1fr;
}
.cards > .card {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.cards > .card > .stat-foot,
.cards > .card > p { margin-bottom: 12px; }
.cards > .card > a.btn { margin-top: auto; }

.card {
  background: var(--c-surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border);
}
.card h3 {
  margin: 0 0 10px;
  font-size: .78rem;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h3 svg { width: 16px; height: 16px; color: var(--c-primary); }

.stat-card { display: flex; flex-direction: column; gap: 3px; }
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.stat-card .stat-icon svg { width: 22px; height: 22px; }
.stat-icon.green { background: var(--c-primary-soft); color: var(--c-primary); }
.stat-icon.blue { background: var(--c-blue-bg); color: var(--c-blue); }
.stat-icon.purple { background: var(--c-purple-bg); color: var(--c-purple); }
.stat-icon.amber { background: var(--c-amber-bg); color: var(--c-amber); }
.stat-card .stat-label { font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 750; letter-spacing: -.025em; line-height: 1.25; }
.stat-card .stat-foot { font-size: .82rem; color: var(--c-muted); }
.stat-card > a.btn { margin-top: 12px; align-self: flex-start; }

/* Progress bars */
.progress {
  height: 8px;
  border-radius: 99px;
  background: #e8edf3;
  overflow: hidden;
  flex: 1;
}
.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--c-primary), var(--c-primary-light));
  transition: width .5s ease;
}
.progress-bar.danger { background: linear-gradient(90deg, #ef4444, var(--c-red)); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-label { font-size: .78rem; color: var(--c-muted); white-space: nowrap; font-weight: 650; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--c-primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 650;
  font-family: inherit;
  line-height: 1.3;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.btn:hover { background: var(--c-primary-dark); box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--c-primary-light); color: #06281a; }
.btn-primary:hover { background: #17b04c; box-shadow: 0 4px 14px rgba(32,194,87,.35); }
.btn-danger { background: var(--c-red); }
.btn-danger:hover { background: var(--c-red-dark); }
.btn-ghost { background: transparent; color: var(--c-primary); border: 1.5px solid var(--c-primary); }
.btn-ghost:hover { background: var(--c-primary-soft); box-shadow: none; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: .8rem; border-radius: 8px; }
.btn:disabled, .btn.htmx-request { opacity: .6; cursor: wait; }
.htmx-request .btn-spinner { display: inline-block !important; }
.btn-spinner { display: none; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   Badges
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 99px;
  background: #eef1f5;
  color: var(--c-muted);
  font-size: .76rem;
  font-weight: 650;
  line-height: 1.7;
  white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--c-green-bg); color: var(--c-green); }
.badge-warning { background: var(--c-amber-bg); color: var(--c-amber); }
.badge-danger { background: var(--c-red-bg); color: var(--c-red); }
.badge-info { background: var(--c-blue-bg); color: var(--c-blue); }
.badge-purple { background: var(--c-purple-bg); color: var(--c-purple); }
.badge-muted { background: #eef1f5; color: var(--c-muted); }

/* =========================================================
   Alerts & Toasts
   ========================================================= */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
  background: var(--c-primary-soft);
  color: var(--c-primary-dark);
  font-size: .9rem;
  border: 1px solid rgba(15,138,114,.18);
}
.alert svg { width: 18px; height: 18px; margin-top: 1px; flex-shrink: 0; }
.alert-error { background: var(--c-red-bg); color: #94150c; border-color: rgba(217,45,32,.22); }
.alert-warning { background: var(--c-amber-bg); color: var(--c-amber); border-color: rgba(181,71,8,.22); }

.toast-stack {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--c-dark-2);
  color: #fff;
  padding: 13px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: .9rem;
  animation: toast-in .25s ease;
  max-width: 360px;
  border-left: 4px solid var(--c-primary-light);
}
.toast.error { border-left-color: var(--c-red); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast.fade-out { opacity: 0; transition: opacity .3s; }

/* =========================================================
   Modal (HTMX confirm)
   ========================================================= */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(14, 21, 33, .55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.confirm-box {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 26px;
  width: min(92vw, 420px);
  animation: pop-in .18s ease;
}
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } }
.confirm-box h3 { margin: 0 0 8px; font-size: 1.05rem; }
.confirm-box p { margin: 0 0 18px; color: var(--c-muted); font-size: .92rem; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* =========================================================
   HTMX indicators
   ========================================================= */
.htmx-indicator { opacity: 0; transition: opacity .2s; height: 0; overflow: hidden; text-align: center; color: var(--c-muted); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; height: auto; }

/* =========================================================
   Forms
   ========================================================= */
input, select, textarea {
  font-family: inherit;
  font-size: .93rem;
  color: var(--c-text);
  border: 1.5px solid var(--c-border);
  border-radius: 10px;
  background: #fff;
  padding: 10px 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input::placeholder, textarea::placeholder { color: #9aa8b8; }
input:hover, select:hover, textarea:hover { border-color: #cbd5e1; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(15, 138, 114, .14);
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

.inline-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  max-width: 560px;
  margin-bottom: 20px;
}
.stacked-form input, .stacked-form textarea, .stacked-form select { width: 100%; }

.field-label {
  display: flex;
  flex-direction: column;
  font-size: .8rem;
  color: var(--c-muted);
  gap: 5px;
  font-weight: 650;
}
.field-hint { font-weight: 400; font-size: .78rem; }
.row-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row-actions > * { flex: 1; min-width: 200px; }
.row-actions .field-label { font-size: .8rem; }

/* Search box */
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search-box svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--c-muted);
  pointer-events: none;
}
.search-box input { width: 100%; padding-left: 36px; }

/* =========================================================
   Sections (form wizard)
   ========================================================= */
.form-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 26px 28px;
  margin-bottom: 22px;
}
.form-section-step {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.step-num {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-light));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 750; font-size: .85rem;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(15,138,114,.28);
}
.form-section-step h3 { margin: 0; font-size: .98rem; }
.form-section-step .muted { font-size: .78rem; }

.form-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.form-grid > label { flex: 1; min-width: 150px; }

.form-section .inline-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
}
.form-section > .stacked-form { max-width: none; }
.form-grid-wrap { display: flex; gap: 14px; flex-wrap: wrap; }
.form-grid-wrap > * { flex: 1; min-width: 200px; }

/* Target picker (radio cards) */
.target-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.target-card {
  display: block !important;
  flex-direction: row !important;
  align-items: flex-start;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  padding: 15px;
  cursor: pointer;
  gap: 10px;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  font-weight: 500;
  background: #fff;
}
.target-card:hover { border-color: var(--c-primary-light); }
.target-card:has(input:checked) {
  border-color: var(--c-primary);
  background: var(--c-primary-soft);
  box-shadow: 0 0 0 1.5px var(--c-primary);
}
.target-card input { width: auto; margin-top: 3px; accent-color: var(--c-primary); }
.target-card .tc-title { font-weight: 650; font-size: .93rem; color: var(--c-text); display: block; }
.target-card .tc-desc { font-weight: 400; font-size: .78rem; color: var(--c-muted); display: block; }
.target-card .tc-extra { display: block; margin-top: 8px; width: 100%; }
.target-card .tc-extra:has(option[value=""]::-webkit-unknown) { display: none; }
#group-card-extra[hidden] { display: none !important; }

/* =========================================================
   Tables
   ========================================================= */
.table-wrap {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--c-border);
  overflow: hidden;
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}
.table th, .table td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.table th {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-muted);
  background: #f7f9fc;
  font-weight: 700;
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--c-row-hover); }
.table td a { text-decoration: none; font-weight: 650; }
.table td a:hover { text-decoration: underline; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--c-muted);
}
.empty-state svg { width: 52px; height: 52px; margin-bottom: 12px; opacity: .35; }
.empty-state p { margin: 4px 0 16px; font-size: .93rem; }
.empty-state .btn { margin-top: 4px; }

/* =========================================================
   Auth pages (split screen)
   ========================================================= */
.auth-page {
  display: flex;
  min-height: 100vh;
}
.auth-hero {
  flex: 1.1;
  background: linear-gradient(160deg, var(--c-dark) 0%, var(--c-dark-2) 55%, #11413b 100%);
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.auth-hero::after {
  content: "";
  position: absolute;
  width: 460px; height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(32,194,87,.2), transparent 70%);
  bottom: -140px; right: -120px;
  pointer-events: none;
}
.auth-hero::before {
  content: "";
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(32,194,87,.12), transparent 70%);
  top: -80px; left: -60px;
  pointer-events: none;
}
.auth-hero .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 750; font-size: 1.2rem;
  margin-bottom: 44px;
  position: relative; z-index: 1;
}
.auth-hero .brand-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--c-primary-light), var(--c-primary));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 4px 14px rgba(32,194,87,.4);
}
.auth-hero h2 { font-size: 1.95rem; letter-spacing: -.03em; margin: 0 0 14px; color: #fff; line-height: 1.3; position: relative; z-index: 1; }
.auth-hero p.auth-sub { color: rgba(255,255,255,.62); font-size: 1rem; max-width: 430px; margin: 0 0 38px; position: relative; z-index: 1; }
.auth-features { display: flex; flex-direction: column; gap: 18px; position: relative; z-index: 1; }
.auth-feature { display: flex; gap: 12px; align-items: flex-start; }
.auth-feature .auth-check {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(32,194,87,.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.auth-feature svg { width: 14px; height: 14px; color: var(--c-primary-light); }
.auth-feature b { display: block; font-size: .97rem; }
.auth-feature span { color: rgba(255,255,255,.58); font-size: .85rem; }

.auth-pane {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-box {
  width: 100%;
  max-width: 400px;
}
.auth-box h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-box > p.muted { margin: 0 0 24px; }
.auth-box input { display: block; width: 100%; margin-bottom: 15px; }
.auth-pane .card { padding: 30px; border-radius: var(--radius-lg); }
.auth-logo-mob { display: none; }

/* =========================================================
   WhatsApp connect page
   ========================================================= */
.wa-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: start;
}
.qr-card { text-align: center; }
.qr-code {
  max-width: 260px;
  width: 100%;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  box-shadow: var(--shadow-md);
}
.qr-countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  color: var(--c-amber);
}
.wa-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.wa-steps li { display: flex; gap: 14px; align-items: flex-start; }
.wa-steps b { display: block; font-size: .95rem; }
.wa-steps p { margin: 2px 0 0; font-size: .85rem; color: var(--c-muted); }
.connected-card { display: flex; align-items: center; gap: 16px; }
.connected-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--c-primary-soft);
  color: var(--c-primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.connected-avatar svg { width: 30px; height: 30px; }

/* =========================================================
   Campaign detail
   ========================================================= */
.campaign-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 18px 0;
  grid-auto-rows: 1fr;
}
.mini-stat {
  background: var(--c-bg);
  border-radius: 12px;
  padding: 15px 16px;
  border: 1px solid var(--c-border);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.mini-stat .v { font-size: 1.4rem; font-weight: 750; letter-spacing: -.02em; }
.mini-stat .l { font-size: .78rem; color: var(--c-muted); }
.mini-stat.green .v { color: var(--c-green); }
.mini-stat.red .v { color: var(--c-red); }

/* Daftar nomor gagal terkirim (campaign_progress) */
.failed-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-bg);
}
.failed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  font-size: .87rem;
}
.failed-item:last-child { border-bottom: none; }
.failed-phone { font-weight: 650; white-space: nowrap; }
.failed-reason { color: var(--c-red); text-align: right; font-size: .82rem; }

@media (max-width: 480px) {
  .failed-item { flex-direction: column; align-items: flex-start; gap: 4px; }
  .failed-reason { text-align: left; }
}

.msg-preview {
  background: #dcf8c6;
  background-image: radial-gradient(rgba(0,0,0,.025) 1px, transparent 1px);
  background-size: 12px 12px;
  border-radius: 14px 4px 14px 14px;
  padding: 14px 16px;
  font-size: .93rem;
  max-width: 560px;
  border: 1px solid rgba(0,0,0,.05);
  white-space: pre-wrap;
}

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--c-muted); text-decoration: none; font-size: .88rem;
  margin-bottom: 12px;
}
.back-link:hover { color: var(--c-primary); }

/* =========================================================
   Billing / Pricing
   ========================================================= */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 280px));
  gap: 18px;
  justify-content: center;
  margin: 18px 0;
}
.price-card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition);
}
.price-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.price-card.current { border-color: var(--c-primary); box-shadow: 0 0 0 1.5px var(--c-primary), var(--shadow-md); }
.price-card.featured { border-color: var(--c-primary-light); box-shadow: 0 6px 20px -6px rgba(32,194,87,.35), var(--shadow-sm); }
.price-pop {
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%);
  background: var(--c-primary-light);
  color: #06281a;
  font-size: .72rem;
  font-weight: 750;
  padding: 5px 14px;
  border-radius: 99px;
  letter-spacing: .04em;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(32,194,87,.4);
}
.price-card h3 { margin: 0; font-size: 1.05rem; }
.price-value { font-size: 1.95rem; font-weight: 750; letter-spacing: -.025em; margin: 10px 0 2px; }
.price-value small { font-size: .82rem; font-weight: 500; color: var(--c-muted); }
.price-per { font-size: .8rem; color: var(--c-muted); margin-bottom: 16px; }
.price-feats { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.price-feats li { display: flex; gap: 9px; align-items: flex-start; font-size: .88rem; }
.price-feats li .feat-check {
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--c-green-bg); color: var(--c-green);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.price-feats svg { width: 11px; height: 11px; }
.price-feats .no svg, .price-feats .no .feat-check { background: #eef1f5; color: #c6ced1; }
.price-feats .no { color: var(--c-muted); }

/* =========================================================
   Import / details block
   ========================================================= */
.import-card summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--c-primary);
  display: flex; align-items: center; gap: 8px;
  list-style: none;
}
.import-card summary::-webkit-details-marker { display: none; }
.import-card summary svg { width: 16px; height: 16px; }
.import-card[open] summary svg.chevron { transform: rotate(180deg); }
.import-card summary svg.chevron { transition: transform var(--transition);}
.import-body { margin-top: 16px; }
.file-input { padding: 8px !important; font-size: .85rem; }
.file-input::file-selector-button {
  border: none;
  background: var(--c-primary);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 650;
  margin-right: 12px;
  transition: background var(--transition);
}
.file-input::file-selector-button:hover { background: var(--c-primary-dark); }

/* =========================================================
   Toolbar (above tables)
   ========================================================= */
.table-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.bulk-bar {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--c-dark-2);
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  margin-bottom: 12px;
  font-size: .88rem;
}
.bulk-bar.on { display: flex; }
.bulk-bar button.btn { background: var(--c-primary-light); color: #06281a; }
.bulk-count { font-weight: 700; }

/* =========================================================
   Actions (inline button row)
   ========================================================= */
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1180px) {
  .content { padding: 28px 28px 48px; }
}

@media (max-width: 1024px) {
  .wa-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .auth-page { flex-direction: column; }
  .auth-pane, .auth-hero { flex: none; }
  .auth-hero { padding: 40px 28px; }
  .auth-hero .brand { margin-bottom: 20px; }
  .auth-hero h2 { font-size: 1.4rem; }
  .auth-hero p.auth-sub { display: none; }
  .auth-pane { padding-top: 24px; }
}

@media (max-width: 768px) {
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }

  .content { padding: 18px 16px 40px; }
  .page-header { margin-bottom: 18px; }
  .page-header .header-tools { width: 100%; }
  .page-header .header-tools .btn { flex: 1; }
  .cards { grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
  .pricing-grid { grid-template-columns: 1fr; }
  .stacked-form { max-width: none; }
  .form-section { padding: 18px; margin-bottom: 16px; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .table-toolbar .search-box { max-width: none; }
}

@media (max-width: 680px) {
  /* Tabel jadi tumpukan kartu supaya tidak perlu scroll horizontal di HP —
     setiap <td> ditumpuk vertikal dengan label kolom dari atribut data-label. */
  .table-wrap {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }
  .table { min-width: 0; }
  .table thead { display: none; }
  .table tbody { display: flex; flex-direction: column; gap: 12px; }
  .table tbody tr {
    display: block;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }
  .table tbody tr:hover { background: var(--c-surface); }
  .table td {
    display: block;
    text-align: left !important;
    white-space: normal !important;
    max-width: none !important;
    padding: 10px 14px;
    border-bottom: 1px dashed var(--c-border);
  }
  .table td:last-child {
    border-bottom: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  .table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--c-muted);
    margin-bottom: 4px;
  }
  .table td[data-label]:last-child::before { width: 100%; }
}

@media (max-width: 520px) {
  .cards { grid-template-columns: 1fr; }
  .campaign-stats { grid-template-columns: 1fr 1fr; }
  .table th, .table td { padding: 10px 12px; }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}