/* لوحة إدارة مقاضي — بسيطة، عربية، بلا مكتبات خارجية */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --brand-soft: #ccfbf1;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --good: #15803d;
  --good-soft: #dcfce7;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif; font-size: 15px; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 700; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
p { margin: 0 0 10px; }

/* ---------- التخطيط ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: #0b3b38; color: #d1fae5; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .logo { font-size: 22px; font-weight: 800; color: #fff; margin: 4px 8px 18px; letter-spacing: .5px; }
.side .logo small { display: block; font-size: 12px; font-weight: 400; color: #99f6e4; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #d1fae5; margin-bottom: 4px; }
.side nav a:hover { background: rgba(255,255,255,.08); }
.side nav a.active { background: #14b8a6; color: #042f2e; font-weight: 700; }
.side .section { font-size: 11px; color: #5eead4; margin: 14px 12px 6px; text-transform: uppercase; letter-spacing: 1px; }
.side .user { margin-top: 18px; padding: 12px; border-top: 1px solid rgba(255,255,255,.12); font-size: 13px; color: #99f6e4; }
.side .user button { margin-top: 8px; width: 100%; }
.main { padding: 24px 28px; max-width: 1400px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- البطاقات والجداول ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 28px; font-weight: 800; color: var(--brand); }
.stat .l { color: var(--muted); font-size: 13px; }
.stat.warn .n { color: var(--warn); }
.stat.bad .n { color: var(--bad); }

table.grid { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
table.grid th { background: #f3f4f6; font-size: 13px; color: var(--muted); font-weight: 700; white-space: nowrap; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: #fafafa; }
table.grid td.num, table.grid th.num { text-align: left; direction: ltr; font-variant-numeric: tabular-nums; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f9fafb; }
.thumb.empty { display: inline-flex; align-items: center; justify-content: center; color: #9ca3af; font-size: 11px; }

/* ---------- الشارات ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #f3f4f6; color: var(--muted); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

/* ---------- النماذج ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
/* حقول بدون نوع (نص) وحقول التاريخ بنفس الشكل */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input:not([type]), select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 9px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #99f6e4; border-color: var(--brand); }
input.big { font-size: 22px; padding: 12px 14px; font-weight: 700; direction: ltr; text-align: right; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }
.row.tight { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.field { margin-bottom: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.check input { width: 18px; height: 18px; }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer; background: var(--brand); color: var(--brand-ink); }
button:hover, .btn:hover { filter: brightness(1.05); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.secondary, .btn.secondary { background: #fff; color: var(--ink); border-color: #d1d5db; }
button.ghost { background: transparent; color: var(--brand); border-color: transparent; padding: 6px 10px; }
button.danger { background: var(--bad); }
button.small, .btn.small { padding: 5px 10px; font-size: 13px; }
button.good { background: var(--good); }

/* ---------- التنبيهات ---------- */
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.alert.ok { background: var(--good-soft); color: var(--good); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.info { background: #e0f2fe; color: #075985; }
.muted { color: var(--muted); font-size: 13px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- نافذة منبثقة ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow: auto; }
.modal { background: #fff; border-radius: 14px; width: min(760px, 100%); padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal .foot { display: flex; justify-content: flex-start; gap: 8px; margin-top: 14px; }

/* ---------- صفحة الدخول ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #0b3b38, #0f766e); padding: 20px; }
.login { background: #fff; border-radius: 16px; padding: 28px 26px; width: min(400px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login h1 { font-size: 24px; margin-bottom: 4px; }
.login .sub { color: var(--muted); margin-bottom: 18px; font-size: 14px; }
.login button { width: 100%; margin-top: 8px; padding: 11px; }

/* ---------- الإدخال السريع ---------- */
.quick { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
.quick .preview { background: #f9fafb; border: 1px dashed #d1d5db; border-radius: 12px; min-height: 220px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.quick .preview img { max-width: 100%; max-height: 260px; }
.kbd { font-family: monospace; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 6px; padding: 1px 6px; font-size: 12px; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .main { padding: 16px; }
  .quick { grid-template-columns: 1fr; }
}

/* المال: تنبيه تحذيري ونصوص ملوّنة داخل الجداول */
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.good { color: var(--good); }
.bad { color: var(--bad); }
/* الأزرار الملوّنة نصها أبيض دائماً (لا يغلبه لون النص أعلاه فيختفي النص على الخلفية الخضراء) */
button.good, button.danger, button.bad, .btn.good { color: var(--brand-ink); }
button.bad { background: var(--bad); }

/* ---------- صور الأقسام (بطاقة لكل قسم رئيسي: الصورة فوق لون البلاطة، ثم الاسم والأزرار) ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.cat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.cat-card.busy { opacity: .55; pointer-events: none; }
/* مساحة الصورة بنفس نسبة بلاطة تطبيق العميل (الارتفاع 0.86 من العرض) حتى يشوف المدير ما يشوفه العميل؛ الصورة مطلقة الموضع حتى ما تغيّر مقاس البلاطة */
.cat-card .pic { aspect-ratio: 1 / .86; background: #FDE8DA; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; flex: none; }
.cat-card .pic img { position: absolute; inset: 0; width: 100%; height: 100%; box-sizing: border-box; object-fit: contain; padding: 8px; }
.cat-card .pic img.cover { object-fit: cover; padding: 0; }
.cat-card .pic .none { color: #a8744d; font-size: 13px; }
.cat-card .pic .badge { position: absolute; top: 8px; inset-inline-start: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.cat-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.cat-card .name { font-weight: 700; line-height: 1.35; }
.cat-card .btns { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
