/* واجهة عربية RTL بدون أي اعتماد خارجي (لا CDN ولا خطوط خارجية). */
:root {
  --bg: #f4f6f9; --card: #fff; --text: #1d2733; --muted: #6b7a8c; --line: #e2e8f0;
  --primary: #0f6fb5; --primary-dark: #0b5a94; --danger: #c0392b; --warn: #d68910; --ok: #1e8449;
  --side: #14283c; --side-text: #cfdbe8; --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1620; --card: #17222f; --text: #e6edf5; --muted: #8fa1b5; --line: #26364a; --side: #0a111a; }
}
* { box-sizing: border-box; }
html { direction: rtl; }
body { margin: 0; font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 230px; background: var(--side); color: var(--side-text); padding: 18px 12px; flex-shrink: 0; }
.sidebar .brand { font-weight: 700; font-size: 17px; color: #fff; padding: 4px 10px 16px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 10px; }
.sidebar a { display: block; color: var(--side-text); padding: 9px 12px; border-radius: 8px; margin: 2px 0; }
.sidebar a:hover, .sidebar a.active { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.sidebar .sec { font-size: 12px; color: #7f93a8; padding: 12px 12px 4px; }
.main { flex: 1; min-width: 0; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 22px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.menu-btn { display: none; }
.content { padding: 22px; max-width: 1250px; }
h1 { font-size: 22px; margin: 0 0 16px; } h2 { font-size: 17px; margin: 0 0 12px; }
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); }
.stat { text-align: center; } .stat .n { font-size: 30px; font-weight: 700; color: var(--primary); } .stat .l { color: var(--muted); font-size: 13px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.btn { display: inline-block; border: 0; background: var(--primary); color: #fff; padding: 8px 16px; border-radius: 8px; cursor: pointer; font: inherit; }
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn.sec { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn.danger { background: var(--danger); } .btn.warn { background: var(--warn); } .btn.sm { padding: 4px 10px; font-size: 13px; }
.badge { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: 12px; background: var(--line); color: var(--text); }
.badge.active, .badge.published { background: #d5f0df; color: #14532d; } .badge.suspended, .badge.draft { background: #fdebc8; color: #7a4b00; }
.badge.revoked, .badge.expired, .badge.withdrawn, .badge.deactivated { background: #f8d7d3; color: #7b1d12; } .badge.archived { background: #e1e5ea; color: #444; }
.field { margin-bottom: 14px; } .field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea, input[type=file] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; }
textarea { min-height: 90px; } input.ltr, textarea.ltr, .ltr { direction: ltr; text-align: left; }
.checks label { display: inline-flex; align-items: center; gap: 6px; margin-inline-end: 16px; font-weight: 400; }
.err { color: var(--danger); font-size: 13px; margin-top: 3px; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.alert.ok { background: #d5f0df; color: #14532d; } .alert.err { background: #f8d7d3; color: #7b1d12; font-size: inherit; } .alert.info { background: #dbeafe; color: #1e3a8a; } .alert.warn { background: #fdebc8; color: #7a4b00; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: end; } .filters > * { flex: 1 1 150px; } .filters .btn { flex: 0 0 auto; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.mono { font-family: Consolas, "Courier New", monospace; direction: ltr; unicode-bidi: embed; display: inline-block; }
pre.key { direction: ltr; text-align: left; background: var(--bg); border: 1px solid var(--line); padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.pagination { display: flex; gap: 4px; flex-wrap: wrap; list-style: none; padding: 0; margin: 14px 0 0; }
.pagination a, .pagination span { display: block; padding: 4px 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
.pagination .cur span { background: var(--primary); color: #fff; border-color: var(--primary); }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; } .inline-form input[type=text], .inline-form input[type=number] { width: 150px; padding: 4px 8px; }
.muted { color: var(--muted); } .logo { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; vertical-align: middle; }
details > summary { cursor: pointer; color: var(--primary); }
.login-box { max-width: 400px; margin: 9vh auto; }
@media (max-width: 860px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 20; transform: translateX(100%); transition: transform .2s; }
  body.menu-open .sidebar { transform: none; }
  .menu-btn { display: inline-block; } .content { padding: 14px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; }
}
