/* الهوية الأساسية — مطابقة لتصميم abtech.sa المعتمد */

body {
  margin: 0;
  font-family: "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  color: #11243b;
  background:
    radial-gradient(circle at 13% 48%, rgba(24,184,201,.13), transparent 25%),
    radial-gradient(circle at 82% 8%, rgba(183,231,75,.08), transparent 31%),
    linear-gradient(135deg, #f8fcfc 0%, #ffffff 52%, #f4fafb 100%);
  background-attachment: fixed;
  line-height: 1.7;
  text-align: right;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .42;
  background-image:
    linear-gradient(rgba(18,59,76,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18,59,76,.045) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 45%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 45%, transparent);
}
a { color: #0c8fa7; text-decoration: none; }
a:hover { color: #087e9d; }
::selection { background: #d9f8fb; }
* { box-sizing: border-box; }

/* ===== هيكل التطبيق ===== */
.layout {
  display: grid; grid-template-columns: 272px minmax(0,1fr);
  min-height: 100vh; gap: 22px; padding: 22px;
  position: relative; z-index: 1;
}
.sidebar {
  background: rgba(255,255,255,.88); backdrop-filter: blur(16px);
  border: 1px solid rgba(195,220,228,.92); border-radius: 24px;
  color: #11243b; padding: 20px 14px;
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 22px; height: calc(100vh - 44px);
  overflow-y: auto; box-shadow: 0 35px 90px rgba(23,72,93,.13);
}
.workspace { min-width: 0; display: flex; flex-direction: column; gap: 18px; }

.nav-btn {
  border: 1px solid transparent; border-radius: 12px; padding: 10px 12px;
  display: flex; align-items: center; gap: 11px; text-align: right;
  font-weight: 800; font-size: 13.5px; font-family: inherit; cursor: pointer;
  min-height: 44px; background: rgba(248,252,252,.74); color: #53687b;
  transition: background .15s, color .15s; width: 100%;
}
.nav-btn:hover { border-color: rgba(0,194,222,.18); }
.nav-btn.active {
  background: linear-gradient(135deg,#087fb8,#12aeca); color: #fff;
  box-shadow: 0 14px 30px rgba(0,178,222,.28);
}
.nav-dot { width: 8px; height: 8px; transform: rotate(45deg); flex: 0 0 auto; background: rgba(8,166,199,.45); border-radius: 2px; }
.nav-btn.active .nav-dot { background: #fff; }
.nav-badge {
  min-width: 22px; height: 20px; border-radius: 999px; background: #d92d20; color: #fff;
  display: grid; place-items: center; padding: 0 6px; font-size: 11px; font-weight: 800; font-style: normal;
}

/* ===== مكونات مشتركة ===== */
.card {
  background: rgba(255,255,255,.93); border: 1px solid rgba(220,230,237,.9);
  border-radius: 20px; box-shadow: 0 24px 55px rgba(40,83,101,.08);
}
.card-lg {
  background: rgba(255,255,255,.93); backdrop-filter: blur(16px);
  border: 1px solid rgba(195,220,228,.92); border-radius: 24px;
  box-shadow: 0 35px 90px rgba(23,72,93,.13);
}
.btn-primary {
  border: 0; border-radius: 12px; background: linear-gradient(135deg,#087fb8,#12aeca);
  color: #fff; padding: 13px 22px; font-size: 14px; font-weight: 800;
  font-family: inherit; cursor: pointer; box-shadow: 0 13px 28px rgba(8,143,184,.23);
  transition: transform .18s;
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:disabled { opacity: .55; cursor: default; transform: none; }
.btn-secondary {
  border: 1px solid #cddce5; border-radius: 12px; background: #fff; color: #11243b;
  padding: 12px 20px; font-size: 13.5px; font-weight: 800; font-family: inherit; cursor: pointer;
}
.btn-secondary:hover { border-color: rgba(8,166,199,.42); }
.btn-pill {
  border: 1px solid #cddce5; background: #fff; color: #12243a; border-radius: 999px;
  padding: 8px 16px; font-size: 12.5px; font-weight: 800; font-family: inherit; cursor: pointer;
}
.btn-pill:hover { border-color: rgba(8,166,199,.42); }

.field { display: grid; gap: 6px; font-size: 13px; font-weight: 800; color: #34495c; }
.field input, .field select, .field textarea {
  border: 1px solid #cddce5; border-radius: 12px; padding: 12px 14px;
  font-size: 14px; font-family: inherit; color: #11243b; background: #fff; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: #12aeca; box-shadow: 0 0 0 3px rgba(18,174,202,.12);
}
.req { color: #d92d20; }

.badge {
  display: inline-flex; padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 800; white-space: nowrap;
}

.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: right; padding: 11px 14px; font-size: 12px; color: #7c8a98;
  font-weight: 800; border-bottom: 1px solid #e8eff4; white-space: nowrap;
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid #eef3f7; font-size: 13px; }
.tbl tr.rowlink { cursor: pointer; }
.tbl tr.rowlink:hover { background: #f6fbfd; }

.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }

/* ===== تجاوب — شاشات متوسطة ===== */
@media (max-width: 1080px) and (min-width: 861px) {
  .layout { grid-template-columns: 232px minmax(0,1fr); padding: 16px; gap: 14px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* ===== تجاوب — الجوال ===== */
.ab-mobilebar { display: none; }
.ab-scrim { display: none; }

@media (max-width: 860px) {
  /* الشريط العلوي الثابت */
  .ab-mobilebar {
    display: flex; position: fixed; top: 0; right: 0; left: 0; z-index: 300;
    align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 14px; min-height: 56px;
    background: rgba(255,255,255,.95); backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(195,220,228,.8);
  }
  .ab-menu-btn {
    border: 1px solid #cddce5; background: #fff; color: #11243b;
    border-radius: 12px; width: 42px; height: 40px; display: grid; place-items: center;
    font-family: inherit; cursor: pointer; font-size: 18px; line-height: 1;
  }

  /* التخطيط: عمود واحد مع مساحة للشريط العلوي */
  .layout { grid-template-columns: 1fr; padding: 70px 12px 20px; gap: 14px; }

  /* القائمة الجانبية تتحول لدرج منزلق من اليمين */
  .sidebar {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(310px, 86vw); height: 100dvh; z-index: 400;
    border-radius: 0; margin: 0;
    transform: translateX(105%); transition: transform .25s ease;
  }
  .sidebar.open { transform: none; box-shadow: -24px 0 60px rgba(7,17,31,.3); }
  .ab-scrim {
    display: block; position: fixed; inset: 0; z-index: 350;
    background: rgba(7,17,31,.45);
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .ab-scrim.show { opacity: 1; pointer-events: auto; }

  /* هيدر الصفحة: عمودي والبحث بعرض كامل */
  #ab-topbar { flex-direction: column; align-items: stretch !important; gap: 12px !important; }
  #ab-topbar > div:last-child { flex-wrap: wrap; }
  #ab-search { width: 100% !important; flex: 1 1 200px; min-width: 0; }
  #ab-topbar h1 { font-size: 22px !important; }

  /* المؤشرات والبطاقات */
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }

  /* الجداول: تمرير أفقي داخل كرتها بدل كسر الصفحة */
  .card:has(.tbl), section:has(.tbl) { overflow-x: auto; }
  .tbl { min-width: 640px; }

  /* أزرار الرأس تلتف ولا تنضغط */
  .btn-primary, .btn-secondary { padding: 12px 16px; font-size: 13px; }

  /* قائمة الجرس لا تتجاوز الشاشة */
  #ab-bell-menu { width: min(360px, calc(100vw - 40px)) !important; left: auto !important; right: -60px; }
}

@media (max-width: 420px) {
  .grid-4 { grid-template-columns: 1fr; }
}
