:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --card: #1c2129;
  --border: #2d333c;
  --text: #e6e8ea;
  --muted: #8b939e;
  --green: #25d366;
  --green-dark: #128c5e;
  --gold: #d4af37;
  --red: #f47067;
  --amber: #e3b341;
  --blue: #539bf5;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Tajawal", "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh; font-size: 15px;
}
a { color: inherit; text-decoration: none; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: var(--bg2); border-inline-end: 1px solid var(--border);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.logo { font-size: 26px; font-weight: 800; margin-bottom: 4px; padding: 0 10px; }
.logo .dot { color: var(--green); }
.logo-sub { color: var(--muted); font-size: 12px; padding: 0 10px; margin-bottom: 22px; }
.nav-link {
  padding: 11px 14px; border-radius: 10px; color: var(--muted);
  display: flex; align-items: center; gap: 10px; font-weight: 500;
}
.nav-link:hover { background: var(--card); color: var(--text); }
.nav-link.active { background: rgba(37, 211, 102, .12); color: var(--green); font-weight: 700; }
.nav-sep { margin: 14px 10px 6px; font-size: 11px; color: var(--muted); letter-spacing: .05em; }
.sidebar .spacer { flex: 1; }

.main { flex: 1; padding: 28px 34px; max-width: 1200px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.card-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--green-dark); color: #fff; border: none; border-radius: 10px;
  padding: 10px 18px; font-size: 14px; font-weight: 700; font-family: inherit;
}
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: var(--green); color: #04240f; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: transparent; border: 1px solid var(--red); color: var(--red); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.chip {
  display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700;
}
.chip.APPROVED, .chip.done, .chip.delivered, .chip.read, .chip.sent, .chip.GREEN { background: rgba(37,211,102,.15); color: var(--green); }
.chip.PENDING, .chip.paused, .chip.IN_APPEAL { background: rgba(227,179,65,.15); color: var(--amber); }
.chip.REJECTED, .chip.failed, .chip.cancelled, .chip.DISABLED, .chip.RED { background: rgba(244,112,103,.15); color: var(--red); }
.chip.draft, .chip.pending { background: rgba(139,147,158,.15); color: var(--muted); }
.chip.running, .chip.YELLOW { background: rgba(83,155,245,.15); color: var(--blue); }
.chip.MARKETING { background: rgba(212,175,55,.14); color: var(--gold); }
.chip.UTILITY { background: rgba(83,155,245,.15); color: var(--blue); }
.chip.AUTHENTICATION { background: rgba(139,147,158,.15); color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th { text-align: start; color: var(--muted); font-size: 12px; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.015); }

label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-family: inherit; font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-dark); }
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.alert { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.alert.error { background: rgba(244,112,103,.12); color: var(--red); border: 1px solid rgba(244,112,103,.35); }
.alert.ok { background: rgba(37,211,102,.1); color: var(--green); border: 1px solid rgba(37,211,102,.3); }

/* WhatsApp-style preview */
.wa-preview {
  background: #0b141a url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" opacity="0.04"><circle cx="30" cy="30" r="1.5" fill="white"/></svg>');
  border-radius: var(--radius); border: 1px solid var(--border);
  padding: 24px 18px; min-height: 220px; position: sticky; top: 20px;
}
.wa-bubble {
  background: #202c33; color: #e9edef; border-radius: 10px; border-start-start-radius: 2px;
  padding: 8px 10px 6px; max-width: 340px; box-shadow: 0 1px 1px rgba(0,0,0,.4);
  font-size: 14px; line-height: 1.45;
}
.wa-bubble .hdr { font-weight: 700; margin-bottom: 4px; }
.wa-bubble .hdr-media {
  background: #111b21; border-radius: 8px; height: 130px; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: center; color: #8696a0; font-size: 30px;
  overflow: hidden;
}
.wa-bubble .hdr-media img { width: 100%; height: 100%; object-fit: cover; }
.wa-bubble .body { white-space: pre-wrap; word-break: break-word; }
.wa-bubble .ftr { color: #8696a0; font-size: 12px; margin-top: 4px; }
.wa-bubble .time { color: #8696a0; font-size: 10px; text-align: end; margin-top: 2px; }
.wa-btns { max-width: 340px; margin-top: 3px; display: flex; flex-direction: column; gap: 3px; }
.wa-btn {
  background: #202c33; color: #53bdeb; border-radius: 8px; text-align: center;
  padding: 9px; font-size: 14px; font-weight: 500;
}
.var-token { color: var(--green); font-weight: 700; }

/* progress */
.progress { background: var(--bg2); border-radius: 99px; height: 14px; overflow: hidden; border: 1px solid var(--border); }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--green-dark), var(--green)); transition: width .5s; }
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 14px 0; }
.stat { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 18px; min-width: 110px; }
.stat .n { font-size: 22px; font-weight: 800; }
.stat .l { font-size: 12px; color: var(--muted); }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 380px; max-width: 92vw; }
.login-card .logo { text-align: center; font-size: 34px; margin-bottom: 2px; padding: 0; }
.login-card .logo-sub { text-align: center; padding: 0; }

.acct-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.acct-tab { padding: 8px 18px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); font-weight: 700; font-size: 14px; }
.acct-tab.active { background: rgba(37,211,102,.12); color: var(--green); border-color: var(--green-dark); }

.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.step { flex: 1; text-align: center; padding: 9px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 700; }
.step.active { color: var(--green); border-color: var(--green-dark); background: rgba(37,211,102,.08); }
.step.done { color: var(--text); }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: 480px; max-width: 94vw; max-height: 90vh; overflow-y: auto; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px; }
  .logo { font-size: 20px; margin: 0; }
  .logo-sub, .nav-sep { display: none; }
  .main { padding: 18px 14px; }
  .wa-preview { position: static; }
}
