/* ============================================================
   ADMIN PANEL — لوحة تحكم أحنُّ أرزاقي (تصميم عالمي حديث)
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg: #f4f5fb;
  --bg-soft: #eceef7;
  --card: #ffffff;
  --card-2: #f9fafc;
  --border: #e4e7f0;
  --border-strong: #d4d8e6;
  --text: #151a2e;
  --text-2: #5b6478;
  --text-3: #9aa2b8;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: rgba(79,70,229,0.1);
  --accent-grad: linear-gradient(135deg,#4f46e5,#7c3aed);
  --green: #16a34a;
  --green-soft: rgba(22,163,74,0.12);
  --red: #dc2626;
  --red-soft: rgba(220,38,38,0.1);
  --orange: #d97706;
  --orange-soft: rgba(217,119,6,0.12);
  --purple: #7c3aed;
  --purple-soft: rgba(124,58,237,0.12);
  --blue: #2563eb;
  --blue-soft: rgba(37,99,235,0.12);
  --sidebar-bg: #ffffff;
  --shadow-sm: 0 1px 2px rgba(21,26,46,0.05), 0 1px 3px rgba(21,26,46,0.06);
  --shadow: 0 2px 8px rgba(21,26,46,0.06), 0 12px 32px -12px rgba(21,26,46,0.14);
  --shadow-lg: 0 24px 60px rgba(21,26,46,0.22);
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.22,1,.36,1);
}

[data-theme="dark"] {
  --bg: #0b0e17;
  --bg-soft: #121627;
  --card: #141929;
  --card-2: #1a2036;
  --border: #232a45;
  --border-strong: #2f3758;
  --text: #eef0fa;
  --text-2: #a4abc8;
  --text-3: #6b7392;
  --accent: #818cf8;
  --accent-2: #a78bfa;
  --accent-soft: rgba(129,140,248,0.14);
  --green: #4ade80;
  --green-soft: rgba(74,222,128,0.14);
  --red: #f87171;
  --red-soft: rgba(248,113,113,0.14);
  --orange: #fbbf24;
  --orange-soft: rgba(251,191,36,0.14);
  --purple: #c084fc;
  --purple-soft: rgba(192,132,252,0.14);
  --blue: #60a5fa;
  --blue-soft: rgba(96,165,250,0.14);
  --sidebar-bg: #0e1220;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 2px 10px rgba(0,0,0,0.35), 0 14px 36px -14px rgba(0,0,0,0.5);
  --shadow-lg: 0 24px 70px rgba(0,0,0,0.6);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', 'Cairo', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}
button, input, select, textarea { font-family: inherit; font-size: 0.95rem; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 9px 18px;
  font-weight: 800;
  font-size: 0.86rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  white-space: nowrap;
  user-select: none;
}
.btn--primary { background: var(--accent-grad); color: #fff; box-shadow: 0 6px 18px -6px rgba(79,70,229,0.55); }
.btn--primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn--ghost { background: var(--card); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--soft { background: var(--accent-soft); color: var(--accent); }
.btn--soft:hover { filter: brightness(1.06); }
.btn--danger { background: var(--red); color: #fff; }
.btn--danger:hover { filter: brightness(1.08); }
.btn--danger-ghost { background: var(--red-soft); color: var(--red); }
.btn--danger-ghost:hover { background: var(--red); color: #fff; }
.btn--block { width: 100%; }
.btn--sm { min-height: 34px; padding: 6px 13px; font-size: 0.78rem; border-radius: 9px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; pointer-events: none; }

.icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn--danger:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.icon-btn--sm { width: 32px; height: 32px; border-radius: 9px; font-size: 0.85rem; }

/* ---------- Login ---------- */
.login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 90% -10%, rgba(79,70,229,0.13), transparent 60%),
    radial-gradient(700px 500px at 0% 110%, rgba(124,58,237,0.12), transparent 60%),
    var(--bg);
}
.login__inner {
  width: 100%;
  max-width: 940px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: up 0.55s var(--ease) both;
}
.login__brand {
  background: var(--accent-grad);
  color: #fff;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: relative;
  overflow: hidden;
}
.login__brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(500px 300px at 120% -20%, rgba(255,255,255,0.22), transparent 60%);
  pointer-events: none;
}
.login__brand-top { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.login__logo {
  width: 52px; height: 52px;
  border-radius: 15px;
  background: rgba(255,255,255,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  backdrop-filter: blur(6px);
}
.login__brand-top strong { display: block; font-size: 1.15rem; font-weight: 900; }
.login__brand-top small { opacity: 0.85; font-size: 0.68rem; letter-spacing: 0.18em; }
.login__hero { position: relative; z-index: 1; }
.login__hero h1 { font-size: 1.9rem; font-weight: 900; margin-bottom: 10px; line-height: 1.3; }
.login__hero p { opacity: 0.92; font-size: 0.9rem; line-height: 1.75; }
.login__feats { list-style: none; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.login__feats li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.84rem;
  font-weight: 700;
  backdrop-filter: blur(6px);
}
.login__form-side {
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}
.login__card h2 { font-size: 1.45rem; font-weight: 900; margin-bottom: 4px; }
.login__card-sub { font-size: 0.84rem; color: var(--text-2); margin-bottom: 26px; }
.login__back { display: inline-block; margin-top: 18px; font-size: 0.8rem; color: var(--accent); text-decoration: none; font-weight: 800; }
.login__back:hover { text-decoration: underline; }
.login__foot { position: absolute; bottom: 20px; left: 0; right: 0; text-align: center; font-size: 0.7rem; color: var(--text-3); }

/* ---------- App layout ---------- */
.app { display: flex; min-height: 100dvh; }
.sidebar {
  width: 258px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 100;
  transition: transform 0.3s var(--ease);
}
.sidebar__head { padding: 18px 18px 14px; }
.sidebar__brand { display: flex; align-items: center; gap: 11px; }
.sidebar__logo {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 6px 16px -6px rgba(79,70,229,0.5);
}
.sidebar__brand-text strong { display: block; font-size: 0.98rem; font-weight: 900; }
.sidebar__brand-text small { font-size: 0.7rem; color: var(--text-3); }
.sidebar__nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.nav-group { margin-bottom: 18px; }
.nav-group__title {
  font-size: 0.66rem;
  font-weight: 900;
  color: var(--text-3);
  letter-spacing: 0.08em;
  padding: 0 10px;
  margin-bottom: 6px;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--text-2);
  font-size: 0.87rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.18s var(--ease);
  text-align: right;
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active::before {
  content: '';
  position: absolute;
  inset-inline-start: -12px;
  inset-block: 8px;
  width: 3.5px;
  border-radius: 4px;
  background: var(--accent);
}
.nav-item__icon { font-size: 1.05rem; width: 22px; text-align: center; }
.nav-item__badge {
  margin-inline-start: auto;
  background: var(--red);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 900;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}
.sidebar__foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.sidebar__link { font-size: 0.8rem; font-weight: 800; color: var(--accent); text-decoration: none; }
.sidebar__link:hover { text-decoration: underline; }
.sidebar__ver { font-size: 0.68rem; color: var(--text-3); }
.sidebar__overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  z-index: 90;
  animation: fade 0.2s ease both;
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-inline-start: 258px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.topbar__menu { display: none; }
.topbar__title { font-weight: 900; font-size: 1rem; letter-spacing: -0.01em; white-space: nowrap; }
.topbar__search {
  flex: 1;
  max-width: 420px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 0 12px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.topbar__search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar__search svg { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.topbar__search input { flex: 1; border: none; background: transparent; color: var(--text); padding: 9px 0; outline: none; min-width: 0; }
.topbar__search kbd {
  font-size: 0.66rem;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  background: var(--bg);
}
.topbar__actions { display: flex; align-items: center; gap: 9px; }
.topbar__clock {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-2);
  direction: ltr;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
  white-space: nowrap;
}

/* ---------- Content ---------- */
.content { flex: 1; padding: 24px 26px 48px; max-width: 1200px; width: 100%; margin: 0 auto; }
.view { animation: fadeUp 0.35s var(--ease) both; }
.view__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.view__head h2 { font-size: 1.35rem; font-weight: 900; letter-spacing: -0.02em; }
.view__sub { font-size: 0.8rem; color: var(--text-2); margin-top: 2px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 18px;
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.card__head h3 { font-size: 0.98rem; font-weight: 900; letter-spacing: -0.01em; }
.card__hint { font-size: 0.72rem; color: var(--text-3); font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

/* ---------- KPI stats ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpis--sm { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 16px; }
.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.kpi__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi__icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.kpi__trend { font-size: 0.66rem; font-weight: 900; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.kpi__num { font-size: 1.6rem; font-weight: 900; letter-spacing: -0.02em; line-height: 1.15; }
.kpi__num small { font-size: 0.75rem; font-weight: 800; color: var(--text-3); }
.kpi__label { font-size: 0.74rem; color: var(--text-2); font-weight: 700; margin-top: 3px; }
.kpi__spark { position: absolute; inset-inline-start: 0; inset-inline-end: 0; bottom: 0; height: 34px; opacity: 0.5; pointer-events: none; }
.kpi--blue .kpi__icon { background: var(--blue-soft); }
.kpi--green .kpi__icon { background: var(--green-soft); }
.kpi--orange .kpi__icon { background: var(--orange-soft); }
.kpi--purple .kpi__icon { background: var(--purple-soft); }
.kpi--red .kpi__icon { background: var(--red-soft); }
.kpi--gray .kpi__icon { background: var(--bg-soft); }
.kpi--gray .kpi__num { color: var(--text-2); }
.kpi--blue .kpi__num { color: var(--blue); }
.kpi--green .kpi__num { color: var(--green); }
.kpi--orange .kpi__num { color: var(--orange); }
.kpi--purple .kpi__num { color: var(--purple); }
.kpi--red .kpi__num { color: var(--red); }
.trend--up { background: var(--green-soft); color: var(--green); }
.trend--down { background: var(--red-soft); color: var(--red); }
.trend--flat { background: var(--accent-soft); color: var(--accent); }

/* ---------- Charts ---------- */
.chart { min-height: 240px; display: flex; align-items: flex-end; }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; width: 100%; height: 230px; padding-top: 18px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-col__value { font-size: 0.62rem; font-weight: 800; color: var(--text-2); opacity: 0; transition: opacity 0.2s; }
.bar-col:hover .bar-col__value { opacity: 1; }
.bar-col__bar {
  width: min(34px, 70%);
  border-radius: 7px 7px 3px 3px;
  background: var(--accent-grad);
  min-height: 4px;
  cursor: pointer;
  transition: filter 0.2s, transform 0.2s;
  position: relative;
}
.bar-col__bar:hover { filter: brightness(1.15); }
.bar-col__bar--alt { background: linear-gradient(135deg,#60a5fa,#818cf8); opacity: 0.75; }
.bar-col__day { font-size: 0.64rem; font-weight: 700; color: var(--text-3); }
.chart-empty { flex: 1; text-align: center; color: var(--text-3); font-size: 0.84rem; padding: 60px 0; }
.donut { display: flex; align-items: center; gap: 20px; min-height: 240px; flex-wrap: wrap; justify-content: center; }
.donut__svg { position: relative; width: 170px; height: 170px; flex-shrink: 0; }
.donut__svg svg { transform: rotate(-90deg); }
.donut__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.donut__center b { font-size: 1.7rem; font-weight: 900; line-height: 1.1; }
.donut__center span { font-size: 0.66rem; color: var(--text-3); font-weight: 800; }
.donut__legend { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 140px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 0.78rem; font-weight: 800; }
.legend-item__dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-item b { margin-inline-start: auto; }

/* ---------- Toolbar / chips ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar__search {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 0 12px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.toolbar__search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.toolbar__search svg { width: 15px; height: 15px; color: var(--text-3); }
.toolbar__search input { flex: 1; border: none; background: transparent; color: var(--text); padding: 9px 0; outline: none; min-width: 0; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: 0 4px 12px -4px rgba(79,70,229,0.5); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; margin: -8px; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th {
  text-align: right;
  font-size: 0.68rem;
  font-weight: 900;
  color: var(--text-3);
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 0.84rem;
}
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--card-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.is-new { background: var(--accent-soft); }
.table tbody tr.is-new:hover { background: var(--accent-soft); }
.cell-media { display: flex; align-items: center; gap: 11px; }
.cell-media__thumb {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.cell-media__name { font-weight: 800; font-size: 0.85rem; }
.cell-media__sub { font-size: 0.72rem; color: var(--text-3); }
.cell-muted { color: var(--text-2); font-size: 0.78rem; }
.cell-strong { font-weight: 900; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-start; white-space: nowrap; }
.money { font-weight: 900; color: var(--green); }
.money--old { font-size: 0.7rem; color: var(--text-3); text-decoration: line-through; }

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 900;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.pill--green { background: var(--green-soft); color: var(--green); }
.pill--red { background: var(--red-soft); color: var(--red); }
.pill--orange { background: var(--orange-soft); color: var(--orange); }
.pill--blue { background: var(--blue-soft); color: var(--blue); }
.pill--purple { background: var(--purple-soft); color: var(--purple); }
.pill--gray { background: var(--bg-soft); color: var(--text-2); }

/* ---------- Status select ---------- */
.status-select {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 800;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 0.18s;
}
.status-select:focus { outline: none; border-color: var(--accent); }
.status-select option { font-weight: 700; }

/* ---------- Switch (toggle) ---------- */
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-strong);
  border-radius: 999px;
  transition: background 0.2s var(--ease);
}
.switch__slider::before {
  content: '';
  position: absolute;
  height: 17px; width: 17px;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.switch input:checked + .switch__slider { background: var(--accent-grad); }
.switch input:checked + .switch__slider::before { transform: translateX(-17px); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field label { font-size: 0.74rem; font-weight: 800; color: var(--text-2); }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--card-2);
  color: var(--text);
  padding: 10px 13px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  min-height: 44px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--card);
}
.field textarea { resize: vertical; min-height: 80px; }
.field__control { position: relative; }
.field__control input { padding-inline-end: 44px; }
.field__eye {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  font-size: 1.05rem;
  cursor: pointer;
  padding: 6px;
  opacity: 0.6;
  transition: opacity 0.18s;
}
.field__eye:hover { opacity: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.field--full { grid-column: 1 / -1; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; margin: 4px 0 16px; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.err { color: var(--red); font-size: 0.8rem; margin-top: 10px; font-weight: 800; }

/* ---------- Info list ---------- */
.info-list { display: flex; flex-direction: column; }
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 0.84rem;
}
.info-row:last-child { border-bottom: none; }
.info-row span { color: var(--text-2); font-weight: 700; }
.info-row b { font-weight: 900; text-align: left; }

/* ---------- Category cards ---------- */
.cat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  animation: fadeUp 0.4s var(--ease) both;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cat-card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cat-card__name { font-weight: 900; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-card__bar { height: 6px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin-bottom: 9px; }
.cat-card__bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent-grad); transition: width 0.6s var(--ease); }
.cat-card__sample {
  font-size: 0.74rem;
  color: var(--text-2);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}

/* ---------- Categories editor (إعدادات الموقع) ---------- */
.cats-editor {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
  padding: 4px 2px;
}
.cat-edit {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 8px;
  align-items: center;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 10px;
  transition: border-color 0.2s var(--ease);
}
.cat-edit.hidden-cat { opacity: 0.55; border-style: dashed; }
.cat-edit input {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  padding: 7px 9px;
  font-size: 0.8rem;
  min-width: 0;
  width: 100%;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.cat-edit input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cat-edit__emoji { width: 52px; text-align: center; font-size: 1.3rem; flex-shrink: 0; }
.cat-edit__toggle {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.18s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cat-edit__toggle:hover { border-color: var(--accent); }
.cat-edit__toggle.on { background: var(--green-soft); border-color: var(--green); }
.cat-edit__toggle.off { background: var(--red-soft); border-color: var(--red); }

/* ---------- Quick actions ---------- */
.quick { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.quick .btn { flex: 1; min-width: 130px; }

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10,12,24,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: fade 0.22s ease both;
}
.modal__box {
  width: 100%;
  max-width: 620px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 22px;
  animation: up 0.32s var(--ease) both;
  -webkit-overflow-scrolling: touch;
}
.modal__box--lg { max-width: 680px; }
.modal__box--sm { max-width: 400px; text-align: center; }
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal__head h3 { font-size: 1.08rem; font-weight: 900; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal__actions--center { justify-content: center; margin-top: 20px; }
.modal__confirm-icon {
  width: 62px; height: 62px;
  margin: 6px auto 14px;
  border-radius: 50%;
  background: var(--red-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}
.modal__box--sm h3 { font-size: 1.05rem; font-weight: 900; margin-bottom: 6px; }
.modal__confirm-msg { font-size: 0.85rem; color: var(--text-2); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  background: var(--text);
  color: var(--bg);
  font-size: 0.84rem;
  font-weight: 800;
  padding: 13px 24px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  transition: all 0.3s var(--ease);
  max-width: 90vw;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-theme="dark"] .toast { background: var(--card); color: var(--text); border: 1px solid var(--border); }

/* ---------- Empty / skeleton ---------- */
.empty { text-align: center; padding: 46px 18px; color: var(--text-3); }
.empty__icon { font-size: 2.2rem; margin-bottom: 8px; }
.empty p { font-size: 0.84rem; }
.skeleton { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
.skeleton__row { height: 54px; border-radius: 10px; background: linear-gradient(90deg, var(--bg-soft) 25%, var(--card-2) 50%, var(--bg-soft) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Animations ---------- */
@keyframes up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .login__inner { grid-template-columns: 1fr; max-width: 430px; }
  .login__brand { display: none; }
  .login__form-side { padding: 46px 30px; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  [data-theme="dark"] .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .app-main { margin-inline-start: 0; }
  .topbar__menu { display: inline-flex; }
  .topbar__site { display: none; }
  .topbar__clock { display: none; }
  .topbar__search { max-width: none; }
  .content { padding: 18px 14px 40px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .field--full { grid-column: auto; }
  .quick .btn { flex: 1 1 100%; }
  .donut { flex-direction: column; }
  .kpi__num { font-size: 1.4rem; }
}

/* RTL sidebar on desktop: sidebar is on the right */
@media (min-width: 781px) {
  .sidebar { inset-inline-start: 0; }
}
