@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --border: #e3e6ee;
  --text: #141826;
  --muted: #5d6478;
  --faint: #8a90a2;
  --brand: #5b4cf0;
  --brand-2: #7c6ff7;
  --brand-soft: #eeecfe;
  --accent: #0fb38a;
  --accent-soft: #e3f7f1;
  --warn: #c77700;
  --warn-soft: #fff4e0;
  --danger: #d4334a;
  --danger-soft: #fdecef;
  --wa: #1fa855;
  --ms: #0a7cff;
  --ig: #d62976;
  --sim: #6b7280;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 24, 38, .05), 0 4px 16px rgba(20, 24, 38, .06);
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; }
img, svg { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
[dir="ltr"], .ltr { direction: ltr; unicode-bidi: isolate; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  background: var(--brand); color: #fff; transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--brand-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--accent); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.lg { padding: 13px 24px; font-size: 16px; border-radius: 10px; }

/* forms */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12.5px; color: var(--faint); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=datetime-local], select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--text);
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; cursor: pointer; margin: 0 0 0 16px; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

/* toggle switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd3de; border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; top: 3px; right: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(-20px); }

/* cards, badges */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.ok { background: var(--accent-soft); color: #0a8466; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.ch-dot { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; flex: none; }
.ch-dot svg { width: 13px; height: 13px; }
.ch-whatsapp { background: var(--wa); }
.ch-wa_web { background: #128c7e; box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.ch-messenger { background: var(--ms); }
.ch-instagram { background: linear-gradient(45deg, #f9a825, #d62976 55%, #7b3fe4); }
.ch-simulator { background: var(--sim); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: right; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* modal + toast */
.modal-back { position: fixed; inset: 0; background: rgba(15, 18, 30, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal header h3 { margin: 0; font-size: 17px; }
.modal .body { padding: 20px; }
.modal footer { display: flex; gap: 8px; justify-content: flex-start; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
#toasts { position: fixed; bottom: 20px; left: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #1c2030; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); max-width: 360px; animation: pop .2s ease-out; }
.toast.error { background: var(--danger); }
.toast.warn { background: var(--warn); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

.empty { text-align: center; color: var(--faint); padding: 40px 16px; }
.empty svg { margin: 0 auto 12px; opacity: .5; }
