/* صفحات الدخول والإدارة — بنفس ألوان وخط الموقع الأصلي (board.css) */
:root {
  --primary: #15445a;
  --primary-light: #3d7eb9;
  --accent: #0da9a6;
  --success: #07a869;
  --danger: #c0392b;
  --bg: #f4f8fb;
  --card-bg: #ffffff;
  --text-main: #15445a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --grad: linear-gradient(135deg, #15445a 0%, #3d7eb9 55%, #0da9a6 100%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary-light); }

.dev-ribbon { background: #b45309; color: #fff; text-align: center; font-size: 0.72rem; font-weight: 700; padding: 0.15rem; }

/* ---------- الدخول ---------- */
.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--grad);
}

.auth-box {
  background: #fff;
  width: min(400px, 100%);
  border-radius: 1.25rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  padding: 2rem 1.75rem 1.5rem;
  position: relative;
  overflow: hidden;
}

.auth-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
}

.auth-box h1 { margin: 0; font-size: 1.35rem; font-weight: 900; text-align: center; }
.auth-box .sub { margin: 0.2rem 0 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; font-weight: 600; }

/* ---------- النماذج ---------- */
.field { margin-bottom: 0.9rem; }
.field label { display: block; font-size: 0.8rem; font-weight: 700; margin-bottom: 0.3rem; }
.field input, .field select {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: 0.6rem;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  color: var(--primary);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13, 169, 166, 0.15); }
.field .hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }

.btn-main {
  width: 100%;
  padding: 0.65rem;
  border: none;
  border-radius: 0.6rem;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  color: #fff;
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(13, 169, 166, 0.25);
}
.btn-main:hover { filter: brightness(1.05); }

.alert { border-radius: 0.6rem; padding: 0.6rem 0.8rem; font-size: 0.85rem; font-weight: 600; margin-bottom: 1rem; }
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c0; }
.alert-ok { background: #e7f7ef; color: #047a4c; border: 1px solid #b7e8cf; }

/* ---------- صفحات الإدارة ---------- */
.topbar { background: var(--grad); color: #fff; padding: 0.75rem 1.5rem; box-shadow: 0 4px 20px rgba(21, 68, 90, 0.15); }
.topbar-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 1.15rem; font-weight: 900; }
.topbar p { margin: 0; font-size: 0.75rem; opacity: 0.88; font-weight: 600; }
.topbar .user-chip { display: flex; align-items: center; gap: 0.5rem; background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.25); border-radius: 999px; padding: 0.2rem 0.3rem 0.2rem 0.8rem; font-size: 0.78rem; font-weight: 700; }
.topbar .user-chip form { margin: 0; }
.btn-logout { background: rgba(255,255,255,0.95); color: var(--primary); border: none; border-radius: 999px; padding: 0.2rem 0.75rem; font-family: 'Cairo', sans-serif; font-size: 0.72rem; font-weight: 700; cursor: pointer; }

.page { max-width: 1200px; width: 100%; margin: 0 auto; padding: 1.25rem 1rem 2rem; flex: 1; }
.page h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }

