@import url(fonts.css);
:root {
  --green: #0f5c4a;
  --green-2: #137a62;
  --green-soft: #e6f2ee;
  --gold: #c9a24a;
  --gold-soft: #faf3e1;
  --ink: #1d2a26;
  --muted: #6b7a75;
  --line: #e3e8e6;
  --bg: #f5f7f6;
  --white: #fff;
  --red: #c0392b;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(15, 92, 74, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--green-2); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ====== الصفحة الرئيسية ====== */
.hero {
  background: linear-gradient(135deg, var(--green) 0%, #0a4033 100%);
  color: #fff;
  padding: 56px 20px 110px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 20% 30%, rgba(201,162,74,.18) 0, transparent 40%),
                    radial-gradient(circle at 80% 70%, rgba(255,255,255,.07) 0, transparent 40%);
  pointer-events: none;
}
.hero .logo {
  width: 74px; height: 74px; margin: 0 auto 14px;
  border-radius: 20px; background: rgba(255,255,255,.12);
  display: grid; place-items: center; font-size: 36px;
  border: 1px solid rgba(255,255,255,.25);
}
.hero h1 { font-size: 2.2rem; font-weight: 800; }
.hero .ayah { font-family: 'Amiri', serif; color: var(--gold); font-size: 1.35rem; margin: 6px 0 4px; }
.hero p { opacity: .85; margin: 0; }

.portals {
  max-width: 1100px; margin: -70px auto 40px; padding: 0 20px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px;
  position: relative; z-index: 2;
}
.portal {
  background: var(--white); border-radius: var(--radius); padding: 26px 22px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
  cursor: pointer; transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 6px; color: var(--ink);
}
.portal:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(15,92,74,.16); }
.portal .ic {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  font-size: 26px; background: var(--green-soft); margin-bottom: 6px;
}
.portal:nth-child(2) .ic { background: var(--gold-soft); }
.portal:nth-child(3) .ic { background: #eef0fb; }
.portal:nth-child(4) .ic { background: #fdeef0; }
.portal h3 { margin: 0; font-size: 1.15rem; }
.portal p { margin: 0; color: var(--muted); font-size: .9rem; }
.portal .go { margin-top: auto; padding-top: 10px; color: var(--green-2); font-weight: 700; }

.landing-info { max-width: 1100px; margin: 0 auto 50px; padding: 0 20px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.step { background: #fff; border: 1px dashed var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.step b { display: block; width: 30px; height: 30px; line-height: 30px; margin: 0 auto 6px; border-radius: 50%; background: var(--green); color: #fff; }
.step span { font-size: .9rem; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 20px; }

/* ====== تسجيل الدخول ====== */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(135deg, var(--green) 0%, #0a4033 100%); }
.auth {
  background: #fff; width: 100%; max-width: 420px; border-radius: 18px; padding: 32px 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.auth .ic { font-size: 40px; text-align: center; }
.auth h2 { text-align: center; margin-bottom: 4px; }
.auth .sub { text-align: center; color: var(--muted); margin-bottom: 22px; }
.demo-hint { margin-top: 16px; background: var(--gold-soft); border-radius: 10px; padding: 10px 12px; font-size: .85rem; }
.demo-hint code { background: #fff; padding: 1px 6px; border-radius: 5px; direction: ltr; display: inline-block; }

/* ====== هيكل البوابات ====== */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side {
  background: var(--green); color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
}
.side .brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.15); margin-bottom: 10px; }
.side .brand .ic { font-size: 26px; }
.side .brand b { display: block; }
.side .brand small { opacity: .75; }
.side a {
  color: rgba(255,255,255,.85); padding: 10px 12px; border-radius: 10px; display: flex; gap: 10px; align-items: center;
}
.side a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side a.active { background: #fff; color: var(--green); font-weight: 700; }
.side .user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.15); padding: 14px 8px 0; font-size: .9rem; }
.side .user small { opacity: .75; display: block; }
.side .user button { margin-top: 8px; width: 100%; }

.main { padding: 26px 30px 60px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { margin: 0; font-size: 1.5rem; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

/* ====== مكوّنات ====== */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h3 { font-size: 1.1rem; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .n { font-size: 1.9rem; font-weight: 800; color: var(--green); line-height: 1.1; }
.stat .l { color: var(--muted); font-size: .9rem; }
.stat.gold .n { color: var(--gold); }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 16px; border-radius: 10px;
  cursor: pointer; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap;
}
.btn:hover { background: #f2f5f4; }
.btn.primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn.primary:hover { background: var(--green-2); }
.btn.gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn.danger { color: var(--red); border-color: #f1c9c4; }
.btn.danger:hover { background: #fdf0ee; }
.btn.sm { padding: 4px 10px; font-size: .85rem; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; padding: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.side .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); justify-content: center; }
.side .btn:hover { background: rgba(255,255,255,.1); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 500; margin-bottom: 5px; font-size: .92rem; }
.field .hint { color: var(--muted); font-size: .8rem; margin-top: 3px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(27,95,191,.6); outline-offset: 1px; border-color: #1B5FBF; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: grid; gap: 6px; }
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar select, .toolbar input { width: auto; min-width: 180px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 10px 10px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f7faf9; color: var(--muted); font-weight: 500; white-space: nowrap; }
tr:hover td { background: #fbfdfc; }
td select, td input { min-width: 120px; padding: 6px 8px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8rem; font-weight: 500; white-space: nowrap; }
.badge.gray { background: #eef1f0; color: #5d6b66; }
.badge.blue { background: #e7f0fd; color: #2563a8; }
.badge.orange { background: #fdf1e3; color: #b26a12; }
.badge.purple { background: #f1ebfb; color: #6b3fb0; }
.badge.green { background: #e3f4ec; color: #17794f; }
.badge.red { background: #fde9e7; color: var(--red); }
.badge.gold { background: var(--gold-soft); color: #9a7520; }

.rank { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #eef1f0; font-weight: 700; }
.rank.r1 { background: #f6d77a; } .rank.r2 { background: #dfe3e6; } .rank.r3 { background: #ecc3a0; }

.comp-card { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.comp-card .meta { color: var(--muted); font-size: .88rem; display: flex; gap: 14px; flex-wrap: wrap; }
.progress { height: 8px; background: #eef1f0; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; background: var(--green-2); }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.score-grid { display: grid; gap: 14px; }
.score-item { display: grid; grid-template-columns: 1fr 140px; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.score-item b { display: block; }
.score-item small { color: var(--muted); }
.score-total { font-size: 2rem; font-weight: 800; color: var(--green); text-align: center; }

.result-card { border: 2px solid var(--green-soft); border-radius: 16px; padding: 20px; background: #fff; margin-bottom: 16px; }
.result-big { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 12px; }
.result-big div { text-align: center; flex: 1; min-width: 100px; background: var(--green-soft); border-radius: 12px; padding: 12px; }
.result-big b { display: block; font-size: 1.6rem; color: var(--green); }

/* ====== نافذة منبثقة وتنبيهات ====== */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 30, 25, .45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h3 { margin-bottom: 16px; }
.modal .actions { margin-top: 18px; justify-content: flex-start; }
#toasts { position: fixed; bottom: 20px; left: 20px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); animation: pop .2s; }
.toast.err { background: var(--red); }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } }

.mobile-top { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; gap: 4px; }
  .side .brand, .side .user { display: none; }
  .side a { white-space: nowrap; padding: 8px 12px; }
  .mobile-top { display: flex; justify-content: space-between; align-items: center; background: var(--green); color: #fff; padding: 12px 16px; }
  .mobile-top .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
  .main { padding: 18px 14px 50px; }
  .row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.7rem; }
}

/* ====== الإصدار الثاني: تبويبات، لجان، نماذج، تقييم ====== */
.hint { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.tabs a { padding: 9px 16px; border-radius: 10px 10px 0 0; color: var(--muted); font-weight: 500; margin-bottom: -2px; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--green); border-bottom-color: var(--green); background: #fff; }
.alert { background: #fdf0ee; color: #8f2b20; border: 1px solid #f3cdc7; border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
.ok-box { background: #e3f4ec; color: #17603f; border: 1px solid #bfe5d1; border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
.conds { background: #f4f8ff; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: .9rem; }
.conds:empty { display: none; }
.modal h4 { margin: 14px 0 8px; color: var(--green); }
.modal.wide { max-width: 760px; }
.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.model-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fcfdfd; }
.model-card ol { margin: 8px 0 0; padding-inline-start: 20px; font-size: .9rem; }
.member-row { display: grid; grid-template-columns: 190px 70px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.member-row label { display: inline-flex; gap: 5px; align-items: center; font-weight: 400; }
.m-crit { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .88rem; }
.model-picks { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 12px; }
.pick { width: 84px; height: 104px; border-radius: 12px; border: 2px solid var(--line); background: var(--gold-soft); font-size: 1.6rem; font-weight: 800; color: var(--green); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: transform .1s; font-family: inherit; }
.pick span { font-size: 1.4rem; }
.pick.chosen { border-color: var(--green); background: var(--green); color: #fff; transform: scale(1.08); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.info-grid div { background: var(--green-soft); border-radius: 10px; padding: 8px 12px; }
.info-grid small { display: block; color: var(--muted); font-size: .8rem; }
.questions { font-size: 1.05rem; line-height: 2.1; padding-inline-start: 22px; margin: 0; }
.calc { color: var(--green-2); font-size: .85rem; font-weight: 700; }
tr.live td { background: #f6f1fd; }
.result-big .pass { background: #d4efe2; }
.result-big .fail { background: #fbe1dd; }
.result-big .fail b { color: var(--red); }
.result-big small { display: block; color: var(--muted); }
@media (max-width: 860px) { .member-row { grid-template-columns: 1fr 70px; } .m-crit { grid-column: 1 / -1; } }
.model-card.used { opacity: .55; background: #f3f4f4; }

/* ====== شاشة الطالب ====== */
.kiosk { min-height: 100vh; background: linear-gradient(135deg, var(--green) 0%, #0a4033 100%); display: flex; flex-direction: column; }
.kiosk-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: rgba(255,255,255,.85); padding: 14px 24px; font-size: .95rem; }
.kiosk-body { flex: 1; display: grid; place-items: center; padding: 20px; }
.kiosk-card { background: #fff; border-radius: 24px; padding: 36px 32px; width: 100%; max-width: 480px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.kiosk-card.wide { max-width: 860px; }
.kiosk-card h1 { font-size: 1.8rem; color: var(--green); }
.kiosk-card h2 { font-size: 1.7rem; color: var(--green); }
.kiosk-card h3 { margin-top: 22px; font-size: 1.3rem; }
.kiosk-sub { color: var(--muted); font-size: 1.1rem; }
.kiosk-input { width: 100%; font-size: 2rem; text-align: center; letter-spacing: 4px; padding: 14px; border: 2px solid var(--line); border-radius: 14px; margin: 10px 0; direction: ltr; }
.kiosk-input:focus { outline: 3px solid #1B5FBF; outline-offset: 2px; border-color: var(--green-2); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 16px; }
.keypad button { font: inherit; font-size: 1.6rem; font-weight: 700; padding: 14px 0; border-radius: 14px; border: 1px solid var(--line); background: #f6f8f7; cursor: pointer; }
.keypad button:active { background: var(--green-soft); }
.kiosk-go { font-size: 1.2rem; padding: 14px 34px; border-radius: 14px; }
.kiosk-error { background: #fdf0ee; color: #8f2b20; border-radius: 12px; padding: 12px; margin: 10px 0; font-size: 1.05rem; }
.kiosk-warn { background: var(--gold-soft); color: #7a5b14; border-radius: 12px; padding: 10px; margin-top: 12px; }
.kiosk-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; text-align: right; margin-top: 14px; }
.kiosk-info div { background: var(--green-soft); border-radius: 12px; padding: 10px 14px; }
.kiosk-info small { display: block; color: var(--muted); }
.kiosk-info b { font-size: 1.05rem; }
.kiosk-models { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; margin: 16px 0; }
.kiosk-model { width: 120px; height: 150px; border-radius: 18px; border: 3px solid var(--gold); background: var(--gold-soft); font: inherit; font-size: 2.6rem; font-weight: 800; color: var(--green); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; transition: transform .12s; }
.kiosk-model span { font-size: 2rem; }
.kiosk-model:hover { transform: translateY(-4px) scale(1.04); }
.kiosk-confirm { margin: 22px 0 6px; font-size: 1.3rem; }
.kiosk-confirm b { display: block; font-size: 2.6rem; color: var(--green); margin: 6px 0 18px; }
.kiosk-cancel { margin-top: 18px; }
.kiosk-done { width: 90px; height: 90px; margin: 0 auto 12px; border-radius: 50%; background: var(--green); color: #fff; font-size: 3rem; display: grid; place-items: center; }
.live-toast { background: var(--green); }
.live-toast a { color: #fff; text-decoration: underline; margin-inline-start: 8px; font-weight: 700; }
.now-box { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: #f1ebfb; border: 2px solid #c9b4ee; border-radius: 14px; padding: 14px 18px; margin-bottom: 14px; }
.now-box small { display: block; color: var(--muted); }
.now-box b { font-size: 1.2rem; }
.now-box.idle { background: var(--green-soft); border-color: #bfe0d4; }
.kiosk-wait { font-size: 3.5rem; margin-bottom: 8px; }
.kiosk-input { direction: rtl; }
.kiosk-picks { display: grid; gap: 12px; margin: 16px 0; }
.kiosk-pick { font: inherit; text-align: right; padding: 16px 20px; border-radius: 16px; border: 2px solid var(--line); background: #fbfdfc; cursor: pointer; display: grid; gap: 2px; }
.kiosk-pick:hover { border-color: var(--green-2); background: var(--green-soft); }
.kiosk-pick b { font-size: 1.3rem; color: var(--green); }
.kiosk-pick small { color: var(--muted); }

/* ====== صفحة التقييم والمصحف ====== */
.hidden { display: none !important; }
.q-block { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 12px; background: #fcfdfd; }
.q-block.overall { background: var(--gold-soft); border-color: #ecdcb4; }
.q-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.q-head b { flex: 1; font-size: 1.05rem; }
.q-no { width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; }
.q-crits { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 10px; }
.q-crit { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.q-crit small { display: block; color: var(--muted); font-size: .78rem; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper input { width: 62px !important; min-width: 0 !important; text-align: center; padding: 6px 4px !important; -moz-appearance: textfield; font-weight: 700; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--green-soft); color: var(--green); font-size: 1.2rem; font-weight: 700; cursor: pointer; display: grid; place-items: center; padding: 0; }
.stepper button:disabled { opacity: .5; cursor: default; }
.sum-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 14px; }
.sum-grid div { background: var(--green-soft); border-radius: 12px; padding: 8px 12px; text-align: center; }
.sum-grid small { display: block; color: var(--muted); font-size: .8rem; }
.sum-grid b { font-size: 1.3rem; color: var(--green); }
.mushaf { font-family: 'Amiri Quran', 'Amiri', 'Traditional Arabic', serif; font-size: 23px; line-height: 2.2; text-align: right; padding: 12px 16px; margin: 10px 0 4px; border-radius: 14px; background: #FFFCF5; color: #2B2112; border: 1px solid #E7D6B0; box-shadow: inset 0 0 0 4px #FFFCF5, inset 0 0 0 5px #E7D6B0; }
.mushaf .sh { display: block; text-align: center; font-family: 'IBM Plex Sans Arabic', sans-serif; font-weight: 700; font-size: 15px; color: #7A5A1E; background: #F6EAD0; border-radius: 10px; padding: 3px 0; margin: 8px 0 4px; line-height: 1.6; }
.mushaf .bs { display: block; text-align: center; margin-bottom: 4px; }
.mushaf .an { color: #9A6B16; white-space: nowrap; }
.mushaf .more { display: block; margin: 6px auto 0; font-family: 'IBM Plex Sans Arabic', sans-serif; font-size: 13px; padding: 4px 16px; border-radius: 999px; border: 0; background: #F6EAD0; color: #7A5A1E; cursor: pointer; }
.mushaf .src { display: block; text-align: center; font-family: 'IBM Plex Sans Arabic', sans-serif; font-size: 11px; color: #a08a5e; line-height: 1.4; margin-top: 4px; }
table.q-edit { width: 100%; }
table.q-edit select { min-width: 160px; }
.wait-card { text-align: center; padding: 30px 20px; } .wait-card .btn { margin-top: 10px; }

/* =====================================================================
   هوية تذكرة: الألوان والواجهة الزجاجية (مأخوذة من منصة تذكرة)
   ===================================================================== */
:root {
  --green: #245A73; --green-2: #2F6F8C; --green-soft: #E2EEF3;
  --navy3: #173E52; --gold: #C49A55; --gold-2: #A67E3E; --gold-soft: #F6EEDD; --gold-t: #EBDDBE;
  --ink: #1B2B38; --muted: #5F6E79; --line: #DCE1DE; --bg: #EEF0EC;
  --gl: rgba(255,255,255,.58); --gl2: rgba(255,255,255,.82); --glb: rgba(255,255,255,.75);
  --gls: 0 10px 32px rgba(23,62,82,.10); --blur: blur(18px) saturate(150%);
  --shadow: var(--gls);
}
body {
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(47,111,140,.16), transparent 60%),
    radial-gradient(700px 500px at -10% 30%, rgba(196,154,85,.14), transparent 60%),
    radial-gradient(800px 600px at 50% 110%, rgba(35,120,106,.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
/* البطاقات الزجاجية */
.card, .stat, .model-card, .result-card, .q-block, .now-box.idle {
  background: var(--gl); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glb); box-shadow: var(--gls); border-radius: 24px;
}
.modal { background: var(--gl2); -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%); border: 1px solid var(--glb); border-radius: 26px; }
.modal-bg { background: rgba(10,18,24,.4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
th { background: rgba(255,255,255,.5); }
tr:hover td { background: rgba(255,255,255,.45); }
.btn { border-radius: 12px; }
.btn.primary { background: linear-gradient(135deg, var(--green-2), var(--navy3)); border-color: var(--green); }
.btn.gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); border-color: var(--gold); }
.step b { background: linear-gradient(135deg, var(--green-2), var(--navy3)); }
.step { background: var(--gl); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--glb); }

/* الواجهة العلوية: تدرج أزرق مع خط ذهبي وشارة الشعار */
.hero { background: linear-gradient(160deg, #3A7E9C 0%, var(--green) 45%, var(--navy3) 100%); border-bottom: 4px solid var(--gold); padding: 30px 16px 96px; }
.hero::after { display: none; }
.logo-badge { display: inline-grid; place-items: center; width: min(190px, 48vw); aspect-ratio: 1; border-radius: 34px; background: #fff; padding: 16px; box-shadow: 0 12px 30px rgba(0,0,0,.28), 0 0 0 3px var(--gold); }
.logo-badge img { width: 100%; height: 100%; object-fit: contain; }
.logo-badge.sm { width: 110px; border-radius: 24px; padding: 10px; }
.hero h1 { margin-top: 16px; }
.hero .ayah { color: var(--gold-t); }

/* بطاقة الزجاج الكبيرة وشريط العنوان */
.lcard { width: min(1100px, calc(100% - 32px)); margin: -56px auto 20px; position: relative; z-index: 2; display: flex; flex-direction: column; gap: 14px; padding: 22px; border-radius: 26px; background: var(--gl2); -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%); border: 1px solid var(--glb); box-shadow: 0 18px 44px rgba(23,62,82,.16); }
.lcard.narrow { width: min(440px, calc(100% - 32px)); }
.ptag { display: flex; align-items: center; gap: 8px; background: linear-gradient(135deg, var(--green-2), var(--navy3)); color: #fff; border-radius: 16px; padding: 11px 14px; font-weight: 700; }
.ptag svg { width: 20px; height: 20px; color: var(--gold-t); }
.lfoot { text-align: center; color: var(--muted); font-size: .8rem; }

/* بطاقات البوابات */
.gates { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.gate { display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(20,40,60,.08); text-align: center; color: var(--ink); transition: transform .15s, box-shadow .15s; }
.gate:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(20,40,60,.14); }
.gate .gtop { height: 104px; background: var(--pt); display: flex; align-items: center; justify-content: center; }
.gate .gic { width: 62px; height: 62px; border-radius: 20px; background: var(--pc); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 14px rgba(0,0,0,.14); }
.gate .gic svg { width: 30px; height: 30px; }
.gate b { display: block; margin: 14px 12px 6px; font-size: 1.05rem; color: var(--pc); line-height: 1.4; }
.gate small { display: block; margin: 0 14px; font-size: .8rem; line-height: 1.7; color: var(--muted); min-height: 44px; }
.gate .gart { margin-top: auto; height: 104px; display: flex; align-items: flex-end; justify-content: center; padding: 8px 10px 0; color: var(--pc); opacity: .55; }
.gate .gart svg { width: 100%; height: 96px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ic-svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* صفحة الدخول */
.auth-wrap { display: block; min-height: 100vh; padding: 0; background: none; }
.auth-wrap .hero { padding-bottom: 80px; }
.auth { margin: -48px auto 30px; width: min(440px, calc(100% - 32px)); position: relative; z-index: 2; background: var(--gl2); -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%); border: 1px solid var(--glb); box-shadow: 0 18px 44px rgba(23,62,82,.16); border-radius: 26px; }
.auth input { text-align: center; font-size: 1.05rem; border-radius: 14px; }
.auth input:focus { border: 2px solid var(--gold); outline: 3px solid #1B5FBF; outline-offset: 2px; }

/* القائمة الجانبية */
.side { background: linear-gradient(180deg, var(--green) 0%, var(--navy3) 100%); border-left: 3px solid var(--gold); }
.side .brand img { width: 46px; height: 46px; background: #fff; border-radius: 14px; padding: 5px; box-shadow: 0 0 0 2px var(--gold); }
.side a.active { color: var(--green); box-shadow: 0 0 0 2px var(--gold); }
.mobile-top { background: linear-gradient(135deg, var(--green), var(--navy3)); border-bottom: 3px solid var(--gold); }

/* شاشة الطالب */
.kiosk { background: linear-gradient(160deg, #3A7E9C 0%, var(--green) 45%, var(--navy3) 100%); }
.kiosk-card { background: var(--gl2); -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%); border: 1px solid var(--glb); border-radius: 28px; }
.kiosk-top { border-bottom: 3px solid var(--gold); }
.kiosk-top img { height: 30px; vertical-align: middle; margin-inline-end: 8px; }
.kiosk-model { border-color: var(--gold); background: var(--gold-soft); color: var(--green); }

@media (max-width: 860px) {
  .gates { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gate .gtop { height: 74px; } .gate .gic { width: 48px; height: 48px; border-radius: 16px; }
  .gate b { margin: 10px 6px 4px; font-size: .95rem; } .gate small { margin: 0 8px; font-size: .72rem; min-height: 38px; }
  .gate .gart { height: 64px; } .gate .gart svg { height: 60px; }
  .side { border-left: 0; }
}


/* =====================================================================
   مراجعة سهولة الاستخدام: أحجام اللمس، التركيز، التحقق، النوافذ
   ===================================================================== */
:focus-visible { outline: 3px solid #1B5FBF; outline-offset: 2px; }
.btn { min-height: 44px; }
.btn.sm { min-height: 44px; padding: 6px 14px; }
input:not([type=checkbox]):not([type=radio]), select { min-height: 44px; }
td.actions .btn + .btn, .actions .btn.danger { margin-inline-start: 8px; }
td.actions .btn.danger { margin-inline-start: 16px; }
.btn.gold, .btn.gold:hover { background: linear-gradient(135deg, #8A6420, #7A5416); border-color: #7A5416; color: #fff; } /* تباين 5.4:1 مع الأبيض */
.btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-solid:hover { background: #a93226; }
/* بوابة المحكّمين: أهداف لمس 48px على التابلت */
.shell[data-portal=judge] .btn, .shell[data-portal=judge] .btn.sm { min-height: 48px; padding-inline: 18px; }
.shell[data-portal=judge] .side a { min-height: 48px; display: flex; align-items: center; }
.stepper-wrap { display: grid; justify-items: center; gap: 4px; }
.stepper { gap: 10px; }
.stepper button { width: 48px; height: 48px; font-size: 1.5rem; }
.stepper input { width: 84px !important; height: 48px; font-size: 1.15rem; padding: 6px 4px !important; }
.stepper input.invalid { border-color: var(--red); background: #fff6f5; outline-color: rgba(192,57,43,.55); }
.field-err { color: #a5281b; font-weight: 700; font-size: .85rem; min-height: 0; text-align: center; }
.q-crits { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.q-crit { flex-wrap: wrap; row-gap: 6px; padding: 10px 12px; }
.q-crit > span:first-child { flex: 1 1 140px; }
.elig-list { display: grid; gap: 4px; justify-items: start; }
.elig-list .badge { white-space: normal; }
.keypad[hidden] { display: none; }
.keypad.letters { grid-template-columns: repeat(7, 1fr); gap: 8px; }
.keypad.letters button { font-size: 1.35rem; padding: 12px 0; }
.kiosk-switch { width: 100%; justify-content: center; margin-bottom: 12px; }
/* النوافذ */
.modal.confirm { max-width: 460px; }
.modal.confirm.wide { max-width: 560px; }
.confirm-msg { margin: 0 0 8px; line-height: 1.9; }
.confirm-list { margin: 0 0 8px; padding-inline-start: 22px; line-height: 1.9; color: #8f2b20; }
.dlg-table { width: 100%; margin-bottom: 4px; }
.dlg-table th, .dlg-table td { padding: 8px 10px; text-align: start; border-bottom: 1px solid var(--line); }
.dlg-table tfoot td { border-bottom: 0; font-size: 1.05rem; }
@media (max-width: 860px) {
  .toolbar select, .toolbar input { width: 100%; min-width: 0; }
  select { text-overflow: ellipsis; }
}
.result-big b { white-space: nowrap; }
@media (max-width: 480px) { .result-big b { font-size: 1.35rem; } }
