/* ============================================================
   AL MOUTMAG — theme-light.css  (Task 7-A · وكيل الهوية البصرية)
   الثيم الفاتح الزجاجي — طبقة تجاوزات خالصة فوق الثيم الداكن الأصلي:
     §1 أنماط عناصر ui.js الجديدة (تثبيت/شارة بحث/عداد تخزين/زر الثيم)
        — تعمل في الثيمين عبر متغيرات --alm-* فلا تُكرر هنا داخل القسم §3
     §2 إعادة تعريف متغيرات الهوية تحت html[data-theme="light"]
     §3 تصحيح الألوان الصلبة غير المتغيرية (main/components/layout/agents)
        بقواعد [data-theme="light"] .selector — صفر تعديل على الملفات الأصلية
   تباين AA محسوب على خلفية #edf1f8: cyan #0e7490 (4.7:1) · blue #2563eb (4.6:1)
   purple #6d28d9 (6.3:1) · ok #047857 (4.9:1) · warn #92400e (6.3:1) · err #b91c1c (5.7:1)
   تُحمَّل بعد كل ملفات CSS الأخرى لتربح الشلال (index.html — يدرجها المدير بعد canvas-v2.css).
   ============================================================ */

/* ============================================================
   §1 — عناصر جديدة من ui.js (لكل الثيمات)
   ============================================================ */
.alm-themetoggle__sun,
.alm-themetoggle__moon{display:none}
html:not([data-theme="light"]) .alm-themetoggle__sun{display:block}   /* داكن → أظهر الشمس (الانتقال للفاتح) */
html[data-theme="light"] .alm-themetoggle__moon{display:block}        /* فاتح → أظهر القمر (الانتقال للداكن) */

.alm-conv__pin{opacity:0;color:var(--alm-text-faint);width:22px;height:22px;border-radius:7px;
  display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;transition:.15s;cursor:pointer}
.alm-conv__pin svg{width:12px;height:12px}
.alm-conv:hover .alm-conv__pin{opacity:1}
.alm-conv__pin:hover{color:var(--alm-cyan);background:var(--alm-surface-soft)}
.alm-conv.is-pinned .alm-conv__pin{opacity:1;color:var(--alm-warn)}
.alm-conv.is-pinned .alm-conv__pin svg{fill:currentColor}

.alm-conv-search-meta{display:inline-block;width:fit-content;margin:0 6px 0 2px;
  font-family:var(--alm-mono);font-size:9.5px;font-weight:700;color:var(--alm-cyan);
  background:var(--alm-surface-soft);border:1px solid var(--alm-border);border-radius:99px;padding:2px 10px}

.alm-version.alm-side-meter{direction:rtl;text-align:start;line-height:2}

/* ============================================================
   §2 — إعادة تعريف متغيرات الهوية (18 متغيراً)
   ============================================================ */
