:root {
    --primary: #00B5CA;
    --primary-dark: #007991;
    --bg: #f0f4f8;
    --card: #ffffff;
    --text: #263238;
    --muted: #78909c;
    --border: #e3e9ee;
    --ok: #2e9d57;
    --warn: #f59f00;
    --danger: #d9363e;
    --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary-dark); }

/* الشريط العلوي */
.topbar { background: var(--card); box-shadow: 0 2px 8px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 50; }
.topbar-inner { max-width: 1000px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; color: var(--primary); text-decoration: none; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a { padding: 7px 14px; border-radius: 6px; text-decoration: none; color: var(--text); font-size: 14px; transition: background .2s; }
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--primary); color: #fff; }

.container { max-width: 1000px; margin: 24px auto; padding: 0 16px; }
h1 { margin: 0 0 18px; font-size: 24px; color: var(--primary-dark); }
h2 { margin: 0 0 14px; font-size: 18px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 2px 8px rgba(0,0,0,.05); padding: 20px; margin-bottom: 20px; }
.card.danger { border: 1px solid #f3c1c4; background: #fff7f7; }
.muted { color: var(--muted); font-size: 13px; }

/* الرسائل */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; font-weight: 600; border: 1px solid transparent; }
.flash-success { background: #e6f6ec; color: #17653a; border-color: #bfe5cd; }
.flash-warning { background: #fff4db; color: #8a5a00; border-color: #f5dba0; }
.flash-error   { background: #fde8e9; color: #8e1d23; border-color: #f3c1c4; }

/* النماذج */
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 14px; }
input[type=text], input[type=url], input[type=number], input[type=date], input[type=search], select {
    width: 100%; padding: 10px 12px; border: 1px solid #cfd8dc; border-radius: 6px; font-size: 15px; background: #fff; font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,181,202,.15); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; }

/* الأزرار */
.btn { display: inline-block; padding: 9px 18px; border: none; border-radius: 6px; background: var(--primary); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; font-family: inherit; transition: background .2s, transform .15s; }
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn:disabled, .btn.disabled { background: #b0bec5; cursor: not-allowed; transform: none; }
.btn-ok { background: var(--ok); }      .btn-ok:hover { background: #247d45; }
.btn-warn { background: var(--warn); color: #222; } .btn-warn:hover { background: #d98a00; }
.btn-danger { background: var(--danger); } .btn-danger:hover { background: #b52a31; }
.btn-light { background: #e6ecf0; color: var(--text); } .btn-light:hover { background: #d4dde3; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* قائمة المحتوى */
.items { padding: 0; overflow: hidden; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: none; }
.item:hover { background: #f8fbfc; }
.item img { width: 50px; height: 75px; object-fit: cover; border-radius: 5px; background: #dfe6ea; flex-shrink: 0; }
.item-info { flex: 1; min-width: 0; }
.item-title { font-weight: 700; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.item-actions form { margin: 0; }

/* شارات السيرفرات */
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.badge { font-size: 12px; padding: 2px 9px; border-radius: 20px; border: 1px solid transparent; }
.badge-ok { background: #e6f6ec; color: #17653a; border-color: #bfe5cd; }
.badge-miss { background: #f1f4f6; color: #90a4ae; border-color: var(--border); }
.badge-off { background: #fff4db; color: #8a5a00; border-color: #f5dba0; }
.badge-on { background: #e6f6ec; color: #17653a; }
.badge-inactive { background: #fde8e9; color: #8e1d23; }

/* الجداول */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 12px; text-align: right; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #f6f9fa; font-weight: 700; white-space: nowrap; }
td form { display: inline; margin: 0; }
.url-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: left; color: var(--muted); font-size: 12px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ترقيم الصفحات */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 18px 0 0; flex-wrap: wrap; }
.pagination a { padding: 6px 13px; border-radius: 6px; background: var(--card); text-decoration: none; border: 1px solid var(--border); font-size: 14px; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.empty { text-align: center; padding: 30px; color: var(--muted); }
.log { background: #0f1b20; color: #cfe8ee; padding: 14px; border-radius: 8px; font-family: monospace; font-size: 13px; white-space: pre-wrap; max-height: 420px; overflow: auto; direction: rtl; text-align: right; }

/* إشعار منبثق */
.toast { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); background: var(--ok); color: #fff; padding: 10px 22px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 100; max-width: 90%; }
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); }

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .item { flex-wrap: wrap; }
    .item-actions { width: 100%; justify-content: flex-start; }
}

.bulk-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; position: sticky; top: 62px; z-index: 40; }
.check { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; }
.js-item-check, #select-all { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }
.season-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }

/* تسجيل الدخول */
.login-box { max-width: 420px; margin: 60px auto; padding: 0 16px; }
.login-box h1 { text-align: center; }
.logout-form { margin: 0 auto 0 0; }
.nowrap { white-space: nowrap; }
code { background: #eef2f5; padding: 1px 6px; border-radius: 4px; direction: ltr; display: inline-block; }

/* شريط التقدم */
.progress-wrap { flex-basis: 100%; }
.progress-wrap[hidden] { display: none; }
.progress { height: 14px; background: #e3e9ee; border-radius: 8px; overflow: hidden; margin-bottom: 6px; }
.bar { height: 100%; width: 0; background: var(--primary); transition: width .3s; }
