/* ════════════════════════════════════════════════════════════════
   MoniFi — Components V2
   مطابق لتصميم الواجهات: أزرار + chips + KPI cards + segments
   ──────────────────────────────────────────────────────────────── */

/* ═══ Brand wordmark ═══ */
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: #000;        /* أسود مطابق لخلفية اللوغو */
  color: var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -1px;
  overflow: hidden;        /* يقص الصورة عند الحواف الدائرية */
}
.brand-mark > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
}
.brand-name .it { font-style: italic; font-weight: 700; }

/* ═══ Buttons ═══ */
.btn {
  padding: 10px 18px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s, background 0.15s;
  user-select: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--y);
  color: var(--ink);
  box-shadow: 0 8px 22px -10px rgba(232,255,92,0.5);
}
.btn-primary:hover { background: var(--y2); }

.btn-ghost {
  background: transparent;
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line2);
}
.btn-outline:hover { background: rgba(255,255,255,0.04); }

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface2); }

.btn-danger {
  background: rgba(255,107,122,0.10);
  border: 1px solid rgba(255,107,122,0.30);
  color: var(--red);
}
.btn-danger:hover { background: rgba(255,107,122,0.18); }

.btn-block { width: 100%; }
.btn-lg { padding: 14px 22px; font-size: 14px; }
.btn-sm { padding: 8px 14px; font-size: 12px; }

/* Add button (yellow) */
.add-btn {
  background: var(--y); color: var(--ink);
  padding: 10px 16px; border-radius: 11px;
  font-size: 13px; font-weight: 800;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.15s;
}
.add-btn:hover { background: var(--y2); }

/* Icon button (square) */
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--text2);
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.icon-btn .dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--y);
  border: 2px solid var(--surface);
}

/* ═══ Inputs ═══ */
.field { margin-bottom: 14px; }
.field label, .field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 8px;
}
.input, .select, .textarea, .field input, .field select {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 13px;
  padding: 15px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.input:focus, .select:focus, .textarea:focus,
.field input:focus, .field select:focus {
  border-color: var(--y);
  background: var(--surface2);
  box-shadow: 0 0 0 3px rgba(232, 255, 92, 0.18);
}
.input::placeholder, .field input::placeholder {
  color: var(--text3);
  font-weight: 500;
}
.textarea { min-height: 90px; resize: vertical; }

.input-wrap { position: relative; }
.input-wrap .icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
}
[dir="ltr"] .input-wrap .icon { right: auto; left: 16px; }
.input-wrap .with-icon { padding-right: 48px; }
[dir="ltr"] .input-wrap .with-icon { padding-right: 18px; padding-left: 48px; }

.input-wrap .toggle-pw {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text3);
  background: transparent;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.15s;
}
[dir="ltr"] .input-wrap .toggle-pw { left: auto; right: 14px; }
.input-wrap .toggle-pw:hover { color: var(--text); }

.field .hint {
  font-size: 12px;
  color: var(--text3);
  margin-top: 6px;
  line-height: 1.5;
}

/* Checkbox */
.checkbox {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 6px 0 22px;
  cursor: pointer;
}
.checkbox input { display: none; }
.checkbox .box {
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--line2);
  background: var(--surface);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.15s;
}
.checkbox input:checked + .box {
  background: var(--y);
  border-color: var(--y);
}
.checkbox input:checked + .box::after {
  content: "";
  width: 8px; height: 5px;
  border-left: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(-45deg) translate(1px, -1px);
}
.checkbox span:not(.box) {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
}
.checkbox span a { color: var(--y); font-weight: 700; }

/* ═══ Chips ═══ */
.chip {
  background: var(--bg2);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 12px;
  color: var(--text2);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--line2); color: var(--text); }
.chip.on, .chip.active {
  background: var(--y);
  color: var(--ink);
  border-color: var(--y);
}

