:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --ink: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #0f766e;
    --accent-ink: #ffffff;
    --accent-soft: #e6f4f2;
    --ok: #15803d;
    --ok-soft: #ecfdf3;
    --warn: #b45309;
    --warn-soft: #fff7ed;
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(17, 24, 39, .05), 0 1px 3px rgba(17, 24, 39, .06);
    --sec-analogy: #1d4ed8;   --sec-analogy-bg: #eff4ff;
    --sec-completion: #7e22ce; --sec-completion-bg: #f6f0ff;
    --sec-contextual: #b91c1c; --sec-contextual-bg: #fef2f2;
    --sec-odd: #b45309;       --sec-odd-bg: #fff7ed;
    --sec-reading: #0f766e;   --sec-reading-bg: #e6f4f2;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: 'Tajawal', system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.6;
}
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
[hidden] { display: none !important; }
svg.lucide { width: 18px; height: 18px; flex-shrink: 0; }

/* ── أزرار وحقول ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
    padding: .55rem 1rem; border-radius: 10px; font-weight: 700; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: #d1d5db; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #0d655e; border-color: #0d655e; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--danger); }

.field {
    width: 100%; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 10px;
    background: var(--surface); font-size: 1rem; font-weight: 500;
}
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .14); }
textarea.field { resize: vertical; line-height: 1.8; min-height: 84px; }
.label { display: block; font-size: .82rem; font-weight: 800; color: var(--muted); margin-bottom: .35rem; }
.muted { color: var(--muted); font-size: .85rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); font-weight: 600; }

.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.badge.draft { background: var(--warn-soft); color: var(--warn); }
.badge.ready { background: var(--ok-soft); color: var(--ok); }
.badge.off { background: var(--danger-soft); color: var(--danger); }
.sec-analogy { background: var(--sec-analogy-bg); color: var(--sec-analogy); }
.sec-completion { background: var(--sec-completion-bg); color: var(--sec-completion); }
.sec-contextual { background: var(--sec-contextual-bg); color: var(--sec-contextual); }
.sec-odd { background: var(--sec-odd-bg); color: var(--sec-odd); }
.sec-reading { background: var(--sec-reading-bg); color: var(--sec-reading); }

/* ── الدخول ── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 380px; padding: 2rem 1.6rem; }
.login-card h1 { margin: 0 0 .25rem; font-size: 1.4rem; font-weight: 900; }
.login-card p { margin: 0 0 1.4rem; }
.login-card .field { text-align: center; font-size: 1.1rem; letter-spacing: .02em; }
#code-input { letter-spacing: .5em; font-weight: 800; font-size: 1.4rem; }
.login-card .btn { width: 100%; margin-top: .8rem; padding: .7rem; }
.login-msg { min-height: 1.4rem; margin-top: .8rem; font-size: .88rem; font-weight: 700; text-align: center; }
.login-msg.error { color: var(--danger); }
.login-msg.info { color: var(--muted); }

/* ── الشريط العلوي ── */
.topbar {
    position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1440px; margin: 0 auto; padding: .7rem 1.2rem; display: flex; align-items: center; gap: .8rem; }
.brand { font-weight: 900; font-size: 1.1rem; display: flex; align-items: center; gap: .5rem; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
.who { font-size: .85rem; color: var(--muted); font-weight: 700; }

main { max-width: 1440px; margin: 0 auto; padding: 1.2rem; }

/* ── الرئيسية ── */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; }
.tab { border: none; background: none; padding: .6rem 1rem; font-weight: 800; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat strong { display: block; font-size: 1.6rem; font-weight: 900; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .82rem; font-weight: 700; }
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem; }
.exam-card { cursor: pointer; transition: border-color .15s, transform .15s; }
.exam-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.exam-card { position: relative; }
.exam-card .card-del { position: absolute; top: .6rem; left: .6rem; opacity: 0; transition: opacity .15s; }
.exam-card:hover .card-del, .exam-card .card-del:focus { opacity: 1; }
@media (hover: none) { .exam-card .card-del { opacity: 1; } }
.exam-card h3 { margin: 0 0 .5rem; font-size: 1rem; font-weight: 900; }
.progress-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem; }
.bar { height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: .35rem; }
.bar > div { height: 100%; background: var(--accent); border-radius: 99px; }
.section-title { display: flex; align-items: center; gap: .5rem; margin: 1.1rem 0 .6rem; font-weight: 800; }

