:root {
  color-scheme: light;
  --canvas: #f3f6fa;
  --white: #fff;
  --ink: #192941;
  --muted: #50617b;
  --faint: #dce5f0;
  --side: #142641;
  --side-deep: #101f34;
  --green: #175dc3;
  --green-hover: #104ba1;
  --mint: #e8f0ff;
  --gold: #775917;
  --cream: #f6f1e4;
  --red: #a02d35;
  --radius: 15px;
  font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
a { color: inherit; }
a, button, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #399778; outline-offset: 3px; }
h1,h2,h3,p { margin: 0; }
[hidden] { display: none !important; }
.icon { width: 19px; height: 19px; flex: 0 0 auto; display: inline-block; vertical-align: middle; }
.loading-screen { display: grid; min-height: 100dvh; place-items: center; color: var(--muted); }
.shell { min-height: 100dvh; display: grid; grid-template-columns: 218px minmax(0, 1fr); grid-template-rows: 68px 1fr; }
.sidebar { background: var(--side); color: #fff; display: flex; flex-direction: column; min-height: calc(100dvh - 68px); position: sticky; top: 68px; align-self: start; padding: 20px 12px; }
.brand { display: flex; align-items: center; gap: 11px; padding-inline: 6px; }
.brand-mark { width: 43px; height: 43px; border-radius: 13px; display: grid; place-items: center; color: #86e2ee; background: #223c60; border: 1px solid #3a5274; }
.brand-mark .icon { width: 24px; height: 24px; }
.brand strong { display: block; font-size: 1rem; line-height: 1.6; white-space: nowrap; }
.brand small { color: #c4d8d0; font-size: .77rem; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-link { text-decoration: none; display: flex; align-items: center; gap: 10px; border-radius: 9px; padding: 11px 12px; color: #e2eafa; font-weight: 580; font-size: .91rem; }
.nav-link:hover { background: #ffffff12; }
.nav-link[aria-current] { color: #fff; background: #244c83; box-shadow: inset -3px 0 #75adff; }
.workspace { min-width: 0; }
.topbar { grid-column: 1 / -1; min-height: 68px; position: sticky; top: 0; z-index: 4; color: #fff; background: var(--side-deep); border-bottom: 1px solid #263956; display: flex; align-items: center; justify-content: space-between; padding: 10px clamp(18px, 3.2vw, 42px); gap: 12px; }
.top-account { display: flex; gap: 12px; align-items: center; position: relative; }
.account { border: 0; display: flex; align-items: center; gap: 9px; background: transparent; color: inherit; padding: 0; text-align: start; }
.avatar { border-radius: 50%; background: var(--mint); color: var(--green); width: 36px; height: 36px; display: grid; place-items: center; font-size: .79rem; font-weight: 750; flex-shrink: 0; }
.account strong { display: block; font-size: .83rem; }
.account small { color: #b9cbe5; font-size: .73rem; }
.account .icon { width: 14px; height: 14px; }
.account-menu { z-index: 3; position: absolute; inset-inline-end: 0; top: calc(100% + 11px); background: #fff; border: 1px solid var(--faint); border-radius: 10px; padding: 5px; min-width: 150px; box-shadow: 0 10px 25px #132c241c; }
.account-menu button { width: 100%; text-align: start; }
.mobile-toggle { display: none !important; }
.main { max-width: 1500px; margin-inline: auto; padding: 25px clamp(18px, 2.8vw, 38px) 46px; }
.heading { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
h1 { font-size: clamp(1.75rem, 3vw, 2.35rem); line-height: 1.4; font-weight: 800; letter-spacing: -.025em; }
.heading p, .subtle { color: var(--muted); font-size: .91rem; line-height: 1.75; }
.heading p { margin-top: 4px; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.panel-icon { background: var(--mint); display: grid; place-items: center; width: 41px; height: 41px; border-radius: 11px; color: var(--green); flex: 0 0 auto; }
.panel { border: 1px solid var(--faint); border-radius: var(--radius); background: var(--white); min-width: 0; margin-bottom: 17px; }
.panel-head { display: flex; align-items: center; gap: 11px; padding: 16px 19px 13px; }
.panel-head h2, .results-head h2 { font-size: 1.08rem; font-weight: 780; }
.panel-head p { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; font-size: .87rem; color: var(--ink); font-weight: 650; }
.field input, select { height: 42px; width: 100%; border: 1px solid #cdd9ea; border-radius: 8px; padding: 7px 10px; color: var(--ink); background: #fbfcff; min-width: 0; font-size: .9rem; font-weight: 450; }
.field input::placeholder { color: #677973; opacity: 1; text-align: start; }
.field input[dir=ltr]::placeholder { text-align: right; }
select { appearance: none; padding-inline-end: 27px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23526762' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 8px center; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; padding: 7px 13px; text-decoration: none; border: 1px solid transparent; font-weight: 700; font-size: .86rem; white-space: nowrap; color: var(--ink); background: #fff; }
.button .icon { width: 16px; height: 16px; }
.primary { color: #fff; background: var(--green); }
.primary:hover { background: var(--green-hover); }
.secondary { border-color: #d9e2dc; }
.secondary:hover, .quiet:hover { background: #edf3fc; }
.quiet { background: transparent; min-height: 34px; }
.button.danger { color: var(--red); }
.results-head { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 11px; flex-wrap: wrap; }
.results-title, .result-controls, .page-controls, .scope-controls { display: flex; gap: 8px; align-items: center; }
.result-controls { flex-wrap: wrap; }
.result-controls select { width: auto; height: 34px; font-size: .79rem; }
.count { background: #ecf2fb; color: #284e86; font-size: .75rem; border-radius: 20px; padding: 3px 8px; white-space: nowrap; font-weight: 650; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: start; }
th,td { padding: 11px 16px; text-align: start; }
th { background: #eef3fa; border-block: 1px solid #e3eaf4; color: #3d516d; font-size: .81rem; font-weight: 750; white-space: nowrap; }
td { border-bottom: 1px solid #eaf0f7; font-size: .9rem; vertical-align: middle; }
td:first-child, th:first-child { padding-inline-start: 19px; }
td:last-child, th:last-child { padding-inline-end: 19px; }
tbody tr:hover { background: #f8faff; }
.table-id { font-family: "Segoe UI", Arial, sans-serif; color: #3b554c; font-variant-numeric: tabular-nums; letter-spacing: .045em; white-space: nowrap; }
.person-link { font-weight: 720; text-align: start; background: none; border: 0; color: var(--ink); padding: 0; }
.person-link:hover { color: var(--green); text-decoration: underline; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 20px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.status::before { content: ''; height: 6px; width: 6px; background: currentColor; border-radius: 50%; }
.available { background: #eef2f8; color: #475972; }
.enrolled { background: #e0f3e8; color: #21634a; }
.disabled { background: #faeeee; color: var(--red); }
.row-action { color: var(--green); min-height: 33px; padding: 4px 8px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; font-size: .83rem; color: var(--muted); }
.pager label { display: flex; align-items: center; gap: 6px; }
.pager select { width: auto; height: 34px; }
.pager .button { min-height: 34px; font-size: .8rem; }
.empty { text-align: center; padding: 31px 14px; color: var(--muted); }
#toast { position: fixed; z-index: 10; inset-inline-end: 20px; bottom: 20px; max-width: calc(100% - 40px); }
#toast:not(:empty) { padding: 12px 17px; border-radius: 10px; color: #fff; background: var(--side); box-shadow: 0 5px 17px #182e2a33; }
#toast.error:not(:empty) { background: var(--red); }
dialog { width: min(550px, calc(100% - 28px)); max-height: calc(100dvh - 32px); border: 1px solid var(--faint); border-radius: 17px; padding: 0; color: var(--ink); box-shadow: 0 18px 70px #1027213c; }
dialog::backdrop { background: #122b2566; }
.dialog-head { padding: 18px 20px 15px; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--faint); }
.dialog-head h2 { font-size: 1.22rem; margin-top: 3px; }
.dialog-body { padding: 16px 20px 20px; display: grid; gap: 15px; }
.dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.record { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0; padding: 14px; background: #f1f5fa; border-radius: 10px; }
.record dt { color: var(--muted); font-size: .78rem; margin-bottom: 3px; }
.record dd { margin: 0; font-size: .94rem; font-weight: 700; overflow-wrap: anywhere; }
.record .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: .89rem; color: var(--ink); line-height: 1.65; }
.check input { accent-color: var(--green); width: 17px; height: 17px; margin: 3px 0 0; flex: 0 0 auto; }
.alert { border-radius: 8px; padding: 9px 12px; background: var(--cream); color: #5c481b; font-size: .86rem; }
.alert.error { color: var(--red); background: #faeeee; }
.user-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.user-actions { display: flex; gap: 5px; }
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(290px, 450px) minmax(0,1fr); gap: 60px; align-items: center; max-width: 1120px; padding: 35px; margin-inline: auto; }
.login-card { padding: 26px; background: #fff; border: 1px solid var(--faint); border-radius: 18px; }
.login-card form { display: grid; gap: 14px; margin-top: 21px; }
.login-banner { padding: 32px; color: #fff; border-radius: 20px; background: var(--side); min-height: 360px; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; }
.login-banner h1 { max-width: 360px; }
.login-banner p { color: #d5e8de; line-height: 1.8; }
.login-banner > .brand { margin-bottom: auto; padding: 0; }
.login-card h2 { font-size: 1.45rem; margin-bottom: 4px; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 199px minmax(0,1fr); }
  .sidebar { padding-inline: 11px; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { display: none; position: relative; min-height: 0; padding: 15px 14px; }
  .sidebar.open { display: block; }
  .nav { margin-top: 11px; gap: 4px; }
  .topbar { padding: 8px 14px; min-height: 58px; }
  .mobile-toggle { display: inline-flex !important; padding-inline: 8px; }
  .top-account { gap: 6px; }
  .main { padding: 19px 13px 30px; }
  .heading { align-items: flex-start; flex-direction: column; gap: 9px; margin-bottom: 15px; }
  .panel-head, .filter-actions, .results-head { padding-inline: 12px; }
  .pager { flex-wrap: wrap; padding-inline: 10px; }
  .responsive-table thead { position: absolute; width: 1px; height: 1px; clip-path: inset(100%); overflow: hidden; }
  .responsive-table, .responsive-table tbody { display: block; }
  .responsive-table tr { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; padding: 9px 12px; border-top: 1px solid var(--faint); gap: 6px 9px; }
  .responsive-table td, .responsive-table td:first-child, .responsive-table td:last-child { padding: 0; border: 0; }
  .responsive-table td:nth-child(2) { grid-row: 2; grid-column: 1; }
  .responsive-table td:nth-child(3) { grid-row: 1; grid-column: 2; text-align: end; }
  .responsive-table td:nth-child(4) { grid-row: 2; grid-column: 2; text-align: end; }
  .responsive-table td:last-child { grid-column: 2; text-align: end; }
  .responsive-table td[colspan] { grid-column: 1 / -1; padding: 13px; }
  .recorded-by[data-attributed] { color: var(--muted); }
  .recorded-by[data-attributed]::before { content: 'سجّله '; }
  .enrollment-table td:nth-child(4)::before { content: 'التاريخ '; color: var(--muted); }
  .login { grid-template-columns: 1fr; gap: 14px; padding: 18px; max-width: 520px; align-content: center; }
  .login-banner { padding: 18px; min-height: 0; }
  .login-banner h1 { font-size: 1.55rem; }
  .login-banner .brand small { display: none; }
  .login-card { padding: 18px; }
}
@media (max-width: 360px) {
  .user-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .users-table td:nth-child(5) { grid-column: 1; }
  .users-table td:last-child { grid-row: 3; }
}

.header-brand { display: flex; align-items: center; gap: 8px; }
.topbar .brand strong { font-size: clamp(.9rem, 2vw, 1.18rem); }
.topbar .brand-mark { width: 38px; height: 38px; border-radius: 10px; }
.topbar .mobile-toggle { color: #e2edff; }
.topbar .mobile-toggle:hover { color: var(--side); background: #e2edff; }
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(205px, 255px); gap: 17px; align-items: start; }
.home-primary { display: flex; flex-direction: column; min-width: 0; }
.home-aside { min-width: 0; }
.has-search .register-panel { order: 1; }
.has-search .recent-panel { order: 2; }
.search-panel, .statistics, .recent-panel, .guidelines { box-shadow: 0 2px 5px #17366009; }
.search-panel .panel-head { align-items: flex-start; padding: 22px 20px 16px; }
.search-panel h1 { font-size: clamp(1.28rem, 2.1vw, 1.84rem); letter-spacing: 0; line-height: 1.45; }
.search-panel .panel-head p { font-size: .9rem; line-height: 1.55; }
#search-form { padding: 0 20px 17px; }
.search-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 11px; align-items: end; }
.search-fields input { height: 46px; }
.search-fields button { min-height: 46px; min-width: 92px; }
.advanced { margin-top: 13px; font-size: .85rem; }
.advanced summary { cursor: pointer; color: #234f85; width: fit-content; font-weight: 650; }
.clear-search { margin-top: 8px; color: #234f85; }
.statistics .panel-head, .guidelines .panel-head { padding: 15px 13px 12px; }
.statistics .panel-icon, .guidelines .panel-icon, .recent-panel .panel-icon { width: 32px; height: 32px; border-radius: 8px; }
.stats-stack { display: grid; gap: 10px; padding: 0 12px 13px; }
.stat-tile { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px; }
.stat-tile span:not(.stat-icon) { display: block; font-size: .84rem; color: var(--ink); }
.stat-tile strong { display: block; font-weight: 800; font-size: 1.57rem; font-variant-numeric: tabular-nums; line-height: 1.24; }
.stat-blue { color: #215db0; background: #eaf2ff; }
.stat-green { color: #176742; background: #e4f5ec; }
.stat-amber { color: #925006; background: #fff2dc; }
.stat-icon .icon { width: 23px; height: 23px; }
.demo-mark { color: var(--muted); font-size: .78rem; margin: 0 15px 12px; }
.guidelines ul { font-size: .89rem; color: var(--ink); line-height: 1.7; padding: 0 31px 15px 12px; margin: 0; }
.guidelines li + li { margin-top: 6px; }
.guidelines li::marker { color: var(--green); }
.recent-panel td, .recent-panel th { padding-block: 9px; }
.match-card { background: #e8f7ee; border-radius: var(--radius); padding: 15px 16px; }
.match-heading { display: flex; gap: 8px; align-items: center; color: #175b38; margin-bottom: 10px; }
.match-heading h2 { font-size: 1.05rem; }
.match-facts { display: flex; flex-wrap: wrap; gap: 12px 30px; margin: 0 0 12px; padding: 11px 13px; background: #fff; border-radius: 10px; }
.match-facts dt { color: var(--muted); font-size: .8rem; line-height: 1.45; }
.match-facts dd { margin: 2px 0 0; font-weight: 750; overflow-wrap: anywhere; }
.add-action { background: #177647; }
.add-action:hover { background: #105c37; }
.import-body { padding: 6px 19px 20px; display: grid; gap: 13px; }
.import-body input[type=file] { height: auto; padding: 9px; }
.import-body input[type=file]::file-selector-button { font: inherit; padding: 6px 11px; margin-inline-end: 7px; border: 0; border-radius: 6px; background: var(--mint); color: #194b85; }
.reference-mapping, .reference-reviewed { display: grid; gap: 12px; justify-items: start; }
.reference-mapping .user-grid, .reference-reviewed .table-wrap { width: 100%; }
.reference-reviewed h3 { font-size: 1rem; }
.alert.complete { color: #165837; background: #e1f4e8; }

@media (max-width: 1140px) {
  .home-layout { grid-template-columns: minmax(0, 1fr) minmax(170px, 207px); gap: 12px; }
}
@media (max-width: 950px) {
  .home-layout { grid-template-columns: minmax(0, 1fr); }
  .home-aside { order: -1; }
  .guidelines { display: none; }
  .stats-stack { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { top: 0; min-height: 0; }
  .brand { padding-inline: 0; }
  .topbar .brand-mark { display: none; }
  .topbar .brand strong { white-space: normal; }
  .search-panel .panel-head, #search-form { padding-inline: 12px; }
  .search-fields { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
  .search-fields button { min-width: 76px; }
  .stats-stack { gap: 6px; }
  .stat-tile { padding: 8px; gap: 5px; }
  .stat-tile strong { font-size: 1.23rem; }
  .stat-tile span:not(.stat-icon) { font-size: .71rem; }
  .stat-icon .icon { width: 16px; height: 16px; }
  .match-facts { gap: 10px 15px; }
  .match-facts > div:first-child { flex-basis: 100%; }
  .enrollment-table td:nth-child(3)::before { content: 'سجّله '; }
}
@media (max-width: 760px) {
  .home-layout { display: flex; flex-direction: column; gap: 0; }
  .home-primary, .home-aside { display: contents; }
  .home-layout .panel { width: 100%; }
  .search-panel { order: 0; }
  .statistics { order: 2; }
  .recent-panel, .has-search .recent-panel { order: 3; }
  .register-panel { order: 4; }
  .has-search .register-panel { order: 1; }
}

.name-parts { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) {
  .name-parts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.role-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.role-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px; }
.role-card h2 { font-size: 1rem; }
.role-card p { color: var(--muted); font-size: .88rem; line-height: 1.65; margin-top: 4px; }
.role-tag { display: inline-block; padding: 3px 8px; border-radius: 8px; background: #edf2f8; font-weight: 700; white-space: nowrap; }
.role-tag.admin { background: #e8f0ff; color: #174a92; }
#regular-permissions .check { margin-top: 8px; }
@media (max-width: 760px) {
  .role-overview { grid-template-columns: 1fr; gap: 0; }
}