html[data-theme="light"]{
  --alm-bg:#edf1f8;
  --alm-bg-soft:#e3e9f3;
  --alm-surface:rgba(255,255,255,.74);
  --alm-surface-strong:rgba(255,255,255,.9);
  --alm-surface-soft:rgba(255,255,255,.55);
  --alm-border:rgba(13,27,54,.12);
  --alm-border-strong:rgba(13,27,54,.22);
  --alm-cyan:#0e7490;
  --alm-blue:#2563eb;
  --alm-purple:#6d28d9;
  --alm-grad:linear-gradient(120deg,#0891b2,#2563eb 52%,#7c3aed);
  --alm-text:#0f172a;
  --alm-text-dim:#42526e;
  --alm-text-faint:#5b6b82;
  --alm-ok:#047857;
  --alm-warn:#92400e;
  --alm-err:#b91c1c;
  --alm-shadow:0 10px 30px rgba(15,23,42,.14);
}

/* ============================================================
   §3 — ألوان صلبة غير متغيرية → تجاوزات الفاتح
   ============================================================ */

/* ---------- main.css: التحديد + خلفية الشبكة والأورب ---------- */
html[data-theme="light"] ::selection{background:rgba(14,116,144,.22);color:#0f172a}
[data-theme="light"] .alm-bg-fx__grid{background-image:linear-gradient(rgba(71,85,105,.07) 1px,transparent 1px),linear-gradient(90deg,rgba(71,85,105,.07) 1px,transparent 1px)}
[data-theme="light"] .alm-bg-fx__orb{opacity:.35}
[data-theme="light"] .alm-bg-fx__orb--cyan{background:radial-gradient(circle,rgba(8,145,178,.16),transparent 65%)}
[data-theme="light"] .alm-bg-fx__orb--purple{background:radial-gradient(circle,rgba(124,58,237,.13),transparent 65%)}
[data-theme="light"] .alm-bg-fx__orb--blue{background:radial-gradient(circle,rgba(37,99,235,.1),transparent 65%)}

/* ---------- الترويسة والتبويبات ---------- */
[data-theme="light"] .alm-header{background:rgba(255,255,255,.78)}
[data-theme="light"] .alm-logo:hover{background:rgba(13,27,54,.05)}
[data-theme="light"] .alm-logo__name,
[data-theme="light"] .alm-grad-text{background-image:linear-gradient(90deg,#0e7490,#1d4ed8 52%,#6d28d9)}
[data-theme="light"] .alm-model-tabs{background:rgba(255,255,255,.66)}
[data-theme="light"] .alm-tabs__glider{border-color:rgba(13,27,54,.16);box-shadow:inset 0 0 18px rgba(37,99,235,.12),0 0 16px rgba(37,99,235,.15)}
[data-theme="light"] .alm-tab:hover{background:rgba(13,27,54,.05)}
[data-theme="light"] .alm-tab.is-active .alm-tab__name{color:var(--alm-text);text-shadow:none}
[data-theme="light"] .alm-iconbtn:hover{color:var(--alm-text);background:rgba(13,27,54,.06)}
[data-theme="light"] .alm-btn{background:rgba(13,27,54,.04)}
[data-theme="light"] .alm-btn--ghost:hover{background:rgba(13,27,54,.05);color:var(--alm-text)}
[data-theme="light"] .alm-btn--danger{color:#b91c1c}
[data-theme="light"] .alm-btn--danger:hover{color:#991b1b}
[data-theme="light"] .alm-btn--danger.is-armed{color:#991b1b}

/* ---------- الشريط الجانبي ---------- */
[data-theme="light"] .alm-sidebar{background:rgba(255,255,255,.62)}
[data-theme="light"] .alm-sidebar__search input{background:rgba(13,27,54,.045)}
[data-theme="light"] .alm-sidebar__search input:focus{border-color:rgba(14,116,144,.45);box-shadow:0 0 0 1px rgba(14,116,144,.18)}
[data-theme="light"] .alm-conv:hover{background:rgba(13,27,54,.05)}
[data-theme="light"] .alm-conv.is-active{background:linear-gradient(120deg,rgba(8,145,178,.08),rgba(109,40,217,.08));border-color:rgba(13,27,54,.16);color:var(--alm-text)}
[data-theme="light"] .alm-sidebtn:hover{background:rgba(13,27,54,.05);color:var(--alm-text)}

/* ---------- عمود المحادثة: الرسائل والتفكير والأدوات ---------- */
[data-theme="light"] .alm-chatcol__head{background:rgba(255,255,255,.55)}
[data-theme="light"] .alm-msg--user{background:linear-gradient(120deg,rgba(8,145,178,.1),rgba(37,99,235,.08));border-color:rgba(37,99,235,.25)}
[data-theme="light"] .alm-think{border-color:rgba(109,40,217,.3);background:rgba(109,40,217,.05)}
[data-theme="light"] .alm-think summary{color:#6d28d9}
[data-theme="light"] .alm-toolcard{background:rgba(255,255,255,.72)}
[data-theme="light"] .alm-toolcard__icon{background:rgba(8,145,178,.1);color:#0e7490}
[data-theme="light"] .alm-toolcard__state{background:rgba(37,99,235,.1);color:#1d4ed8}
[data-theme="light"] .alm-toolcard.is-done .alm-toolcard__state{background:rgba(4,120,87,.12)}
[data-theme="light"] .alm-toolcard.is-err .alm-toolcard__state{color:#b91c1c}
[data-theme="light"] .alm-spin{border-top-color:#2563eb}
[data-theme="light"] .alm-steps{background:rgba(255,255,255,.6);border-color:rgba(13,27,54,.16)}
[data-theme="light"] .alm-step.is-run{color:var(--alm-text)}
[data-theme="light"] .alm-logs{background:rgba(240,245,251,.85);border-color:rgba(13,27,54,.1)}
[data-theme="light"] .alm-logs .t{color:#64748b}
[data-theme="light"] .alm-logs .info{color:#0e7490}
[data-theme="light"] .alm-agent-restore{color:#6d28d9;background:rgba(255,255,255,.92);border-color:rgba(109,40,217,.45)}
[data-theme="light"] .alm-canvas-restore{color:#0e7490;background:rgba(255,255,255,.92);border-color:rgba(14,116,144,.45)}

/* ---------- البطل والبطاقات ---------- */
[data-theme="light"] .alm-stat + .alm-stat::before{background:linear-gradient(180deg,transparent,rgba(13,27,54,.14),transparent)}
[data-theme="light"] .alm-fcard:hover{box-shadow:0 12px 34px rgba(15,23,42,.2),0 0 0 1px rgba(14,116,144,.14),0 0 26px rgba(37,99,235,.12)}

/* ---------- المُنشئ (Composer) ---------- */
[data-theme="light"] .alm-composer:focus-within{border-color:rgba(14,116,144,.5);box-shadow:0 0 0 1px rgba(14,116,144,.22),0 0 30px rgba(14,116,144,.08),var(--alm-shadow)}
[data-theme="light"] .alm-composer.is-deep{border-color:rgba(109,40,217,.5);box-shadow:0 0 0 1px rgba(109,40,217,.28),0 0 34px rgba(109,40,217,.1)}
[data-theme="light"] .alm-chip{background:rgba(13,27,54,.045)}
[data-theme="light"] .alm-chip:hover{color:var(--alm-text);border-color:rgba(14,116,144,.45);background:rgba(8,145,178,.08)}
[data-theme="light"] .alm-attach__item{color:#155e75;background:rgba(8,145,178,.07);border-color:rgba(8,145,178,.3)}
[data-theme="light"] .alm-toolbtn:hover{color:var(--alm-text);background:rgba(13,27,54,.06)}
[data-theme="light"] .alm-switch__track{background:rgba(100,116,139,.3)}
[data-theme="light"] .alm-switch__knob{background:#64748b}
[data-theme="light"] .alm-switch input:checked ~ .alm-switch__label{color:var(--alm-text)}

/* ---------- مساحة العمل: كانفس + معاينة + كود + مصادر ---------- */
[data-theme="light"] .alm-canvas__head{background:rgba(255,255,255,.5)}
[data-theme="light"] .alm-canvas__badge{border-color:rgba(13,27,54,.2)}
[data-theme="light"] .alm-seg{background:rgba(13,27,54,.04)}
[data-theme="light"] .alm-seg__btn:hover{color:var(--alm-text);background:rgba(13,27,54,.05)}
[data-theme="light"] .alm-seg__btn.is-active{color:var(--alm-text);background:linear-gradient(120deg,rgba(8,145,178,.12),rgba(109,40,217,.12));box-shadow:inset 0 0 0 1px rgba(13,27,54,.14);text-shadow:none}
[data-theme="light"] .alm-seg__badge{color:#5b21b6}
[data-theme="light"] .alm-seg__badge--cyan{color:#155e75}
[data-theme="light"] .alm-preview__stage{background:linear-gradient(rgba(71,85,105,.07) 1px,transparent 1px) 0 0/28px 28px,rgba(228,234,244,.6)}
[data-theme="light"] .alm-file:hover{background:rgba(13,27,54,.05);color:var(--alm-text)}
[data-theme="light"] .alm-file.is-active{background:rgba(8,145,178,.08);border-color:rgba(8,145,178,.3);color:#155e75}
[data-theme="light"] .alm-cl::before{color:#94a3b8}
[data-theme="light"] .alm-cl:hover{background:rgba(13,27,54,.03)}
[data-theme="light"] .tk-tag{color:#0369a1}
[data-theme="light"] .tk-attr{color:#6d28d9}
[data-theme="light"] .tk-str{color:#15803d}
[data-theme="light"] .tk-com{color:#64748b}
[data-theme="light"] .tk-kw{color:#a21caf}
[data-theme="light"] .tk-num{color:#b45309}
[data-theme="light"] .tk-punc{color:#475569}
[data-theme="light"] .alm-src{background:rgba(255,255,255,.72)}
[data-theme="light"] .alm-src__type{background:rgba(109,40,217,.08);color:#6d28d9}
[data-theme="light"] .alm-src__meter{background:rgba(13,27,54,.08)}

/* ---------- المحرر (Phase 5) ---------- */
[data-theme="light"] .alm-editor{background:rgba(255,255,255,.65)}
[data-theme="light"] .alm-editor.is-edit{background:rgba(8,145,178,.05)}
[data-theme="light"] .alm-editor__gutter{border-inline-end-color:rgba(13,27,54,.08);background:rgba(240,245,251,.7)}
[data-theme="light"] .alm-editor.is-edit .alm-editor__gutter{border-inline-end-color:rgba(14,116,144,.35)}
[data-theme="light"] .alm-gut__n{color:#94a3b8}
[data-theme="light"] .alm-editor.is-edit .alm-gut__n{color:#64748b}

/* ---------- Markdown / Prism / Mermaid (Phase 4) ---------- */
[data-theme="light"] .alm-md h1,
[data-theme="light"] .alm-md h2,
[data-theme="light"] .alm-md h3{background-image:linear-gradient(90deg,#0e7490,#6d28d9)}
[data-theme="light"] .alm-md h4{color:#334155}
[data-theme="light"] .alm-md li::marker{color:#0e7490}
[data-theme="light"] .alm-md a{color:#0e7490}
[data-theme="light"] .alm-md a:hover{color:#155e75}
[data-theme="light"] .alm-md strong{color:#0f172a}
[data-theme="light"] .alm-md em{color:#6d28d9}
[data-theme="light"] .alm-md hr{border-top-color:rgba(13,27,54,.12)}
[data-theme="light"] .alm-md blockquote{border-inline-start-color:rgba(109,40,217,.45);background:rgba(109,40,217,.06);color:#475569}
[data-theme="light"] .alm-md code{background:rgba(8,145,178,.08);border-color:rgba(8,145,178,.22);color:#0e7490}
[data-theme="light"] .alm-md pre{background:#f4f7fc;border-color:rgba(13,27,54,.12)}
[data-theme="light"] .alm-md pre::after{color:#64748b}
[data-theme="light"] .alm-md pre code{color:#1e293b}
[data-theme="light"] .alm-md table{border-color:rgba(13,27,54,.12)}
[data-theme="light"] .alm-md th,
[data-theme="light"] .alm-md td{border-color:rgba(13,27,54,.1)}
[data-theme="light"] .alm-md th{background:rgba(8,145,178,.1);color:#155e75}
[data-theme="light"] .alm-md tr:nth-child(even) td{background:rgba(100,116,139,.08)}
[data-theme="light"] .alm-md .token.comment,
[data-theme="light"] .alm-md .token.prolog,
[data-theme="light"] .alm-md .token.doctype,
[data-theme="light"] .alm-md .token.cdata{color:#64748b}
[data-theme="light"] .alm-md .token.punctuation{color:#64748b}
[data-theme="light"] .alm-md .token.property,
[data-theme="light"] .alm-md .token.tag,
[data-theme="light"] .alm-md .token.constant,
[data-theme="light"] .alm-md .token.symbol{color:#a21caf}
[data-theme="light"] .alm-md .token.boolean,
[data-theme="light"] .alm-md .token.number{color:#92400e}
[data-theme="light"] .alm-md .token.selector,
[data-theme="light"] .alm-md .token.attr-name,
[data-theme="light"] .alm-md .token.string,
[data-theme="light"] .alm-md .token.char,
[data-theme="light"] .alm-md .token.builtin{color:#15803d}
[data-theme="light"] .alm-md .token.operator,
[data-theme="light"] .alm-md .token.entity,
[data-theme="light"] .alm-md .token.url{color:#0e7490}
[data-theme="light"] .alm-md .token.atrule,
[data-theme="light"] .alm-md .token.attr-value,
[data-theme="light"] .alm-md .token.keyword{color:#6d28d9}
[data-theme="light"] .alm-md .token.function,
[data-theme="light"] .alm-md .token.class-name{color:#0369a1}
[data-theme="light"] .alm-md .token.regex,
[data-theme="light"] .alm-md .token.important,
[data-theme="light"] .alm-md .token.variable{color:#be123c}
[data-theme="light"] .alm-md .katex-error{color:#be123c}
[data-theme="light"] .alm-md .mermaid-box{background:#f4f7fc;border-color:rgba(13,27,54,.12)}

/* ---------- النوافذ والحجاب وقفل الجلسة والتوست ---------- */
[data-theme="light"] .alm-modal__backdrop{background:rgba(15,23,42,.4)}
[data-theme="light"] .alm-modal__panel{box-shadow:0 30px 80px rgba(15,23,42,.28)}
[data-theme="light"] .alm-field{background:rgba(13,27,54,.04)}
[data-theme="light"] .alm-field:focus-within{border-color:rgba(14,116,144,.45);box-shadow:0 0 0 1px rgba(14,116,144,.18)}
[data-theme="light"] .alm-field select option{background:#fff}
[data-theme="light"] .alm-select{background:rgba(13,27,54,.04)}
[data-theme="light"] .alm-select option{background:#fff}
[data-theme="light"] input[type=range]{accent-color:#0e7490}
[data-theme="light"] .alm-lock{background:rgba(237,241,248,.86)}
[data-theme="light"] .alm-lock__card{box-shadow:0 30px 90px rgba(15,23,42,.28)}
[data-theme="light"] .alm-scrim{background:rgba(15,23,42,.38)}
[data-theme="light"] .alm-mobile-viewbar{background:rgba(255,255,255,.95)}
[data-theme="light"] .alm-mobile-viewbar button.is-active{color:var(--alm-text);box-shadow:inset 0 0 0 1px rgba(13,27,54,.16)}

/* ---------- Phase 2 · GitHub ---------- */
[data-theme="light"] .alm-toolbtn--gh:hover{color:#155e75}
[data-theme="light"] .alm-ratebadge{background:rgba(255,255,255,.7)}
[data-theme="light"] .alm-ratebadge:hover{color:var(--alm-text)}
[data-theme="light"] .alm-ratebadge[data-level="ok"]{color:#047857;background:rgba(4,120,87,.08)}
[data-theme="light"] .alm-ratebadge[data-level="warn"]{color:#92400e;background:rgba(146,64,14,.08)}
[data-theme="light"] .alm-ratebadge[data-level="crit"]{color:#b91c1c;background:rgba(185,28,28,.07)}
[data-theme="light"] .alm-repocard__info b{color:#155e75}
[data-theme="light"] .alm-repocard__x:hover{color:#b91c1c}
[data-theme="light"] .alm-ghrepo{background:rgba(255,255,255,.72)}
[data-theme="light"] .alm-ghrepo__name{color:#155e75}
[data-theme="light"] .alm-ghrepo__arch{color:#92400e}
[data-theme="light"] .alm-ghstate.is-err{color:#b91c1c}
[data-theme="light"] .alm-ghtree{background:rgba(255,255,255,.65)}
[data-theme="light"] .gh-dir__head:hover{background:rgba(13,27,54,.05);color:var(--alm-text)}
[data-theme="light"] .gh-dir__body{border-inline-start-color:rgba(13,27,54,.1)}
[data-theme="light"] .gh-file:hover{background:rgba(13,27,54,.04)}
[data-theme="light"] .gh-file.is-priority .gh-file__name{color:#155e75}
[data-theme="light"] .gh-check span{border-color:rgba(13,27,54,.3)}
[data-theme="light"] .gh-file__done{color:#047857}
[data-theme="light"] .alm-repopanel{background:rgba(255,255,255,.6)}
[data-theme="light"] .alm-repopanel__name{color:#155e75}
[data-theme="light"] .alm-ratebox b{color:#155e75}
[data-theme="light"] .alm-engchip:hover{color:#334155}
[data-theme="light"] .alm-engchip.is-live{color:#155e75}

/* ---------- Phase 5 · Diff ---------- */
[data-theme="light"] .alm-dstat{background:rgba(13,27,54,.05)}
[data-theme="light"] .alm-dstat--add{background:rgba(4,120,87,.12);color:#047857}
[data-theme="light"] .alm-dstat--del{background:rgba(190,18,60,.1);color:#be123c}
[data-theme="light"] .alm-diff__row{border-bottom-color:rgba(13,27,54,.05)}
[data-theme="light"] .alm-diff__ln{color:#94a3b8}
[data-theme="light"] .alm-diff.is-side .alm-diff__row.is-del .alm-diff__cell.is-a,
[data-theme="light"] .alm-diff.is-side .alm-diff__row.is-mod .alm-diff__cell.is-a{background:rgba(190,18,60,.07)}
[data-theme="light"] .alm-diff.is-side .alm-diff__row.is-add .alm-diff__cell.is-b,
[data-theme="light"] .alm-diff.is-side .alm-diff__row.is-mod .alm-diff__cell.is-b{background:rgba(4,120,87,.08)}
[data-theme="light"] .alm-diff.is-side .alm-diff__row.is-del .alm-diff__cell.is-a .alm-diff__code,
[data-theme="light"] .alm-diff.is-side .alm-diff__row.is-mod .alm-diff__cell.is-a .alm-diff__code{color:#be123c}
[data-theme="light"] .alm-diff.is-side .alm-diff__row.is-add .alm-diff__cell.is-b .alm-diff__code,
[data-theme="light"] .alm-diff.is-side .alm-diff__row.is-mod .alm-diff__cell.is-b .alm-diff__code{color:#047857}
[data-theme="light"] .alm-diff:not(.is-side) .alm-diff__row.is-add{background:rgba(4,120,87,.08)}
[data-theme="light"] .alm-diff:not(.is-side) .alm-diff__row.is-del{background:rgba(190,18,60,.06)}
[data-theme="light"] .alm-diff:not(.is-side) .alm-diff__row.is-add .alm-diff__sign{color:#047857}
[data-theme="light"] .alm-diff:not(.is-side) .alm-diff__row.is-del .alm-diff__sign{color:#be123c}
[data-theme="light"] .alm-diff:not(.is-side) .alm-diff__row.is-add .alm-diff__code{color:#047857}
[data-theme="light"] .alm-diff:not(.is-side) .alm-diff__row.is-del .alm-diff__code{color:#be123c}

/* ---------- Phase 6 · بطاقة فريق الوكلاء (agents.css) ---------- */
[data-theme="light"] .alm-agents{background:linear-gradient(160deg,rgba(255,255,255,.85),rgba(244,247,252,.95))}
[data-theme="light"] .alm-agents__head{background:rgba(13,27,54,.03)}
[data-theme="light"] .alm-agents__title{color:var(--alm-text)}
[data-theme="light"] .alm-agents__role{color:#6d28d9;background:rgba(109,40,217,.08)}
[data-theme="light"] .alm-agents__cancel{color:#b91c1c;background:rgba(185,28,28,.05)}
[data-theme="light"] .alm-agents__cancel:hover{background:rgba(185,28,28,.12)}
[data-theme="light"] .alm-agents__step{background:rgba(13,27,54,.03)}
[data-theme="light"] .alm-agents__num{background:rgba(13,27,54,.05)}
[data-theme="light"] .alm-agents__step.is-run .alm-agents__rt{color:var(--alm-text)}
[data-theme="light"] .alm-agents__step.is-fail .alm-agents__rt{color:#b91c1c}
[data-theme="light"] .alm-agents__rrole{background:rgba(13,27,54,.05)}

/* ---------- layout.css: درج الموبايل (≤940px) ---------- */
@media (max-width:940px){
  [data-theme="light"] .alm-sidebar{background:rgba(255,255,255,.97)}
  [data-theme="light"] .alm-canvascol{background:rgba(244,247,252,.96)}
}
