/* ذاكرة التعليم العُماني — هوية «الكرّاسة والسبّورة»
   تخطيط: سبّورة علوية بجدار أغلفة متحرك ← شريط حقائق بقلم التصحيح ← بطاقات فهرسة للذاكرات ← أدوات البحث على ورق مسطّر */
:root{
  --paper:#f6f7f2; --sheet:#ffffff; --rule:#d5e0ea; --margin:#e3a1a1;
  --ink:#1b2430; --ink2:#4a5664; --pencil:#7b8592;
  --board:#1f3a32; --board2:#2a4a40; --chalk:#eef1e8; --chalk2:#b9c9be;
  --red:#b8262d; --red-soft:#f6dcdc; --hl:#f2cd5c; --hl-soft:#fbefc4;
  --ok:#2f6b4a; --warn:#8a5a00;
  --s1:#1f3a32; --s2:#3f7a68; --s3:#86b3a3; --s4:#d6e6df;
  --f-disp:"Aref Ruqaa","Amiri","Traditional Arabic",serif;
  --f-body:"IBM Plex Sans Arabic","Segoe UI","Tahoma",sans-serif;
  --f-quote:"Amiri","Traditional Arabic",serif;
  color-scheme:light;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --paper:#141b19; --sheet:#1a2320; --rule:#263330; --margin:#5a2c2c;
  --ink:#e9ece6; --ink2:#b4bfb8; --pencil:#8b978f;
  --board:#0f1d19; --board2:#183029; --chalk:#eef1e8; --chalk2:#a9bcb0;
  --red:#ef7f7a; --red-soft:#3a2122; --hl:#e7c35a; --hl-soft:#3a3320;
  --ok:#7fc79f; --warn:#e0b04a;
  --s1:#d6e6df; --s2:#86b3a3; --s3:#3f7a68; --s4:#22403a; color-scheme:dark}}
:root[data-theme="dark"]{
  --paper:#141b19; --sheet:#1a2320; --rule:#263330; --margin:#5a2c2c;
  --ink:#e9ece6; --ink2:#b4bfb8; --pencil:#8b978f;
  --board:#0f1d19; --board2:#183029; --chalk:#eef1e8; --chalk2:#a9bcb0;
  --red:#ef7f7a; --red-soft:#3a2122; --hl:#e7c35a; --hl-soft:#3a3320;
  --ok:#7fc79f; --warn:#e0b04a;
  --s1:#d6e6df; --s2:#86b3a3; --s3:#3f7a68; --s4:#22403a; color-scheme:dark}

.oem{direction:rtl;font-family:var(--f-body);color:var(--ink);font-size:16.5px;line-height:1.85}
.oem *{box-sizing:border-box}
.oem a{color:inherit}
.oem :focus-visible{outline:3px solid var(--hl);outline-offset:2px;border-radius:3px}
.oem .ltr{direction:ltr;unicode-bidi:isolate;display:inline-block}
.oem .num{font-variant-numeric:tabular-nums}
.oem h1,.oem h2,.oem h3{text-wrap:balance;margin:0}
.oem .disp{font-family:var(--f-disp);font-weight:700;letter-spacing:0}
.oem .wrapx{max-width:1180px;margin-inline:auto;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));box-sizing:border-box}
.oem .wrapx .wrapx{padding-left:0;padding-right:0}
.oem .muted{color:var(--pencil);font-size:.88rem}

/* ورق مسطّر بهامش أحمر */
.oem .sheet{background:var(--sheet);background-image:linear-gradient(to left,transparent 44px,var(--margin) 44px,var(--margin) 46px,transparent 46px),repeating-linear-gradient(to bottom,transparent 0 31px,var(--rule) 31px 32px);
  border:1px solid var(--rule);border-radius:4px;padding:1.4rem 1.4rem 1.6rem;padding-inline-start:64px}
.oem .sheet>h2{font-family:var(--f-disp);font-size:1.7rem;color:var(--red);margin-bottom:.4rem;font-weight:700}

