:root {
  --plum: #4a1d3a;
  --plum-2: #6b2c55;
  --rose: #b5487a;
  --rose-soft: #f4e3eb;
  --blush: #fbf1f5;
  --bg: #faf7f5;
  --card: #ffffff;
  --ink: #2a1a24;
  --muted: #7d6874;
  --line: #ecdfe5;
  --gold: #a8833a;
  --ok: #2f7d62;
  --ok-soft: #e2f2ea;
  --warn: #b7791f;
  --warn-soft: #fbf0dc;
  --bad: #b33a3a;
  --bad-soft: #f8e3e3;
  --info: #3d5a99;
  --info-soft: #e5ebf7;
  --wa: #1f9d55;
  --ig: #c13584;
  --fb: #1877f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(74, 29, 58, .06), 0 4px 16px rgba(74, 29, 58, .06);
  --font: 'Tajawal', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--rose); }
h1, h2, h3 { margin: 0; line-height: 1.3; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hide { display: none !important; }

/* ── أزرار وحقول ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 16px;
  font-weight: 700; cursor: pointer; background: var(--plum); color: #fff;
  transition: background .15s, transform .05s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--plum-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.rose { background: var(--rose); }
.btn.rose:hover { background: #9e3b69; }
.btn.ghost { background: transparent; color: var(--plum); border-color: var(--line); }
.btn.ghost:hover { background: var(--blush); }
.btn.ok { background: var(--ok); }
.btn.bad { background: transparent; color: var(--bad); border-color: #ecc8c8; }
.btn.bad:hover { background: var(--bad-soft); }
.btn.wa { background: var(--wa); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn { background: none; border: 0; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--muted); font-size: 18px; line-height: 1; }
.icon-btn:hover { background: var(--blush); color: var(--plum); }

label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.inp, select.inp, textarea.inp {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.inp:focus { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(181, 72, 122, .14); }
textarea.inp { resize: vertical; min-height: 70px; }
.inp[type=tel], .inp.ltr { direction: ltr; text-align: right; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--rose); }

/* ── شارات ── */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.st-pending { background: var(--warn-soft); color: var(--warn); }
.st-confirmed { background: var(--info-soft); color: var(--info); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.st-cancelled { background: #eee; color: #777; }
.st-noshow { background: var(--bad-soft); color: var(--bad); }
.ch { color: #fff; }
.ch-whatsapp { background: var(--wa); }
.ch-instagram { background: linear-gradient(45deg, #f09433, #dc2743, #bc1888); }
.ch-facebook { background: var(--fb); }
.ch-online { background: var(--rose); }
.ch-walkin, .ch-phone { background: #8a7a84; }

/* ── بطاقات ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card h3 { font-size: 16px; margin-bottom: 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .l { font-size: 13px; color: var(--muted); font-weight: 700; }
.kpi .v { font-size: 24px; font-weight: 800; margin-top: 2px; color: var(--plum); }
.kpi .v small { font-size: 13px; font-weight: 700; color: var(--muted); }
.kpi.gold .v { color: var(--gold); }
.kpi.ok .v { color: var(--ok); }
.kpi.bad .v { color: var(--bad); }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: right; font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--blush); }
.table-wrap { overflow-x: auto; }

.empty { text-align: center; color: var(--muted); padding: 36px 12px; }
.empty .e { font-size: 34px; margin-bottom: 6px; }

/* ── نوافذ ── */
.modal-bg { position: fixed; inset: 0; background: rgba(42, 26, 36, .45); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 12px; overflow-y: auto; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.2); animation: pop .18s; }
.modal.wide { max-width: 760px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h2 { font-size: 18px; }
.modal-b { padding: 18px 20px; }
.modal-f { display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); background: #fdfbfc; border-radius: 0 0 18px 18px; }
@media (max-width: 640px) {
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; overflow-y: auto; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }

.toast { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 80; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: pop .2s; max-width: 92vw; }
.toast.err { background: var(--bad); }

.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 12px; cursor: pointer; font-weight: 700; font-variant-numeric: tabular-nums; }
.slot:hover { border-color: var(--rose); }
.slot.on { background: var(--rose); border-color: var(--rose); color: #fff; }

.spinner { width: 22px; height: 22px; border: 3px solid var(--rose-soft); border-top-color: var(--rose); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