/* ── المحرر ── */
.editor-head { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.title-input { flex: 1; min-width: 200px; font-size: 1.2rem; font-weight: 900; border: 1px solid transparent; background: transparent; padding: .35rem .5rem; border-radius: 8px; }
.title-input:hover, .title-input:focus { border-color: var(--line); background: var(--surface); outline: none; }
.editor-meta { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.editor { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr); gap: 1rem; align-items: start; }

.sections { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.sec-btn { border: 1px solid var(--line); background: var(--surface); padding: .45rem .9rem; border-radius: 99px; font-weight: 800; font-size: .88rem; cursor: pointer; color: var(--muted); }
.sec-btn.active { border-color: currentColor; box-shadow: 0 0 0 1px currentColor inset; }
.sec-btn.active.sec-analogy { background: var(--sec-analogy-bg); color: var(--sec-analogy); }
.sec-btn.active.sec-completion { background: var(--sec-completion-bg); color: var(--sec-completion); }
.sec-btn.active.sec-contextual { background: var(--sec-contextual-bg); color: var(--sec-contextual); }
.sec-btn.active.sec-odd { background: var(--sec-odd-bg); color: var(--sec-odd); }
.sec-btn.active.sec-reading { background: var(--sec-reading-bg); color: var(--sec-reading); }

.options { display: flex; flex-direction: column; gap: .5rem; margin: .4rem 0 1rem; }
.option { display: flex; align-items: center; gap: .5rem; }
.pick {
    width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface);
    font-weight: 900; color: var(--muted); cursor: pointer; flex-shrink: 0; font-size: 1rem;
}
.pick:hover { border-color: var(--ok); }
.option.correct .pick { background: var(--ok); border-color: var(--ok); color: #fff; }
.option.correct .field { border-color: var(--ok); background: var(--ok-soft); }
.hints { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); font-weight: 600; margin-top: .7rem; }
kbd { background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 .35rem; font-family: inherit; font-size: .75rem; }
.edit-banner { display: flex; align-items: center; justify-content: space-between; gap: .5rem; background: var(--warn-soft); color: var(--warn); font-weight: 800; font-size: .88rem; padding: .55rem .8rem; border-radius: 10px; margin-bottom: 1rem; }
details summary { cursor: pointer; }

.passage { border: 1px solid #b7ded9; background: #f7fbfa; border-radius: var(--radius); padding: .9rem; margin-bottom: 1rem; }
.passage-text { white-space: pre-wrap; line-height: 1.95; max-height: 140px; overflow: hidden; }
.passage-text.expanded { max-height: none; }
.results { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; max-height: 280px; overflow: auto; }
.result { padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.result:hover { border-color: var(--accent); }
.pq { display: flex; align-items: center; gap: .5rem; padding: .5rem .65rem; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; font-size: .88rem; }
.pq + .pq { margin-top: .35rem; }

.qlist { display: flex; flex-direction: column; gap: .45rem; max-height: calc(100vh - 220px); overflow: auto; }
.q { border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; background: var(--surface); }
.q.editing { border-color: var(--warn); background: var(--warn-soft); }
.q-top { display: flex; align-items: center; gap: .4rem; }
.q-num { font-weight: 900; color: var(--muted); min-width: 1.6rem; font-size: .85rem; }
.q-text { font-weight: 700; font-size: .9rem; margin: .3rem 0 .1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-ans { font-size: .8rem; font-weight: 800; color: var(--ok); }
.q-actions { margin-inline-start: auto; display: flex; gap: .1rem; }
.icon-btn { border: none; background: none; padding: .3rem; border-radius: 6px; cursor: pointer; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.icon-btn svg.lucide { width: 16px; height: 16px; }
.group-label { display: flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 800; color: var(--accent); margin: .3rem .2rem 0; }
.group-label svg.lucide { width: 14px; height: 14px; }

/* ── استيراد فورم ── */
.imp-heading { margin: 0; font-size: 1.2rem; font-weight: 900; }
.imp-summary { margin-bottom: 1rem; }
.imp-passage { border: 1px solid #b7ded9; background: #f7fbfa; border-radius: var(--radius); padding: .9rem; margin: 1.2rem 0 .6rem; }
.imp-passage textarea { min-height: 120px; background: #fff; }
.imp-q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; margin-bottom: .6rem; }
.imp-q.excluded { opacity: .45; }
.imp-q.invalid { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(185, 28, 28, .15); }
.imp-q.in-passage { margin-inline-start: 1.2rem; border-inline-start: 3px solid #b7ded9; }
.imp-q-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.imp-q-head select { width: auto; padding: .3rem .5rem; font-size: .85rem; font-weight: 700; }
.imp-q textarea { min-height: 52px; }
.imp-q .options { margin: .5rem 0 0; }
.imp-q .pick { width: 34px; height: 34px; font-size: .9rem; }
.imp-q .option .field { padding: .45rem .7rem; font-size: .95rem; }
.flag { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 800; }
.flag.red { background: var(--danger-soft); color: var(--danger); }
.flag.yellow { background: var(--warn-soft); color: var(--warn); }
.flag.blue { background: #eff4ff; color: #1d4ed8; }
.flag.green { background: var(--ok-soft); color: var(--ok); }
/* ── تبويب الأسئلة: شبكة بطاقات (4 في الشاشات العريضة، وتقل حسب العرض) ── */
#ql-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .7rem; align-items: start; max-height: none; }
#ql-list > .empty { grid-column: 1 / -1; }
#ql-list .q { display: flex; flex-direction: column; height: 100%; padding: .65rem .75rem; }
#ql-list .q-top { flex-wrap: wrap; row-gap: .25rem; }
#ql-list .q-text { font-size: .88rem; margin: .35rem 0 .3rem; }
#ql-list .cmp-opt { padding: .2rem .5rem; margin-top: .25rem; font-size: .82rem; }
#ql-list .q > .row:last-child { margin-top: auto !important; padding-top: .5rem; }
#ql-list .q .btn-sm { font-size: .75rem; padding: .2rem .5rem; }
@media (min-width: 1500px) { #ql-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ── الفورمات: شبكة بطاقات ── */
#fm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; align-items: stretch; }
#fm-list > .empty { grid-column: 1 / -1; }
.form-card { display: flex; flex-direction: column; gap: .45rem; padding: .75rem .85rem; box-shadow: none; }
.form-card.status-done { background: var(--ok-soft); border-color: #bbf7d0; }
.form-card.status-problem { border-color: #fecaca; }
.form-num { font-weight: 900; color: var(--muted); }
.form-title { font-size: .95rem; line-height: 1.6; }
.form-meta { font-size: .78rem; }
.form-actions { margin-top: auto; gap: .35rem; }
.form-actions .btn { flex: 1; }
@media (min-width: 1500px) { #fm-list { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ── الأسئلة الناقصة: شبكة بطاقات ── */
#inc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .7rem; align-items: stretch; }
#inc-list > .empty { grid-column: 1 / -1; }
.inc-card { display: flex; flex-direction: column; gap: .45rem; padding: .8rem .9rem; box-shadow: none; }
.inc-card-text { font-weight: 700; font-size: .9rem; line-height: 1.8; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.inc-card-meta { font-size: .78rem; }
.inc-card .btn { margin-top: auto; }
@media (min-width: 1500px) { #inc-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ── تبويب القطع: شبكة بطاقات بالطريقة نفسها ── */
#pl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .7rem; align-items: stretch; }
#pl-list > .empty { grid-column: 1 / -1; }
.passage-card { display: flex; flex-direction: column; gap: .45rem; padding: .8rem .9rem; cursor: pointer; transition: border-color .15s, transform .15s; }
.passage-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.passage-card-title { font-size: .95rem; }
.passage-card-excerpt { font-size: .84rem; line-height: 1.8; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.passage-card-badges { gap: .3rem; margin-top: auto; }
.passage-card-single { font-size: .78rem; }
@media (min-width: 1500px) { #pl-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ── المقارنة المتجاورة ── */
.cmp-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .7rem; }
.cmp-score { font-weight: 900; padding: .15rem .6rem; border-radius: 99px; font-size: .85rem; }
.cmp-score.high { background: #eff4ff; color: #1d4ed8; }
.cmp-score.mid { background: var(--warn-soft); color: var(--warn); }
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.cmp-col { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; background: var(--surface-2); min-width: 0; }
.cmp-label { font-size: .78rem; font-weight: 800; color: var(--muted); margin-bottom: .4rem; }
.cmp-text { font-weight: 700; line-height: 1.9; margin-bottom: .5rem; }
.cmp-text.passage { font-weight: 500; max-height: 320px; overflow: auto; white-space: normal; }
.cmp-opt { padding: .3rem .55rem; border: 1px solid var(--line); border-radius: 8px; margin-top: .3rem; background: var(--surface); font-size: .9rem; }
.cmp-opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.cmp-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .9rem; }
mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 .1rem; }
.flag-btn { border: none; cursor: pointer; font-family: inherit; }
.flag-btn:hover { filter: brightness(.95); text-decoration: underline; }
.badge.link { background: #eff4ff; color: #1d4ed8; }
.group-label .btn { padding: .1rem .5rem; font-size: .75rem; }
@media (max-width: 700px) { .cmp-grid { grid-template-columns: 1fr; } }

.form-warning { width: 100%; margin-top: .5rem; padding: .5rem .75rem; border-radius: 9px; background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: .85rem; }
.form-warning.red { background: var(--danger-soft); color: var(--danger); }
.imp-q .form-warning { margin: 0 0 .6rem; }
.inc-item { display: flex; align-items: center; gap: .6rem; }
.inc-item + .inc-item { margin-top: .5rem; }
.imp-bar {
    position: sticky; bottom: 0; z-index: 40; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    background: rgba(245, 246, 248, .95); backdrop-filter: blur(6px); border-top: 1px solid var(--line);
    padding: .8rem 0; margin-top: .6rem;
}

/* ── النوافذ والتنبيهات ── */
.modal { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow: auto; }
.modal-card { background: var(--surface); border-radius: 14px; width: 100%; max-width: 760px; padding: 1.3rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .2); }
.modal-card.narrow { max-width: 440px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-head h2 { margin: 0; font-size: 1.1rem; font-weight: 900; }
.dup { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; margin-bottom: .6rem; }
.pv-q { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.pv-q h4 { margin: .3rem 0 .6rem; font-size: 1rem; font-weight: 800; line-height: 1.8; }
.pv-opt { padding: .5rem .8rem; border: 1px solid var(--line); border-radius: 9px; margin-top: .35rem; font-weight: 600; }
.show-answers .pv-opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.pv-passage { white-space: pre-wrap; line-height: 2; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .9rem; margin-top: 1rem; }
.pv-expl { display: none; margin-top: .5rem; }
.show-answers .pv-expl { display: block; }

.users-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.users-table th, .users-table td { padding: .55rem .4rem; border-bottom: 1px solid var(--line); text-align: right; }
.users-table th { color: var(--muted); font-size: .78rem; font-weight: 800; }
.users-table td.phone { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }

.toasts { position: fixed; bottom: 1.2rem; left: 1.2rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; max-width: min(380px, calc(100vw - 2.4rem)); }
.toast { background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 10px; font-weight: 700; font-size: .9rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); animation: toast-in .2s ease-out; }
.toast.success { background: #14532d; }
.toast.error { background: #7f1d1d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1000px) {
    .editor { grid-template-columns: 1fr; }
    .qlist { max-height: none; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    main { padding: .8rem; }
    .topbar-inner { padding: .6rem .8rem; }
    .who { display: none; }
}

/* نوع سؤال الاستيعاب */
.st-field { width: auto; max-width: 210px; }
.st-chip { font: inherit; font-size: .78rem; padding: .1rem .35rem; border-radius: 999px; border: 1px dashed var(--border, #cbd5e1); background: transparent; color: inherit; cursor: pointer; max-width: 190px; }
.st-chip.manual { border-style: solid; border-color: #6366f1; color: #4338ca; }

.ai-suspect { margin-top: .4rem; padding: .4rem .6rem; border-radius: 8px; background: #fef2f2; color: #991b1b; font-size: .85rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* أدوات الإصلاح اليدوي في المراجعة */
.tool-btn { padding: .2rem .55rem; flex-shrink: 0; }
.tool-menu { display: grid; gap: .5rem; }
.tool-menu .btn { justify-content: flex-start; text-align: start; }
.w-actions { display: inline-flex; gap: .35rem; flex-wrap: wrap; margin-inline-start: .5rem; }
.tp-item { display: block; width: 100%; text-align: start; margin-bottom: .4rem; white-space: normal; }

/* نماذج الصور وبانتظار الإجابات */
.badge.awaiting { background: #fef3c7; color: #92400e; }
.author-note { margin: .4rem 0; padding: .45rem .7rem; border-radius: 8px; background: #fffbeb; border: 1px dashed #f59e0b; color: #78350f; font-size: .88rem; white-space: pre-wrap; }
.img-strip { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-top: .6rem; }
.img-thumb { padding: 0; border: 1px solid var(--border, #e2e8f0); border-radius: 6px; background: #fff; cursor: zoom-in; width: 70px; height: 90px; overflow: hidden; }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.img-full img { width: 100%; height: auto; display: block; }
.aw-head { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.aw-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; }
.aw-images { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; display: grid; gap: .5rem; }
.aw-img { padding: 0; border: 1px solid var(--border, #e2e8f0); border-radius: 6px; cursor: zoom-in; background: #fff; }
.aw-img img { width: 100%; display: block; }
.aw-q { background: var(--card, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: 12px; padding: .8rem; margin-bottom: .7rem; }
.aw-q.answered { border-color: #86efac; }
.aw-opts { display: grid; gap: .35rem; }
.aw-opt { display: flex; gap: .5rem; align-items: center; text-align: start; padding: .45rem .6rem; border: 1px solid var(--border, #e2e8f0); border-radius: 8px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.aw-opt:hover { border-color: #16a34a; }
.aw-opt.correct { background: #f0fdf4; border-color: #16a34a; font-weight: 600; }
.aw-passage { background: var(--card, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: 12px; padding: .7rem .9rem; margin-bottom: .7rem; }
.aw-passage summary { cursor: pointer; font-weight: 600; }
.aw-passage-text { white-space: pre-wrap; line-height: 1.9; margin-top: .5rem; }
@media (max-width: 900px) { .aw-layout { grid-template-columns: 1fr; } .aw-images { position: static; max-height: none; grid-template-columns: repeat(3, 1fr); } }

/* المراجعة السريعة */
.qr-top { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.qr-barwrap { height: 6px; background: var(--border, #e2e8f0); border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
#qr-bar { height: 100%; background: #16a34a; width: 0; transition: width .2s; }
.qr-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.qr-card { padding: 1.4rem; }
.qr-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.qr-text { font-size: 1.45rem; font-weight: 700; line-height: 1.8; margin: .6rem 0 1rem; white-space: pre-wrap; }
.qr-opts { display: grid; gap: .5rem; }
.qr-opt { display: flex; gap: .7rem; align-items: center; text-align: start; padding: .75rem 1rem; font: inherit; font-size: 1.15rem; border: 2px solid var(--border, #e2e8f0); border-radius: 12px; background: transparent; color: inherit; cursor: pointer; }
.qr-opt:hover { border-color: #16a34a; }
.qr-opt.correct { background: #f0fdf4; border-color: #16a34a; font-weight: 700; }
.qr-opt kbd { opacity: .55; }
.qr-let { font-weight: 700; min-width: 1.2em; }
.qr-check { margin-inline-start: auto; color: #16a34a; font-size: 1.3rem; }
.qr-passage { margin-bottom: .6rem; background: #f8fafc; border-radius: 10px; padding: .6rem .8rem; }
.qr-passage summary { cursor: pointer; font-weight: 600; }
.qr-passage-text { white-space: pre-wrap; line-height: 1.9; margin-top: .5rem; max-height: 260px; overflow-y: auto; }
.qr-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.qr-actions .btn-primary { margin-inline-start: auto; }
#qr-flag.active { background: #fef3c7; border-color: #f59e0b; }
.qr-help { margin-top: .6rem; font-size: .85rem; }
.qr-images { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; display: grid; gap: .5rem; padding: .5rem; }
.qr-images img { width: 100%; display: block; border-radius: 6px; }
kbd { font-family: inherit; font-size: .78em; padding: .05rem .35rem; border: 1px solid var(--border, #cbd5e1); border-radius: 4px; background: #f8fafc; color: #334155; }
.qr-table { width: 100%; border-collapse: collapse; margin-bottom: .8rem; }
.qr-table td, .qr-table th { padding: .35rem .5rem; border-bottom: 1px solid var(--border, #e2e8f0); text-align: start; }
@media (max-width: 900px) { .qr-layout { grid-template-columns: 1fr; } .qr-images { position: static; max-height: none; } }

.qr-formnav { display: flex; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.qr-formnav select { flex: 1; min-width: 0; }
.qr-end { text-align: center; padding: 1.5rem .5rem; }
.qr-end-icon { font-size: 2.6rem; }
.qr-end h2 { margin: .4rem 0 0; }
.qr-end-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }

/* إضافة سؤال / قطعة */
.ins-opts { display: grid; gap: .35rem; margin-top: .4rem; }
.ins-opt { display: flex; gap: .4rem; align-items: center; }
.ins-opt .field { flex: 1; }
.ins-places { margin-top: .8rem; padding: .6rem .8rem; background: #f8fafc; border-radius: 10px; font-size: .9rem; }
.ins-places ul { margin: .3rem 0; padding-inline-start: 1.2rem; }
.ins-q { border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: .6rem .8rem; margin-top: .7rem; }

.att-item { border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .6rem; }
.att-text { font-weight: 600; margin: .35rem 0 .2rem; white-space: pre-wrap; }