/* السبّورة */
.oem .board{background:var(--board);color:var(--chalk);position:relative;overflow:hidden;border-radius:0 0 6px 6px}
.oem .board .in{position:relative;z-index:2;padding-block:2.2rem 1.4rem}
.oem .board h1{font-family:var(--f-disp);font-size:clamp(2.2rem,5.6vw,4.1rem);line-height:1.25;color:var(--chalk);font-weight:700}
.oem .board h1 em{font-style:normal;color:var(--hl)}
.oem .board p.lead{max-width:44rem;color:var(--chalk2);font-size:1.08rem;margin:.6rem 0 1.1rem}
.oem .wall{position:absolute;inset:0;z-index:1;display:flex;flex-direction:column;justify-content:center;gap:12px;opacity:.22;pointer-events:none;mask-image:linear-gradient(to left,transparent,#000 35%,#000 65%,transparent)}
.oem .wall .row{display:flex;gap:12px;width:max-content}
.oem .wall img{height:118px;width:auto;aspect-ratio:3/4;object-fit:cover;border-radius:2px;filter:grayscale(.35) contrast(1.05)}
@media (prefers-reduced-motion:no-preference){
  .oem .wall .row{animation:oemDrift 140s linear infinite}
  .oem .wall .row:nth-child(2){animation-duration:180s;animation-direction:reverse}
  .oem .wall .row:nth-child(3){animation-duration:160s}
  .oem .ticker .track{animation:oemTick 70s linear infinite}
  .oem .reveal{animation:oemUp .5s ease-out both}
}
@keyframes oemDrift{from{transform:translateX(0)}to{transform:translateX(50%)}}
@keyframes oemTick{from{transform:translateX(0)}to{transform:translateX(50%)}}
@keyframes oemUp{from{transform:translateY(8px);opacity:.4}to{transform:none;opacity:1}}

/* صندوق السؤال */
.oem .askbox{display:flex;gap:.5rem;flex-wrap:wrap;max-width:46rem}
.oem .askbox input{flex:1 1 18rem;min-width:0;font:inherit;font-size:1.05rem;padding:.7rem 1rem;border-radius:4px;border:2px solid var(--chalk2);background:rgba(255,255,255,.06);color:var(--chalk)}
.oem .askbox input::placeholder{color:var(--chalk2)}
.oem .btn{font:inherit;cursor:pointer;border:0;border-radius:4px;padding:.55rem 1.1rem;min-height:44px;background:var(--red);color:#fff;font-weight:600;display:inline-flex;align-items:center;gap:.4rem;text-decoration:none}
.oem .btn.ghost{background:transparent;color:inherit;border:1.5px solid currentColor}
.oem .btn.hl{background:var(--hl);color:#1b2430}
.oem .btn:disabled{opacity:.55;cursor:default}
.oem .chips{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.8rem}
.oem .chip{font:inherit;font-size:.85rem;border-radius:999px;padding:.2rem .75rem;border:1px solid var(--rule);background:var(--sheet);color:var(--ink2);cursor:pointer;text-decoration:none;display:inline-block;line-height:1.7}
.oem .board .chip{background:transparent;border-color:var(--chalk2);color:var(--chalk2)}
.oem .chip:hover{border-color:var(--red);color:var(--red)}
.oem .stamp{display:inline-block;font-size:.72rem;font-weight:700;letter-spacing:.02em;padding:0 .45rem;border:1.5px solid currentColor;border-radius:3px;transform:rotate(-2deg);line-height:1.6;white-space:nowrap}
.oem .stamp.full{color:var(--ok)}.oem .stamp.sample{color:var(--warn)}.oem .stamp.cand{color:var(--red)}.oem .stamp.pages{color:var(--ok)}

/* شريط الحقائق */
.oem .ticker{background:var(--red);color:#fff;overflow:hidden;white-space:nowrap;font-size:.95rem}
.oem .ticker .track{display:inline-flex;gap:3rem;padding:.45rem 0;width:max-content}
.oem .ticker b{font-variant-numeric:tabular-nums}

/* الذاكرة بالأرقام: دفتر درجات، والمجموع تحته خطّان */
.oem .ledger .tally{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px}
.oem .ledger .tally .c{background:var(--sheet);border:1px solid var(--rule);border-top:3px solid var(--red);border-radius:3px;padding:1rem 1.2rem 1.1rem;min-width:0}
.oem .ledger .v b{display:inline-block;font-variant-numeric:tabular-nums;font-weight:700;line-height:1.15;direction:ltr;unicode-bidi:isolate}
.oem .ledger .tally .v b{font-size:clamp(2.5rem,6.2vw,3.9rem);color:var(--red);padding-bottom:.18rem;border-bottom:4px double var(--red)}
.oem .ledger .tally .l{font-family:var(--f-disp);font-size:1.55rem;font-weight:700;margin-top:.35rem}
.oem .ledger .x{color:var(--ink2);font-size:.88rem;line-height:1.7}
.oem .ledger .reg{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));margin-top:14px;background:var(--sheet);border:1px solid var(--rule);border-radius:3px;overflow:hidden}
.oem .ledger .reg .c{padding:.85rem 1.1rem .95rem;border-bottom:1px solid var(--rule);border-inline-start:1px solid var(--rule);margin-inline-start:-1px;margin-bottom:-1px;min-width:0}
.oem .ledger .reg .v b{font-size:1.9rem;color:var(--ink)}
.oem .ledger .reg .l{font-weight:700;color:var(--s2);font-size:.98rem}
.oem .ledger .reg .x{font-size:.82rem;color:var(--pencil)}
.oem .ledger .join{display:flex;flex-wrap:wrap;gap:.8rem 1.4rem;align-items:center;justify-content:space-between;margin-top:14px;padding:1rem 1.2rem;background:var(--hl-soft);border:1px dashed var(--warn);border-radius:3px}
.oem .ledger .join p{margin:0;max-width:44rem;min-width:0;flex:1 1 20rem}
.oem .ledger .join .acts{display:flex;gap:.5rem;flex-wrap:wrap}
@media (max-width:860px){.oem .ledger .reg{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:360px){.oem .ledger .reg{grid-template-columns:1fr}}

/* الشبكة والبطاقات */
.oem .sec{padding-block:2rem .5rem}
.oem .sec>h2{font-family:var(--f-disp);font-size:2rem;color:var(--ink);margin-bottom:.2rem;font-weight:700}
.oem .sec>p.sub{color:var(--ink2);max-width:52rem;margin:.1rem 0 1rem}
.oem .cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:14px}
/* بطاقة الفهرسة المكتبية: ثقب، رقم ديوي، سطر أحمر علوي */
.oem .ccard{position:relative;background:var(--sheet);border:1px solid var(--rule);border-radius:3px;padding:.75rem 1rem .8rem;text-decoration:none;color:var(--ink);display:flex;flex-direction:column;gap:.25rem;min-width:0;
  background-image:linear-gradient(var(--red),var(--red)),repeating-linear-gradient(to bottom,transparent 0 25px,var(--rule) 25px 26px);background-size:100% 2px,100% 100%;background-position:0 2.6rem,0 2.6rem;background-repeat:no-repeat,no-repeat;transition:transform .15s,box-shadow .15s}
.oem .ccard::after{content:"";position:absolute;inset-block-end:.55rem;inset-inline-end:50%;width:11px;height:11px;border-radius:50%;background:var(--paper);border:1px solid var(--rule)}
.oem .ccard:hover{transform:translateY(-3px);box-shadow:0 6px 0 -2px var(--rule)}
.oem .ccard .top{display:flex;justify-content:space-between;gap:.5rem;align-items:baseline;min-height:1.9rem}
.oem .ccard .ddc{font-size:.78rem;color:var(--red);font-variant-numeric:tabular-nums;white-space:nowrap}
.oem .ccard .facet{font-size:.74rem;color:var(--pencil)}
.oem .ccard h3{font-family:var(--f-disp);font-size:1.5rem;line-height:1.35;margin-top:.45rem;font-weight:700}
.oem .ccard .d{font-size:.84rem;color:var(--ink2);line-height:1.75;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.oem .ccard .m{display:flex;gap:.9rem;font-size:.82rem;color:var(--pencil);margin-top:.15rem;margin-bottom:.9rem}
.oem .ccard .m b{color:var(--ink);font-variant-numeric:tabular-nums}
.oem .spark{width:100%;height:38px;display:block}

/* لوحات العرض */
.oem .crumbs{font-size:.85rem;color:var(--pencil);margin:1rem 0 .3rem}
.oem .crumbs a{color:var(--red);text-decoration:none}
.oem .hd h1{font-family:var(--f-disp);font-size:clamp(2rem,4.5vw,3rem);color:var(--ink);line-height:1.3;font-weight:700}
.oem .hd .meta{display:flex;flex-wrap:wrap;gap:.4rem 1rem;color:var(--ink2);font-size:.86rem;margin:.3rem 0 .6rem}
.oem .kpis{display:flex;flex-wrap:wrap;gap:0;border-block:1px solid var(--rule);margin:1rem 0}
.oem .kpi{flex:1 1 9rem;padding:.6rem .9rem;border-inline-start:1px solid var(--rule)}
.oem .kpi:first-child{border-inline-start:0}
.oem .kpi b{display:block;font-size:1.6rem;font-variant-numeric:tabular-nums;color:var(--ink);line-height:1.3}
.oem .kpi span{font-size:.8rem;color:var(--pencil)}
.oem .grid2{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,460px),1fr));gap:16px;align-items:start}
.oem .panel{background:var(--sheet);border:1px solid var(--rule);border-radius:4px;padding:1rem 1.1rem;min-width:0}
.oem .panel>h3{font-size:1.05rem;margin-bottom:.15rem}
.oem .panel>.how{font-size:.8rem;color:var(--pencil);margin-bottom:.6rem}
.oem .note{border-inline-start:3px solid var(--hl);background:var(--hl-soft);padding:.55rem .9rem;border-radius:2px;font-size:.88rem;color:var(--ink);margin:.8rem 0}
.oem .note.red{border-color:var(--red);background:var(--red-soft)}
.oem .scroll{overflow-x:auto;max-width:100%}
.oem table.t{border-collapse:collapse;width:100%;font-size:.88rem}
.oem table.t th,.oem table.t td{border-bottom:1px solid var(--rule);padding:.35rem .5rem;text-align:start;vertical-align:top}
.oem table.t th{color:var(--pencil);font-weight:600;white-space:nowrap;font-size:.8rem}
.oem table.t td.n{font-variant-numeric:tabular-nums;white-space:nowrap}
.oem table.t tr.click{cursor:pointer}.oem table.t tr.click:hover td{background:var(--hl-soft)}
.oem .bars .r{display:grid;grid-template-columns:minmax(6rem,11rem) 1fr auto;gap:.5rem;align-items:center;font-size:.84rem;margin:.18rem 0}
.oem .bars .r .l{color:var(--ink2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.oem .bars .r i{display:block;height:12px;background:var(--s2);border-radius:1px;min-width:2px}
.oem .bars .r .v{font-variant-numeric:tabular-nums;color:var(--pencil);font-size:.8rem}
.oem svg text{font-family:var(--f-body)}
.oem .tabs{display:flex;flex-wrap:wrap;gap:.3rem;border-bottom:2px solid var(--ink);margin:1.2rem 0 1rem}
.oem .tabs button{font:inherit;background:none;border:0;padding:.45rem .9rem;cursor:pointer;color:var(--ink2);border-bottom:3px solid transparent;margin-bottom:-2px;min-height:44px}
.oem .tabs button.on{color:var(--red);border-color:var(--red);font-weight:700}
.oem .books{display:grid;grid-template-columns:repeat(auto-fill,minmax(112px,1fr));gap:10px}
.oem .bk{background:none;border:0;padding:0;font:inherit;color:inherit;text-align:start;cursor:pointer;min-width:0}
.oem .bk img{width:100%;aspect-ratio:3/4;object-fit:cover;border:1px solid var(--rule);border-radius:2px;display:block;background:var(--rule)}
.oem .bk .t{font-size:.76rem;line-height:1.5;margin-top:.25rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.oem .bk .y{font-size:.7rem;color:var(--pencil)}

/* الكشاف */
.oem .filters{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:.6rem;align-items:end}
.oem .filters label{display:flex;flex-direction:column;gap:.15rem;font-size:.8rem;color:var(--ink2)}
.oem select,.oem input[type=number],.oem input[type=search],.oem input[type=text]{font:inherit;font-size:.92rem;padding:.4rem .55rem;border:1px solid var(--rule);border-radius:3px;background:var(--sheet);color:var(--ink);min-height:44px;min-width:0;width:100%}
.oem .idx{columns:2 22rem;column-gap:2.4rem;font-size:.92rem}
.oem .idx .grp>h4{font-family:var(--f-disp);color:var(--red);font-size:1.6rem;margin:.6rem 0 .1rem;break-after:avoid;break-inside:avoid}
.oem .idx .grp>h4+.e{break-before:avoid}
.oem .idx .ref{unicode-bidi:isolate}
.oem .idx .e{break-inside:avoid;margin:.12rem 0 .35rem;padding-inline-start:1.2rem;text-indent:-1.2rem;line-height:1.75}
.oem .idx .e b{font-weight:700}
.oem .idx .e .refs{color:var(--ink2);font-size:.84rem}
.oem .idx .e .refs a{color:var(--ink2);text-decoration:none;border-bottom:1px dotted var(--pencil)}

/* المحادثة */
.oem .chat{display:flex;flex-direction:column;gap:.8rem}
.oem .msg{max-width:52rem;padding:.75rem 1rem;border-radius:4px;line-height:1.85;min-width:0}
.oem .msg.u{align-self:flex-start;background:var(--board);color:var(--chalk);font-weight:500}
.oem .msg.a{align-self:stretch;background:var(--sheet);border:1px solid var(--rule)}
.oem .msg.a .src{font-size:.78rem;color:var(--pencil);margin-top:.5rem;border-top:1px dashed var(--rule);padding-top:.35rem}
.oem .msg.a a.lnk{color:var(--red);text-decoration:none;border-bottom:1px solid var(--red-soft)}
.oem .msg.a ul{margin:.3rem 0;padding-inline-start:1.2rem}
.oem .engine{display:flex;gap:.4rem;align-items:center;font-size:.82rem;color:var(--ink2);flex-wrap:wrap}
.oem .composer{display:flex;gap:.5rem;flex-wrap:wrap;position:sticky;bottom:0;background:var(--paper);padding-block:.6rem}
.oem .composer textarea{flex:1 1 18rem;min-width:0;font:inherit;min-height:52px;max-height:160px;padding:.6rem .8rem;border:2px solid var(--ink);border-radius:4px;background:var(--sheet);color:var(--ink);resize:vertical}

/* بطاقة الكتاب */
.oem .dlg{position:fixed;inset:0;background:rgba(10,16,14,.6);z-index:30;display:flex;align-items:flex-start;justify-content:center;padding:5vh max(16px,env(safe-area-inset-right,0px)) 2rem max(16px,env(safe-area-inset-left,0px));overflow:auto}
.oem .dlg .box{background:var(--sheet);max-width:760px;width:100%;border-radius:4px;padding:1.2rem 1.3rem;border-top:4px solid var(--red)}
.oem .dlg .top{display:flex;gap:1rem;flex-wrap:wrap}
.oem .dlg img{width:160px;max-width:40%;border:1px solid var(--rule)}

@media (max-width:640px){
  .oem{font-size:16px}
  .oem .sheet{padding-inline-start:1.1rem;background-image:repeating-linear-gradient(to bottom,transparent 0 31px,var(--rule) 31px 32px)}
  .oem .bars .r{grid-template-columns:6.5rem 1fr auto}
  .oem .wall img{height:84px}
  .oem .kpi{flex-basis:45%}
}
.oem .idx .stamp,.oem .msg .stamp{margin-inline-start:.45rem}
.oem [hidden]{display:none!important}
