/* ===== لوحة تحكم أسطى — أنماط مشتركة (مبنية على هوية أسطى) ===== */

:root {
  --navy: #231F74;
  --deep-navy: #1E1B3A;
  --accent: #F2811C;
  --accent-hover: #E0740F;
  --gold: #FFCA3C;
  --lavender: #B8B4E0;

  --bg: #FBF7EF;
  --surface: #FFFFFF;
  --border: #ECE7F5;
  --hover: #F7F2E9;
  --input: #FFFFFF;

  --text: #1E1B3A;
  --body: #403C5C;
  --muted: #8B87A0;
  --price: #231F74;
  --info-fg: #231F74;

  --success: #2FA86B;
  --pending: #C98A1F;
  --error: #E14B4B;

  --cellpad: 14px 16px;
  --radius-card: 18px;
  --radius-md: 14px;
  --radius-chip: 12px;
}

[data-theme="dark"] {
  --bg: #1E1B3A;
  --surface: #262250;
  --border: #37326B;
  --hover: #2C2760;
  --input: #1E1B3A;
  --text: #FFFFFF;
  --body: #C9C6E4;
  --muted: #8B87A0;
  --price: #FFCA3C;
  --info-fg: #B8B4E0;
}

[data-density="compact"] {
  --cellpad: 8px 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Noto Sans Arabic', 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }

/* ===== تخطيط عام ===== */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ===== السايدبار ===== */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  padding: 20px 0 16px;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 22px 20px; }
.sidebar-brand .logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--gold); color: var(--deep-navy);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900;
}
.sidebar-brand .title { font-size: 17px; font-weight: 900; color: #fff; }
.sidebar-brand .subtitle { font-size: 11px; font-weight: 700; color: var(--lavender); }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--lavender);
}
.nav-item:hover { filter: brightness(1.15); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item .material-icons-round { font-size: 20px; }
.nav-item .label { font-size: 13.5px; font-weight: 700; flex: 1; }
.nav-item .badge {
  background: var(--gold); color: var(--deep-navy);
  font-size: 11px; font-weight: 800; border-radius: 10px; padding: 1px 8px;
}

.sidebar-user {
  margin: 8px 12px 0; padding: 12px; border-radius: 14px;
  background: rgba(255,255,255,0.06); display: flex; align-items: center; gap: 10px;
}
.sidebar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold); color: var(--deep-navy);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 900;
}
.sidebar-user .name { font-size: 12.5px; font-weight: 800; color: #fff; }
.sidebar-user .role { font-size: 10.5px; font-weight: 700; color: var(--lavender); }
.sidebar-user button { background: none; border: none; color: var(--lavender); cursor: pointer; padding: 0; }

/* ===== المنطقة الرئيسية ===== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 64px; flex-shrink: 0; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
}
.topbar .page-title { font-size: 18px; font-weight: 900; }
.topbar .spacer { flex: 1; }
.topbar .searchbox {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 14px; width: 280px;
}
.topbar .searchbox input {
  border: none; background: transparent; outline: none; flex: 1;
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--text);
}
.topbar .searchbox input::placeholder { color: var(--muted); }
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid var(--border); background: transparent;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--body);
}
.icon-btn:hover { background: var(--hover); }
.icon-btn .dot {
  position: absolute; top: 8px; inset-inline-start: 9px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--surface);
}

.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ===== بطاقات ===== */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 20px;
}
.grid { display: grid; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* ===== رأس القسم ===== */
.section-head { display: flex; align-items: center; gap: 16px; }
.section-head .titles { flex: 1; }
.section-head h1 { font-size: 20px; font-weight: 900; margin: 0; }
.section-head .sub { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-top: 2px; }

/* ===== أزرار ===== */
.btn {
  border: none; border-radius: var(--radius-md); padding: 11px 20px;
  font-family: inherit; font-size: 13px; font-weight: 800; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: rgba(225,75,75,0.12); color: var(--error); }
.btn-block { width: 100%; justify-content: center; }
.btn .material-icons-round { font-size: 18px; }

/* ===== حبوب الحالة ===== */
.pill {
  display: inline-block; font-size: 11px; font-weight: 800;
  padding: 3px 10px; border-radius: 10px; white-space: nowrap;
}
.pill.success { background: rgba(47,168,107,0.14); color: var(--success); }
.pill.pending { background: rgba(201,138,31,0.14); color: var(--pending); }
.pill.error { background: rgba(225,75,75,0.12); color: var(--error); }
.pill.info { background: rgba(35,31,116,0.10); color: var(--info-fg); }
.pill.muted { background: rgba(139,135,160,0.14); color: var(--muted); }
.pill.navy { background: var(--navy); color: #fff; }

/* ===== رقائق الفلترة ===== */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 12.5px; font-weight: 700; padding: 7px 16px; border-radius: 12px;
  cursor: pointer; background: var(--surface); color: var(--body); border: 1px solid var(--border);
}
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ===== جدول بيانات ===== */
.data-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.grid-row { display: grid; align-items: center; }
.data-table[data-sec="customers"] .grid-row { grid-template-columns: 2fr 1.1fr 0.8fr 1fr 0.9fr 0.9fr; }
.data-table[data-sec="craftsmen"] .grid-row { grid-template-columns: 2fr 1fr 0.8fr 0.8fr 1fr 1fr; }
.data-table[data-sec="bookings"] .grid-row { grid-template-columns: 0.9fr 1.6fr 1.6fr 1.2fr 0.9fr 1fr 0.9fr; }
.data-table[data-sec="payments"] .grid-row { grid-template-columns: 1fr 1fr 1.8fr 1fr 1fr 0.9fr; }
.data-table[data-sec="disputes"] .grid-row { grid-template-columns: 0.9fr 0.9fr 1.8fr 1.5fr 0.9fr 1fr; }
.data-table[data-sec="reviews"] .grid-row { grid-template-columns: 0.8fr 1.4fr 1.4fr 0.7fr 1.8fr 0.9fr; }
.grid-head { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--hover); }
.grid-head .col { font-size: 11.5px; font-weight: 800; color: var(--muted); }
.grid-body-row { padding: var(--cellpad); border-bottom: 1px solid var(--border); cursor: pointer; }
.grid-body-row:hover { background: var(--hover); }
.cell { min-width: 0; padding-inline-start: 8px; }
.cell-text { font-size: 12.5px; font-weight: 600; color: var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-text.strong { font-weight: 800; color: var(--text); }
.cell-text.price { font-weight: 900; color: var(--price); }
.cell-text.stars { font-weight: 800; color: var(--pending); }
.cell-sub { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 900; color: var(--deep-navy);
}

/* ألوان أفاتار دورية */
.av-0 { background: var(--gold); }
.av-1 { background: var(--lavender); }
.av-2 { background: var(--accent); color: #fff !important; }
.av-3 { background: #7FD4C1; }
.av-4 { background: #F4A9C0; }

/* ترقيم الصفحات */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.pager .count { font-size: 12px; font-weight: 700; color: var(--muted); }
.pager .pages { display: flex; gap: 6px; }
.pager .pg {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; border: 1px solid var(--border); color: var(--body); cursor: pointer;
}
.pager .pg.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.pager .pg.disabled { opacity: 0.4; pointer-events: none; }

/* ===== الدرج الجانبي ===== */
.drawer-scrim { position: fixed; inset: 0; background: rgba(30,27,58,0.45); z-index: 40; }
.drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: 390px;
  background: var(--surface); z-index: 41; display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(35,31,116,0.12);
}
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.drawer-head .title { font-size: 16px; font-weight: 900; }
.drawer-head .sub { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.drawer-head .close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 20px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-field { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.drawer-field .k { font-size: 12.5px; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.drawer-field .v { font-size: 13px; font-weight: 800; text-align: start; }
.drawer-actions { padding: 18px 22px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.drawer-actions .btn { padding: 12px 0; justify-content: center; }

/* ===== نماذج ===== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--body); }
.field input, .field textarea, .field select {
  border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  background: var(--input); color: var(--text); outline: none;
}
.field textarea { min-height: 80px; resize: vertical; font-weight: 600; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }

/* مفتاح تبديل */
.toggle {
  width: 46px; height: 26px; border-radius: 13px; position: relative;
  cursor: pointer; border: none; background: var(--border); flex-shrink: 0;
}
.toggle.on { background: var(--success); }
.toggle .knob {
  position: absolute; top: 3px; inset-inline-end: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: inset-inline-start 0.15s ease;
}
.toggle.on .knob { inset-inline-end: auto; inset-inline-start: 3px; }

/* ===== شاشة تسجيل الدخول ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 32px; }
.login-card .brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 24px; }
.login-card .brand .logo {
  width: 64px; height: 64px; border-radius: 20px; background: var(--navy); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 900;
}
.login-card .brand h1 { font-size: 20px; font-weight: 900; margin: 0; }
.login-card .brand p { font-size: 12.5px; font-weight: 700; color: var(--muted); margin: 0; }
.login-error { background: rgba(225,75,75,0.10); color: var(--error); font-size: 12.5px; font-weight: 700; border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }
.login-hint { font-size: 11.5px; font-weight: 700; color: var(--muted); text-align: center; margin-top: 16px; line-height: 1.7; }

/* ===== حالة فارغة / قيد الإنشاء ===== */
.placeholder-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 64px 24px; text-align: center; color: var(--muted);
}
.placeholder-box .material-icons-round { font-size: 44px; color: var(--lavender); }
.placeholder-box .t { font-size: 15px; font-weight: 800; color: var(--text); }
.placeholder-box .s { font-size: 12.5px; font-weight: 700; }

/* ===== لوحة القيادة ===== */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-card { display: flex; flex-direction: column; gap: 10px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon { width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center; justify-content: center; }
.stat-icon .material-icons-round { font-size: 21px; }
.stat-delta { font-size: 11.5px; font-weight: 800; }
.stat-value { font-size: 26px; font-weight: 900; }
.stat-label { font-size: 12.5px; font-weight: 700; color: var(--muted); }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head .h { font-size: 15px; font-weight: 800; }
.card-head .link { font-size: 12px; font-weight: 800; color: var(--accent); cursor: pointer; }

.bars { display: flex; align-items: flex-end; gap: 14px; height: 160px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; border-radius: 8px 8px 4px 4px; background: rgba(35,31,116,0.18); min-height: 4px; }
.bar.hot { background: var(--accent); }
.bar-label { font-size: 11px; font-weight: 700; color: var(--muted); }

.cat-item { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.cat-item .row { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; }
.cat-item .row .pct { color: var(--muted); }
.cat-track { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.cat-fill { height: 100%; border-radius: 4px; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item .avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 900; color: var(--deep-navy); flex-shrink: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .s { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .amount { font-size: 13px; font-weight: 900; color: var(--price); }

.verify-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; }
.verify-card .head { display: flex; align-items: center; gap: 10px; }
.verify-card .actions { display: flex; gap: 8px; }
.verify-card .actions button { flex: 1; border-radius: 10px; padding: 7px 0; font-size: 11.5px; font-weight: 800; font-family: inherit; cursor: pointer; border: none; }
.verify-card .actions .approve { background: var(--accent); color: #fff; }
.verify-card .actions .reject { background: transparent; color: var(--error); border: 1px solid var(--border); }

/* ===== التصنيفات ===== */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.category-card { display: flex; flex-direction: column; gap: 12px; }
.category-card .cat-icon { width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; }
.category-card .cat-icon .material-icons-round { font-size: 26px; color: var(--navy); }
.category-card .cat-name { font-size: 14px; font-weight: 800; }
.category-card .cat-meta { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.category-card .cat-foot { display: flex; align-items: center; justify-content: space-between; }
.category-card .cat-foot .edit { font-size: 12px; font-weight: 800; color: var(--accent); cursor: pointer; background: none; border: none; padding: 0; font-family: inherit; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ===== الإشعارات ===== */
.audience-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.audience-chips label { cursor: pointer; }
.audience-chips input { display: none; }
.audience-chips .opt { font-size: 12px; font-weight: 700; padding: 6px 14px; border-radius: 12px; border: 1px solid var(--border); color: var(--body); display: inline-block; }
.audience-chips input:checked + .opt { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===== الإعدادات ===== */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.setting-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.setting-row .t { font-size: 13px; font-weight: 800; }
.setting-row .s { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.setting-row .val { border: 1px solid var(--border); border-radius: 12px; padding: 8px 14px; font-size: 15px; font-weight: 900; color: var(--price); background: var(--input); width: 110px; text-align: center; font-family: inherit; }
.admin-row { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.admin-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.switch { position: relative; display: inline-block; cursor: pointer; flex-shrink: 0; }
.switch input { display: none; }
.switch .track { width: 46px; height: 26px; border-radius: 13px; background: var(--border); position: relative; display: inline-block; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-end: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { inset-inline-end: auto; inset-inline-start: 3px; }
.lang-toggle { display: flex; gap: 6px; }
.lang-toggle label { cursor: pointer; }
.lang-toggle input { display: none; }
.lang-toggle .opt { font-size: 12px; font-weight: 800; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--border); color: var(--body); display: inline-block; }
.lang-toggle input:checked + .opt { background: var(--navy); color: #fff; border-color: var(--navy); }

.helpers-hidden { display: none; }