.panel { background: #fff; border: 1px solid var(--border); border-radius: 0.85rem; box-shadow: 0 4px 12px rgba(21, 68, 90, 0.05); padding: 1rem 1.1rem; margin-bottom: 1rem; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 0.9rem; }
.form-actions { display: flex; justify-content: flex-start; }
.form-actions .btn-main { width: auto; padding: 0.55rem 1.6rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: right; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-muted); font-size: 0.75rem; font-weight: 700; background: #f8fafc; }

.pill { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.55rem; border-radius: 999px; }
.pill-admin { background: #ede9fe; color: #6d28d9; }
.pill-leader { background: #e0f2fe; color: #0369a1; }
.pill-office { background: #ecfdf5; color: #047857; }
.pill-off { background: #f1f5f9; color: #64748b; }

.muted { color: var(--text-muted); }

footer.site { background: #15445a; color: rgba(255,255,255,0.75); padding: 0.5rem; text-align: center; font-size: 0.72rem; }

.btn-small { background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0.2rem 0.6rem; font-family: 'Cairo', sans-serif; font-size: 0.75rem; font-weight: 700; color: var(--primary); cursor: pointer; }
.btn-small:hover { background: #e2e8f0; }
.edit-row td { background: #f8fafc; }
.inline-form { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.inline-form label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; font-weight: 700; }
.inline-form input { padding: 0.35rem 0.6rem; border: 1.5px solid var(--border); border-radius: 0.5rem; font-family: 'Cairo', sans-serif; font-size: 0.85rem; color: var(--primary); min-width: 200px; }
.inline-form .btn-main { width: auto; padding: 0.35rem 1.2rem; font-size: 0.82rem; }

/* ================= الجزء 7: صفحات السوبر أدمن ================= */
.admin-tabs { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.admin-tabs a { color: #fff; text-decoration: none; font-size: 0.82rem; font-weight: 700; padding: 0.35rem 0.9rem; border-radius: 999px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); }
.admin-tabs a:hover { background: rgba(255,255,255,0.2); }
.admin-tabs a.on { background: #fff; color: var(--primary); }

.users-table td.actions { display: flex; gap: 0.3rem; flex-wrap: wrap; white-space: normal; min-width: 330px; }
.users-table form.inline, form.inline { display: inline; margin: 0; }
.row-leader td { background: #f8fbff; }
.row-office td:first-child { padding-inline-start: 1.2rem; }
.btn-accent { background: linear-gradient(135deg, var(--primary-light), var(--accent)); color: #fff !important; border-color: transparent; text-decoration: none; }
.btn-accent:hover { filter: brightness(1.05); background: linear-gradient(135deg, var(--primary-light), var(--accent)); }
a.btn-small { text-decoration: none; display: inline-block; }
.btn-danger-soft { color: #c0392b; }
.btn-danger-soft:hover { background: #fdecea; border-color: #f5c6c0; }
.pill-lock { background: #fff8e1; color: #b45309; margin-inline-start: 0.2rem; }
.pill-fail { background: #fdecea; color: #c0392b; }
.hint-inline { font-size: 0.72rem; }
.link-btn { background: none; border: none; color: var(--primary-light); font-family: 'Cairo', sans-serif; font-size: 0.72rem; font-weight: 700; cursor: pointer; padding: 0; }

.log-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.8rem; }
.log-tabs a { text-decoration: none; padding: 0.4rem 1.1rem; border-radius: 999px; font-weight: 800; font-size: 0.85rem; color: var(--primary); background: #fff; border: 1px solid var(--border); }
.log-tabs a.on { background: linear-gradient(135deg, var(--primary-light), var(--accent)); color: #fff; border-color: transparent; }
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); }
.filters select, .filters input { padding: 0.35rem 0.5rem; border: 1.5px solid var(--border); border-radius: 0.5rem; font-family: 'Cairo', sans-serif; font-size: 0.82rem; color: var(--primary); background: #fff; min-width: 130px; }
.filters .btn-main { width: auto; padding: 0.4rem 1.3rem; font-size: 0.85rem; }
.row-admin td { background: #faf5ff; }
.act { font-weight: 700; }
.act-show_password, .act-copy_password, .act-copy_username { color: #b45309; }
.act-delete_card, .act-admin_delete_user, .act-admin_deactivate_user, .act-om_deactivate { color: #c0392b; }
.act-add_card, .act-admin_create_user, .act-om_create, .act-admin_restore_card { color: #047857; }
td.ua { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.pages { display: flex; gap: 0.8rem; align-items: center; justify-content: center; margin-top: 0.8rem; }

.update-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.update-head h2 { margin: 0; flex: 1; }
.update-num { background: linear-gradient(135deg, var(--primary-light), var(--accent)); color: #fff; font-weight: 900; font-size: 0.8rem; border-radius: 999px; padding: 0.1rem 0.6rem; }
.update-date { font-size: 0.78rem; font-weight: 700; }
.update ul { margin: 0; padding-inline-start: 1.2rem; font-size: 0.86rem; line-height: 1.9; }
.intro p { margin: 0; line-height: 1.9; font-size: 0.88rem; color: var(--text-muted); }
.users-table td.actions { min-width: 0; flex-wrap: nowrap; align-items: center; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { background: #e2e8f0; }
.menu-list { position: absolute; left: 0; top: calc(100% + 4px); z-index: 20; background: #fff; border: 1px solid var(--border); border-radius: 0.6rem; box-shadow: 0 10px 28px rgba(21, 68, 90, 0.15); padding: 0.35rem; display: flex; flex-direction: column; gap: 0.25rem; min-width: 200px; }
.menu-list .btn-small, .menu-list form, .menu-list form .btn-small { width: 100%; text-align: right; display: block; }
.table-wrap { overflow: visible; }
@media (max-width: 1000px) { .table-wrap { overflow-x: auto; } }
.page { max-width: 1400px; }

.alert-warn { background: #fff8e1; color: #92400e; border: 1px solid #fde68a; line-height: 1.7; }
.auth-links { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; font-size: 0.82rem; font-weight: 700; }
.auth-links a { text-decoration: none; }
.topbar .chip-link { color: var(--primary); background: rgba(255,255,255,0.95); border-radius: 999px; padding: 0.2rem 0.7rem; font-size: 0.72rem; font-weight: 700; text-decoration: none; }

/* إعدادات النظام */
.system-form { max-width: 720px; }
.sys-preview { border: 1px solid var(--border); border-radius: 0.75rem; overflow: hidden; margin: 0.4rem 0 1rem; }
.sys-preview-label { font-size: 0.7rem; font-weight: 800; color: var(--text-muted); padding: 0.3rem 0.7rem; background: #f8fafc; border-bottom: 1px solid var(--border); }
.sys-head { background: var(--grad); color: #fff; padding: 0.6rem 0.9rem; }
.sys-head b { display: block; font-size: 1.05rem; font-weight: 900; }
.sys-head small { font-size: 0.72rem; opacity: 0.9; font-weight: 600; }
.sys-bar { background: linear-gradient(90deg, #15445a 0%, #3d7eb9 100%); color: #fff; font-size: 0.75rem; padding: 0.3rem 0.9rem; text-align: center; }
.sys-foot { background: #15445a; color: rgba(255,255,255,0.75); font-size: 0.7rem; padding: 0.4rem; text-align: center; }

/* ملخص صفحة الإدارة */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; margin-bottom: 1rem; }
.sum-card { background: #fff; border: 1px solid var(--border); border-radius: 0.85rem; padding: 0.8rem 1rem; box-shadow: 0 4px 12px rgba(21, 68, 90, 0.05); text-decoration: none; color: inherit; position: relative; overflow: hidden; }
.sum-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(135deg, var(--primary-light), var(--accent)); }
.sum-card.ok::before { background: #07a869; }
.sum-card.bad::before { background: #e53935; }
.sum-card.warn::before { background: #f59e0b; }
.sum-num { font-size: 1.8rem; font-weight: 900; line-height: 1.1; color: var(--primary); }
.sum-card.bad .sum-num { color: #c0392b; }
.sum-label { font-size: 0.85rem; font-weight: 800; }
.sum-sub { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; margin-top: 0.3rem; line-height: 1.6; }
a.sum-card:hover { border-color: var(--primary-light); }
@media (max-width: 900px) { .summary { grid-template-columns: repeat(2, 1fr); } }
