@font-face { font-family: Tajawal; font-weight: 400; src: url(fonts/Tajawal-Regular.ttf); }
@font-face { font-family: Tajawal; font-weight: 500; src: url(fonts/Tajawal-Medium.ttf); }
@font-face { font-family: Tajawal; font-weight: 700; src: url(fonts/Tajawal-Bold.ttf); }
@font-face { font-family: Tajawal; font-weight: 800; src: url(fonts/Tajawal-ExtraBold.ttf); }

:root {
  --navy: #0e1a4f; --navy-2: #172266; --orange: #ff8a1f; --orange-2: #f26a0f;
  --bg: #f3f5fb; --card: #fff; --text: #1b2145; --muted: #6b7290; --line: #e3e7f3;
  --green: #1fa86a; --red: #e5484d; --blue: #3b6df0; --amber: #e8a100;
  --radius: 16px; --shadow: 0 1px 2px rgba(20, 30, 80, .06), 0 6px 20px rgba(20, 30, 80, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 15px/1.6 Tajawal, system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 800; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* layout */
.app { display: flex; min-height: 100vh; }
.side { width: 250px; background: linear-gradient(180deg, var(--navy), #0a1236); color: #cfd6f5; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; font-weight: 800; font-size: 19px; }
.brand img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); }
.nav-title { font-size: 12px; color: #8791c9; margin: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin: 2px 0; border-radius: 12px; color: #cfd6f5; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.nav a.on { background: linear-gradient(90deg, var(--orange), var(--orange-2)); color: #fff; font-weight: 700; }
.nav .badge { margin-inline-start: auto; background: var(--red); color: #fff; border-radius: 99px; font-size: 12px; padding: 0 8px; line-height: 20px; }
.main { flex: 1; min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 20px; }
.top .who { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.menu-btn { display: none; background: none; border: 0; padding: 4px; color: var(--text); cursor: pointer; }
.content { padding: 24px; max-width: 1360px; margin-inline: auto; }

/* cards, stats */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card > h2 { font-size: 17px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 20px; }
.stats.s4 { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.stats.s3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1200px) { .stats.s4 { grid-template-columns: repeat(2, 1fr); } .stats.s3 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .stats.s4, .stats.s3 { grid-template-columns: 1fr; } }
.stat { min-width: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; gap: 14px; align-items: center; }
.stat .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--orange); }
.stat .num { font-size: 20px; font-weight: 800; line-height: 1.3; white-space: nowrap; }
.stat .lbl { color: var(--muted); font-size: 13px; }
.cols { display: grid; gap: 20px; grid-template-columns: 2fr 1fr; align-items: start; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: start; color: var(--muted); font-weight: 500; font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbff; }
td.actions { white-space: nowrap; text-align: end; }
td img.thumb, .thumb { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; background: #f0f2fa; border: 1px solid var(--line); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, monospace; direction: ltr; unicode-bidi: plaintext; }
.num-ltr { direction: ltr; unicode-bidi: plaintext; }

/* badges */
.badge { white-space: nowrap; display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; background: #eceffa; color: var(--muted); }
.b-green { background: #e2f6ec; color: var(--green); } .b-red { background: #fde8e9; color: var(--red); }
.b-orange { background: #fff0df; color: #d36a00; } .b-blue { background: #e6edff; color: var(--blue); }

/* buttons, forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 12px; padding: 9px 16px; font: 700 14px Tajawal, sans-serif; cursor: pointer; background: #eceffa; color: var(--text); text-decoration: none; }
.btn:hover { filter: brightness(.96); text-decoration: none; }
.btn-primary { background: linear-gradient(90deg, var(--orange), var(--orange-2)); color: #fff; }
.btn-green { background: var(--green); color: #fff; } .btn-red { background: var(--red); color: #fff; } .btn-ghost { background: transparent; border: 1px solid var(--line); }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 10px; }
form.inline { display: inline; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.field .help { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=number], input[type=password], input[type=search], input[type=tel], input[type=url], select, textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; font: 400 15px Tajawal, sans-serif; background: #fff; color: var(--text); }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255,138,31,.45); border-color: var(--orange); }
input[type=color] { width: 54px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.color-row { display: flex; gap: 8px; align-items: center; } .color-row input[type=text] { max-width: 130px; direction: ltr; }
.form-grid { display: grid; gap: 0 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.img-field { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.img-field .preview { width: 84px; height: 84px; border-radius: 14px; border: 1px dashed var(--line); background: #f6f7fc; display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: 12px; }
.img-field .preview img { width: 100%; height: 100%; object-fit: contain; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--orange); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar select { width: auto; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 7px 14px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--text); font-weight: 500; }
.tabs a.on { background: var(--navy); color: #fff; border-color: var(--navy); } .tabs a:hover { text-decoration: none; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd4e8; border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; inset-inline-start: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green); } .switch input:checked + span::before { transform: translateX(-18px); }
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 700; }
.flash.ok { background: #e2f6ec; color: #11794a; } .flash.err { background: #fde8e9; color: #b3262b; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.pager a, .pager span { padding: 6px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.pager span { background: var(--navy); color: #fff; border-color: var(--navy); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }
.bars { display: flex; gap: 10px; align-items: flex-end; height: 150px; padding-top: 10px; }
.bars div { flex: 1; text-align: center; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bars i { display: block; background: linear-gradient(180deg, var(--orange), var(--orange-2)); border-radius: 8px 8px 0 0; min-height: 3px; }
.empty { text-align: center; color: var(--muted); padding: 36px 10px; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #2b3a9e, #0e1a4f 60%, #0a1236); }
.login-card { background: var(--card); border-radius: 28px; padding: 32px 28px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-card .logo { display: block; width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 14px; border: 3px solid var(--navy); }
.login-card h1 { text-align: center; font-size: 22px; margin-bottom: 4px; } .login-card p.sub { text-align: center; color: var(--muted); margin: 0 0 22px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 13px; font-size: 16px; }

@media (max-width: 900px) {
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 20; transform: translateX(100%); transition: transform .25s; width: 270px; }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 10; }
  .menu-btn { display: block; } .cols { grid-template-columns: 1fr; } .content { padding: 16px; } .top { padding: 12px 16px; } .top .who span { display: none; }
}
@media print { .side, .top, .btn, .toolbar { display: none !important; } .content { padding: 0; } }

/* Medium screens: the two-column pages stack (kept last so it wins over .cols). */
@media (max-width: 1200px) { .cols { grid-template-columns: 1fr; } }