/* ═══ Segments ═══ */
.seg {
  display: inline-flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 4px;
}
.seg button {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text3);
  transition: background 0.12s, color 0.12s;
}
.seg button.on, .seg button.active {
  background: var(--y);
  color: var(--ink);
}
.seg button:not(.on):not(.active):hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

/* Tabs (full width) */
.tabs {
  display: flex; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 4px;
}
.tabs button {
  flex: 1;
  padding: 11px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text3);
  transition: background 0.15s, color 0.15s;
}
.tabs button.on { background: var(--y); color: var(--ink); }
.tabs button:not(.on):hover { color: var(--text); background: rgba(255,255,255,0.04); }

/* ═══ Cards ═══ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.card-head h3 { font-size: 17px; font-weight: 800; letter-spacing: -0.4px; }
.card-head .meta { font-size: 12px; color: var(--text3); }
.card-head .meta .num { color: var(--text); font-weight: 700; }

/* ═══ KPI cards ═══ */
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.kpi.hero {
  background: var(--y);
  color: var(--ink);
  border: 0;
}
.kpi .lbl {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  opacity: 0.55;
}
.kpi .v {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1.5px;
  margin-top: 8px;
  line-height: 1;
}
.kpi.hero .v { font-size: 46px; }
.kpi .delta {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  direction: ltr;
}
.kpi .delta .pill {
  background: rgba(43,211,124,0.16);
  color: var(--green);
  padding: 3px 9px;
  border-radius: 99px;
}
.kpi .delta .pill.dn {
  background: rgba(255,107,122,0.16);
  color: var(--red);
}
.kpi.hero .delta .pill { background: var(--ink); color: var(--y); }
.kpi .ago { color: var(--text3); font-size: 12px; }
.kpi.hero .ago { color: var(--ink); opacity: 0.55; }
.kpi .spark {
  position: absolute;
  left: 18px;
  bottom: 18px;
  width: 120px;
  height: 36px;
}
[dir="rtl"] .kpi .spark { left: auto; right: 18px; }

/* ═══ Status pills ═══ */
.stt {
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  display: inline-block;
}
.stt.ok { background: rgba(43,211,124,0.15); color: var(--green); }
.stt.wt { background: rgba(255,176,82,0.15); color: var(--orange); }
.stt.cn { background: rgba(155,123,255,0.15); color: var(--purple); }
.stt.cl { background: rgba(255,107,122,0.15); color: var(--red); }
.stt.nw { background: rgba(77,94,230,0.15); color: #4D5EE6; }

/* ═══ Toggle ═══ */
.toggle {
  width: 42px; height: 24px;
  border-radius: 99px;
  background: var(--surface3);
  border: 0;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
[dir="ltr"] .toggle::after { right: auto; left: 3px; }
.toggle.on { background: var(--y); }
.toggle.on::after {
  transform: translateX(-18px);
  background: var(--ink);
}
[dir="ltr"] .toggle.on::after { transform: translateX(18px); }

/* ═══ Spinner ═══ */
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid var(--line2);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ Toast ═══ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line2);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  z-index: 9999;
  animation: toast-in 0.2s cubic-bezier(.18,.85,.25,1);
}
.toast.error {
  background: rgba(255,107,122,0.18);
  border-color: var(--red);
}
.toast.success {
  background: rgba(43,211,124,0.18);
  border-color: var(--green);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ═══ Empty state ═══ */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.empty-state .icon-circle {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(232,255,92,0.10);
  color: var(--y);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.empty-state h3 { font-size: 16px; margin-bottom: 6px; }
.empty-state p { color: var(--text3); font-size: 13px; }

/* ═══ Modal ═══ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.18s ease;
}
.modal-backdrop.show { display: flex; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in 0.2s cubic-bezier(.18,.85,.25,1);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.modal h2 { font-size: 22px; font-weight: 900; letter-spacing: -0.5px; margin-bottom: 6px; }
.modal .actions {
  display: flex; gap: 8px;
  margin-top: 20px;
}
.modal .actions .btn { flex: 1; }
