:root {
  --bg: #f3f6fa;
  --bg-soft: #e8eef6;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --navy: #07111f;
  --navy-2: #0b1324;
  --sky: #2aa8e8;
  --green: #1bb89a;
  --green-2: #2fcf99;
  --warn: #d97706;
  --danger: #dc2626;
  --chip: #f1f5f9;
  --shadow: 0 10px 30px rgba(7, 17, 31, .08);
  --radius: 16px;
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", Tahoma, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
a { color: inherit; }
button, input, select, textarea { font-family: inherit; }
.muted { color: var(--muted); }

/* Login */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(47, 207, 153, .18), transparent 50%),
    radial-gradient(900px 400px at 0% 100%, rgba(42, 168, 232, .16), transparent 50%),
    #07111f;
  color: #fff;
}
.login-card {
  width: min(420px, calc(100vw - 32px));
  background: #fff;
  color: var(--ink);
  border-radius: 24px;
  padding: 36px 32px 32px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.login-card h1 { margin: 8px 0 4px; font-size: 1.45rem; }
.login-mark {
  width: 48px; height: 48px; border-radius: 14px;
  background:
    radial-gradient(circle at 30% 30%, #fff 0 6px, transparent 7px),
    linear-gradient(135deg, var(--green-2), var(--sky));
}
.login-form { display: grid; gap: 14px; margin-top: 22px; }
.login-form label, .field { display: grid; gap: 6px; font-size: .92rem; font-weight: 600; }
.login-form input, .field input, .field select, .field textarea,
input[type=text], input[type=email], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 180px; resize: vertical; line-height: 1.7; }
.btn {
  appearance: none; border: 0; cursor: pointer;
  border-radius: 999px; padding: 10px 18px; font-weight: 700;
  background: var(--chip); color: var(--ink);
}
.btn.primary { background: var(--navy); color: #fff; }
.btn.accent { background: var(--green); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.danger { background: #fef2f2; color: var(--danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.alert { border-radius: 12px; padding: 10px 12px; margin: 12px 0; }
.alert.error { background: #fef2f2; color: #991b1b; }
.alert.warn { background: #fffbeb; color: #92400e; }
.alert.info { background: #f0f9ff; color: #075985; }
.alert.ok { background: #ecfdf5; color: #065f46; }

/* App shell */
.app-body { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--navy);
  color: #e2e8f0;
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 24px;
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand strong { display: block; color: #fff; }
.brand small { color: #94a3b8; }
.mark {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 40px;
  background:
    radial-gradient(circle at 30% 30%, #fff 0 5px, transparent 6px),
    linear-gradient(135deg, var(--green-2), var(--sky));
}
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a {
  text-decoration: none; padding: 10px 12px; border-radius: 12px; color: #cbd5e1;
}
.sidebar nav a:hover, .sidebar nav a.active { background: #132033; color: #fff; }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; font-size: 12px; color: #94a3b8; }
.logout { color: #fda4af; text-decoration: none; }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px 8px; gap: 16px;
}
.topbar h2 { margin: 0; font-size: 1.25rem; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.view { padding: 8px 28px 40px; }

/* Wizard */
.wizard { display: grid; gap: 18px; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; }
.step-pill {
  padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13px;
}
.step-pill.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card h3 { margin: 0 0 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .check {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--chip); border-radius: 999px; padding: 7px 12px;
  border: 1px solid transparent; cursor: pointer; font-size: 13px;
}
.check input { accent-color: var(--green); }
.pack {
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; background: #fff;
}
.pack:hover { border-color: var(--sky); }
.pack b { display: block; margin-bottom: 4px; }
.cost-box {
  background: linear-gradient(135deg, #07111f, #143047);
  color: #fff; border-radius: 18px; padding: 18px 20px;
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
}
.cost-box .amt { font-size: 1.6rem; font-weight: 700; }
.cost-box small { color: #cbd5e1; }

/* Table */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input, .filters select { width: auto; min-width: 140px; background: #fff; }
.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
table.leads { width: 100%; border-collapse: collapse; min-width: 980px; }
table.leads th, table.leads td {
  padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle;
}
table.leads th { font-size: 12px; color: var(--muted); background: #f8fafc; position: sticky; top: 0; }
table.leads tr:hover td { background: #f8fafc; }
.pill {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 3px 9px; font-size: 12px; font-weight: 600; background: var(--chip);
}
.pill.new { background: #e0f2fe; color: #075985; }
.pill.shortlisted { background: #ede9fe; color: #5b21b6; }
.pill.enriched, .pill.ready { background: #dcfce7; color: #166534; }
.pill.emailed { background: #dbeafe; color: #1e40af; }
.pill.replied { background: #ccfbf1; color: #0f766e; }
.pill.not_interested, .pill.excluded { background: #fee2e2; color: #991b1b; }
.pill.unsubscribed { background: #f1f5f9; color: #475569; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #94a3b8; }
.dot.valid { background: #16a34a; }
.dot.unverified, .dot.unknown { background: #f59e0b; }
.dot.invalid { background: #dc2626; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; color: var(--muted); }

/* Drawer + modal */
.drawer[hidden], .modal[hidden] { display: none !important; }
.drawer, .modal {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(7,17,31,.45);
  display: grid; justify-items: end;
}
.modal { justify-items: center; align-items: center; }
.drawer-card, .modal-card {
  background: #fff; height: 100%; width: min(520px, 100vw);
  overflow: auto; padding: 22px; box-shadow: -20px 0 60px rgba(0,0,0,.2);
}
html[dir="rtl"] .drawer-card { box-shadow: 20px 0 60px rgba(0,0,0,.2); }
.modal-card { height: auto; max-height: 90vh; width: min(640px, calc(100vw - 24px)); border-radius: 20px; box-shadow: var(--shadow); }
.person-head { display: flex; gap: 12px; align-items: center; }
.avatar { width: 56px; height: 56px; border-radius: 16px; object-fit: cover; background: var(--bg-soft); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; font-size: 14px; }
.kv b { color: var(--muted); font-weight: 500; }
.hist { border-inline-start: 2px solid var(--line); padding-inline-start: 12px; margin: 8px 0; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 999px; z-index: 60;
}
.usage-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.stat .n { font-size: 1.5rem; font-weight: 700; }
@media (max-width: 980px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar nav { display: flex; }
  .sidebar-foot { margin: 0; margin-inline-start: auto; }
  .grid-2, .grid-3, .usage-grid { grid-template-columns: 1fr; }
  .view, .topbar { padding-inline: 16px; }
}

.lang-switch { display: inline-flex; gap: 4px; background: #0f1a2c; border-radius: 999px; padding: 3px; }
.login-lang { margin-top: 18px; background: #e2e8f0; }
.lang-btn {
  appearance: none; border: 0; background: transparent; color: #94a3b8;
  font: 600 12px/1 inherit; padding: 6px 10px; border-radius: 999px; cursor: pointer;
  text-decoration: none;
}
.login-lang .lang-btn { color: #475569; }
.lang-btn.on, .lang-btn[aria-pressed="true"] { background: #fff; color: #0b1324; }
