/* استوديو فائق: the studio's own look, layered over studio.css (that base stays as it is: the members' portal uses it too).
   Warm paper, ink and gold like the site. Light by default, dark on demand ([data-theme]), a sidebar that shrinks to icons
   ([data-side="mini"]) or slides in on phones (.sx-open), and a text-size knob (--fs). Prefs live in studio.js. */
:root {
  --paper: #f8f5ee; --paper2: #f1ebdf; --card: #fffefb; --side: #fffdf8;
  --ink: #1c1914; --ink2: #4a453a; --ink3: #756f61;
  --gold: #a07d2e; --gold2: #c9a24d; --gold-t: #85651f; --gold-soft: rgba(160, 125, 46, .09);
  --rule: rgba(160, 125, 46, .2); --line: #ece5d6;
  --ok: #3f7d4e; --bad: #b4572f; --warn-bg: #fff6ee; --alert-bg: #fff5dc;
  --btn: #1c1914; --btn-ink: #faf8f3; --badge: #85651f; --badge-ink: #fff;
  --shadow: 0 1px 2px rgba(60, 45, 15, .05), 0 12px 32px -18px rgba(60, 45, 15, .2);
  --shadow-lg: 0 30px 80px -24px rgba(40, 30, 10, .45);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --sans: 'Readex Pro', 'IBM Plex Sans Arabic', 'Tajawal', sans-serif;
  --display: 'Reem Kufi', 'Readex Pro', serif;
  --side-w: 256px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #12100c; --paper2: #1e1a14; --card: #1a1712; --side: #15120e;
  --ink: #f1ece1; --ink2: #cdc5b4; --ink3: #9c937f;
  --gold: #d6b25a; --gold2: #e8c977; --gold-t: #e2c171; --gold-soft: rgba(214, 178, 90, .1);
  --rule: rgba(214, 178, 90, .17); --line: #2c2820;
  --ok: #7cc792; --bad: #ec9474; --warn-bg: #2a1d15; --alert-bg: #2c2314;
  --btn: #d6b25a; --btn-ink: #16130e; --badge: #d6b25a; --badge-ink: #16130e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -18px rgba(0, 0, 0, .8);
  --shadow-lg: 0 30px 80px -24px rgba(0, 0, 0, .9);
  color-scheme: dark;
}
:root[data-side="mini"] { --side-w: 88px; }

html, body { font-family: var(--sans); background: var(--paper); color: var(--ink); }
body { font-size: 15px; line-height: 1.7; -webkit-font-smoothing: antialiased; }
body::before { /* a soft gold dawn in two corners */
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 420px at 88% -12%, var(--gold-soft), transparent 70%), radial-gradient(700px 400px at -5% 112%, var(--gold-soft), transparent 70%);
}
::selection { background: color-mix(in srgb, var(--gold) 30%, transparent); }
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden], .st-nav .is-off { display: none !important; } /* studio.css gives nav buttons display:flex, which used to beat [hidden] */
.sx-skip { position: absolute; inset-inline-start: 12px; top: -80px; z-index: 100; padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--paper); text-decoration: none; }
.sx-skip:focus { top: 12px; }

/* ---------- layout ---------- */
.st { grid-template-columns: var(--side-w) minmax(0, 1fr); transition: grid-template-columns .35s var(--ease); }
.st-main { padding: 34px clamp(16px, 4vw, 52px) 96px; max-width: 1240px; zoom: var(--fs, 1); }
.sx-top, .sx-scrim { display: none; }

/* ---------- sidebar ---------- */
.st-side { gap: 16px; padding: 18px 14px 14px; background: var(--side); border-inline-end: 1px solid var(--rule); overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.sx-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; }
.st-brand { min-width: 0; gap: 11px; }
.st-brand img { width: 40px; height: 40px; flex: none; box-shadow: 0 0 0 2px var(--side), 0 0 0 3.5px var(--gold2); }
.st-brand b { font-family: var(--display); font-weight: 600; font-size: 1.15rem; line-height: 1.25; color: var(--ink); }
.st-brand small { color: var(--ink3); font-size: 12px; }
.st-nav { gap: 0; }
.sx-grp { display: flex; flex-direction: column; gap: 2px; }
.sx-grp > p { margin: 16px 12px 6px; font-size: 12px; font-weight: 500; color: var(--ink3); }
.sx-grp:not(:has([data-view]:not(.is-off):not([hidden]))) { display: none; }
.sx-end { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.st-nav button { position: relative; min-height: 40px; gap: 12px; padding: 0 12px; border-radius: 12px; color: var(--ink2); font-size: 14.5px; transition: background .2s, color .2s; }
.st-nav button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.st-nav svg { width: 20px; height: 20px; flex: none; stroke-width: 1.6; color: var(--ink3); transition: color .2s; }
.st-nav button:hover { background: var(--gold-soft); color: var(--ink); }
.st-nav button:hover svg { color: var(--gold); }
.st-nav button[aria-current="page"] { background: linear-gradient(to left, color-mix(in srgb, var(--gold) 17%, transparent), var(--gold-soft)); color: var(--ink); font-weight: 500; box-shadow: inset -3px 0 0 var(--gold); }
.st-nav button[aria-current="page"] svg { color: var(--gold); }
.st-nav button[data-badge]::after { content: attr(data-badge); margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--badge); color: var(--badge-ink); font-size: 12px; font-weight: 600; line-height: 22px; text-align: center; }
.st-nav button.sx-dirty::before { content: ''; position: absolute; inset-inline-start: 28px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--side); }

.sx-ib { width: 38px; height: 38px; flex: none; display: inline-grid; place-items: center; padding: 0; border-radius: 12px; border: 1px solid var(--rule); background: transparent; color: var(--ink2); cursor: pointer; text-decoration: none; font-size: 18px; transition: background .2s, color .2s, border-color .2s; }
.sx-ib:hover:not(:disabled) { background: var(--gold-soft); color: var(--gold-t); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.sx-ib:disabled { opacity: .35; cursor: default; }
.sx-ib svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sx-mini svg { transition: transform .35s var(--ease); }
[data-theme="dark"] .sx-moon, :root:not([data-theme="dark"]) .sx-sun { display: none; }

.sx-foot { position: sticky; bottom: 0; margin-top: auto; display: grid; gap: 10px; padding: 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--rule); box-shadow: 0 -14px 20px -6px var(--side); } /* always in reach; the menu scrolls under it */
.sx-me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sx-me b { display: block; font-size: 14px; font-weight: 500; line-height: 1.3; }
.sx-me small { color: var(--ink3); font-size: 12px; }
.sx-av, .hm-av { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(135deg, var(--gold2), var(--gold)); color: #fff; font-family: var(--display); font-size: 1.05rem; }
.sx-tools { display: flex; gap: 6px; justify-content: space-between; }

@media (min-width: 861px) { /* the small sidebar: icons only, names as tooltips */
  [data-side="mini"] .st-side { padding-inline: 10px; }
  [data-side="mini"] .sx-head { flex-direction: column; gap: 12px; padding: 0; }
  [data-side="mini"] .st-brand span, [data-side="mini"] .st-nav button span, [data-side="mini"] .sx-me { display: none; }
  [data-side="mini"] .sx-grp > p { height: 1px; margin: 10px 10px; overflow: hidden; color: transparent; background: var(--line); }
  [data-side="mini"] .st-nav button { justify-content: center; padding: 0; }
  [data-side="mini"] .st-nav button[data-badge]::after { position: absolute; top: 3px; inset-inline-end: 6px; min-width: 17px; height: 17px; padding: 0 4px; font-size: 10px; line-height: 17px; }
  [data-side="mini"] .st-nav button.sx-dirty::before { inset-inline-start: auto; inset-inline-end: 12px; }
  [data-side="mini"] .sx-foot { padding: 10px 0; border: 0; border-radius: 0; background: var(--side); justify-items: center; }
  [data-side="mini"] .sx-tools { display: grid; grid-template-columns: repeat(2, 32px); gap: 4px; }
  [data-side="mini"] .sx-tools .sx-ib { width: 32px; height: 32px; border-radius: 10px; }
  [data-side="mini"] .sx-mini svg { transform: scaleX(-1); }
}

/* ---------- phones: a top bar, the sidebar slides in ---------- */
@media (max-width: 860px) {
  :root, :root[data-side="mini"] { --side-w: 0px; }
  .st { display: block; }
  .sx-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 12px; background: color-mix(in srgb, var(--paper) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--rule); }
  .sx-top b { flex: 1; min-width: 0; font-family: var(--display); font-weight: 600; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sx-top img { border-radius: 50%; box-shadow: 0 0 0 1.5px var(--gold2); }
  .st-side { position: fixed; z-index: 60; inset-block: 0; inset-inline-start: 0; width: min(300px, 86vw); height: 100%; transform: translateX(105%); transition: transform .35s var(--ease); box-shadow: var(--shadow-lg); }
  .sx-open .st-side { transform: none; }
  .st-nav { flex-direction: column; overflow: visible; } /* studio.css turns it into a sideways strip on phones */
  .sx-open { overflow: hidden; }
  .sx-mini, .sx-desk { display: none; }
  .sx-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(20, 15, 5, .42); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .sx-open .sx-scrim { opacity: 1; pointer-events: auto; }
  .st-main { padding: 22px 14px 88px; }
}

/* ---------- page parts ---------- */
.st-h { margin-bottom: 26px; align-items: flex-end; }
.st-h h1 { font-family: var(--display); font-weight: 600; font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1.3; color: var(--ink); }
.st-h p { color: var(--ink3); max-width: 62ch; line-height: 1.8; }
.st-crumb { font-size: 13.5px; color: var(--ink3); margin-bottom: 16px; }
.st-crumb button { color: var(--gold-t); font: inherit; }
.st-crumb button:hover { text-decoration: underline; text-underline-offset: 4px; }

.st-card { position: relative; background: var(--card); border: 1px solid var(--rule); border-radius: 22px; padding: 22px 24px; margin-bottom: 16px; box-shadow: var(--shadow); overflow-x: auto; color: var(--ink); }
.st-card h2 { font-family: var(--display); font-weight: 600; font-size: 1.18rem; line-height: 1.4; color: var(--ink); margin: 0 0 14px; }
.st-card h3 { font-weight: 600; }
.st-card p { color: var(--ink2); }
.st-card a:not(.st-btn) { color: var(--gold-t); }
.st-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.sx-gap { margin-top: 18px; }
@media (max-width: 560px) { .st-card { padding: 18px 16px; border-radius: 18px; } }

/* fold: every card whose first line is its heading (studio.js adds the chevron) */
.sx-fh { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; cursor: pointer; }
.sx-fold { margin-inline-start: auto; flex: none; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--ink3); cursor: pointer; transition: background .2s, color .2s; }
.sx-fold:hover { background: var(--gold-soft); color: var(--gold-t); }
.sx-fold svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease); }
.st-card.is-folded { padding-block: 12px; }
.st-card.is-folded > :not(.sx-fh) { display: none !important; }
.st-card.is-folded > .sx-fh { margin-bottom: 0; }
.is-folded > .sx-fh .sx-fold svg { transform: rotate(90deg); }

/* buttons */
.st-btn { min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--btn); background: var(--btn); color: var(--btn-ink); font-size: 14px; font-weight: 500; transition: transform .15s, box-shadow .2s, background .2s, color .2s, border-color .2s; }
.st-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--btn) 80%, transparent); }
.st-btn:active { transform: none; }
.st-btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); box-shadow: none; }
.st-btn.ghost:hover { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.st-btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.st-btn.danger:hover { background: color-mix(in srgb, var(--bad) 8%, transparent); box-shadow: none; }
.st-btn.sm { min-height: 34px; padding: 0 13px; font-size: 13px; }
.st-btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
/* «▶ ادخل الجلسة»: the one button that must never be missed */
.sx-join, .ag-s .st-btn, .st-alert .st-btn { background: linear-gradient(135deg, #f3dc97, #d6b25a); border-color: transparent; color: #1c1914; font-weight: 600; box-shadow: 0 6px 18px -8px rgba(160, 125, 46, .6); }
.sx-join:hover, .ag-s .st-btn:hover, .st-alert .st-btn:hover { box-shadow: 0 10px 24px -8px rgba(160, 125, 46, .75); }
.st-icon { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--rule); background: var(--card); color: var(--ink2); transition: background .2s, color .2s; }
.st-icon:hover:not(:disabled) { background: var(--gold-soft); color: var(--gold-t); }

/* forms */
.st-form input, .st-form select, .st-form textarea, .st-sec-title { border-radius: 12px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); transition: border-color .2s, box-shadow .2s, background .2s; }
.st-form :focus, .st-sec-title:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); background: var(--card); }
.st-form label { color: var(--ink2); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--gold); }
textarea::placeholder, input::placeholder { color: var(--ink3); opacity: .8; }

/* tables */
.st-table { font-size: 14px; }
.st-table th, .st-table td { padding: 12px; border-bottom: 1px solid var(--line); }
.st-table th { font-size: 12.5px; font-weight: 500; color: var(--ink3); }
.st-table tbody tr { transition: background .15s; }
.st-table tbody tr:hover { background: var(--gold-soft); }
.st-table tbody tr:last-child td { border-bottom: 0; }

/* numbers, pills, notes */
.st-stats { gap: 12px; margin-bottom: 18px; }
.st-stats div { background: var(--card); border: 1px solid var(--rule); border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow); }
.st-stats b { font-family: var(--display); font-weight: 600; font-size: 1.85rem; color: var(--gold-t); line-height: 1.15; }
.st-stats span { color: var(--ink3); }
.st-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--gold-soft); color: var(--gold-t); font-weight: 500; white-space: nowrap; }
.st-pill.pub { background: color-mix(in srgb, var(--ok) 13%, transparent); color: var(--ok); }
.st-pill.hid { background: color-mix(in srgb, var(--ink3) 14%, transparent); color: var(--ink3); }
.st-badge { color: var(--gold-t); }
.st-empty { color: var(--ink3); }
.st-legend { background: var(--paper2); border-radius: 14px; color: var(--ink2); }
.st-steps { color: var(--ink2); }
.st-toast { background: var(--ink); color: var(--paper); padding: 12px 22px; box-shadow: var(--shadow-lg); }

/* the session bar (members.js): studio.js moves it above the page; it sticks to the top while you scroll */
.sx-col { min-width: 0; }
.sx-col > .st-alert { position: sticky; top: 12px; left: auto; transform: none; z-index: 20; width: auto; max-width: 760px; margin: 14px clamp(16px, 4vw, 52px) -14px; padding: 10px 18px; border-radius: 18px; background: var(--alert-bg); border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); box-shadow: var(--shadow); animation: sx-glow 2.6s ease-in-out infinite alternate; }
.st-alert p { color: var(--ink); }
@keyframes sx-glow { to { box-shadow: var(--shadow), 0 0 0 5px color-mix(in srgb, var(--gold) 16%, transparent); } }
@media (max-width: 860px) { .sx-col > .st-alert { position: relative; top: 0; margin-inline: 14px; } } /* phones: on top of every page, but it scrolls away */

/* جدولي */
.ag-day h3 { font-family: var(--display); font-weight: 500; font-size: 1rem; color: var(--ink2); }
.ag-day.on h3 { color: var(--gold-t); }
.ag-s, .ag-m, .ag-p { padding: 12px 14px; border-radius: 14px; flex-wrap: wrap; }
.ag-s .st-btn { justify-self: start; }
.ag-s b, .ag-m b, .ag-p b { font-family: var(--display); font-weight: 500; color: var(--gold-t); }
.ag-m b { color: #7a5fb0; } .ag-p b { color: var(--ok); }
[data-theme="dark"] .ag-m b { color: #b9a2e6; }

/* course editor */
.sx-folder { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; padding: 10px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--rule); font-size: 13.5px; color: var(--ink2); }
.sx-folder > :first-child { flex: 1 1 auto; }
.sx-folder .ok { color: var(--ok); } .sx-folder .no { color: var(--bad); }
.sx-folder button { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); cursor: pointer; }
.sx-folder .st-save { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 600; }
.sx-folder .st-save:disabled { background: none; color: var(--ink3); border-color: var(--rule); font-weight: 400; cursor: default; }
.st-course { border-radius: 22px; box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s; }
.st-course:hover { transform: translateY(-2px); box-shadow: var(--shadow), 0 18px 40px -24px rgba(60, 45, 15, .35); }
.st-course h3 { font-family: var(--display); font-weight: 600; color: var(--ink); }
.st-ready { background: var(--line); }
.st-ready i { background: linear-gradient(90deg, var(--gold2), var(--gold)); border-radius: 6px; }
.st-slot { border-color: var(--rule); background: var(--paper); }
.st-n { border-color: var(--rule); color: var(--ink3); }
.st-lesson { color: var(--ink); }
.st-lesson:hover b { color: var(--gold-t); }

/* ---------- الرئيسية ---------- */
.sx-hello { align-items: center; }
.sx-hello h1 { margin-bottom: 4px; }
.st-h .sx-date { margin: 0 0 2px; color: var(--gold-t); font-size: 13.5px; font-weight: 500; }
.sx-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -10px 0 22px; }
.sx-chips:empty { display: none; }
.sx-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 8px 0 14px; border-radius: 999px; border: 1px solid var(--rule); background: var(--card); color: var(--ink2); font: inherit; font-size: 13.5px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .2s, transform .15s; }
.sx-chip:hover { border-color: color-mix(in srgb, var(--gold) 50%, transparent); transform: translateY(-1px); }
.sx-chip b { min-width: 24px; height: 24px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--gold-soft); color: var(--gold-t); font-weight: 600; }
.sx-chip.is-hot { background: var(--alert-bg); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.sx-chip.is-hot b { background: var(--badge); color: var(--badge-ink); }
@media (max-width: 560px) {
  .sx-chips { display: grid; grid-template-columns: 1fr 1fr; }
  .sx-chip { justify-content: space-between; padding-inline-start: 12px; font-size: 12.5px; box-shadow: none; }
}
.hm-hint { margin: -8px 0 16px; padding: 10px 14px; border-radius: 14px; background: var(--alert-bg); color: var(--ink2); font-size: 14px; }

.hm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.hm-grid > .st-card { margin: 0; scroll-margin-top: 80px; }
.hm-grid > [data-card="today"] { grid-column: 1 / -1; } /* the day's sessions always get the full width */
.hm-ic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--gold-soft); color: var(--gold-t); }
.hm-ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hm-n { min-width: 26px; height: 26px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 999px; font-family: var(--sans); font-size: 13px; font-weight: 600; background: var(--paper2); color: var(--ink3); }
.hm-n.on { background: var(--badge); color: var(--badge-ink); }
.hm-n:empty { display: none; }
.hm-tools { display: none; margin-inline-start: auto; gap: 6px; align-items: center; }
.hm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hm-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px; background: var(--paper); border: 1px solid transparent; color: var(--ink); transition: background .2s, border-color .2s; }
button.hm-row { width: 100%; font: inherit; text-align: start; cursor: pointer; }
button.hm-row:hover { background: var(--gold-soft); border-color: var(--rule); }
.hm-x { flex: 1; min-width: 0; display: grid; gap: 1px; }
.hm-x b { font-weight: 500; }
.hm-x small, .hm-row > small, .hm-end small { color: var(--ink3); font-size: 12.5px; }
.hm-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink2); font-size: 13.5px; }
.hm-end { display: grid; justify-items: end; gap: 2px; flex: none; }
.hm-t { min-width: 58px; flex: none; text-align: center; font-family: var(--display); font-size: 1.15rem; color: var(--gold-t); font-variant-numeric: tabular-nums; }
.hm-s { flex-wrap: wrap; }
.hm-s .hm-x { flex: 1 1 180px; } /* too narrow for both? the join button drops under the name */
.hm-s .sx-join { margin-inline-start: auto; }
.hm-s.is-soon { border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.hm-s.is-now { border-color: var(--gold); background: var(--alert-bg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 16%, transparent); }
.hm-s.is-past { opacity: .55; }
.hm-meet .hm-t { color: #7a5fb0; }
[data-theme="dark"] .hm-meet .hm-t { color: #b9a2e6; }
.hm-tag { font-style: normal; font-size: 11.5px; font-weight: 600; padding: 1px 9px; border-radius: 999px; background: var(--badge); color: var(--badge-ink); vertical-align: 2px; }
.is-past .hm-tag { background: var(--paper2); color: var(--ink3); }
.hm-num { min-width: 34px; height: 34px; padding: 0 8px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--badge); color: var(--badge-ink); font-weight: 600; }
.hm-chev { color: var(--ink3); }
.hm-amt { font-family: var(--display); font-weight: 500; color: var(--gold-t); white-space: nowrap; }
.hm-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 12px 14px; border-radius: 14px; background: var(--paper); }
.hm-sum b { font-family: var(--display); font-weight: 600; font-size: 1.6rem; line-height: 1.2; color: var(--gold-t); }
.hm-sum span { color: var(--ink3); font-size: 13.5px; }
.hm-sub { margin: 16px 0 8px; font-size: 13px; font-weight: 500; color: var(--ink3) !important; }
.hm-ok, .hm-note { margin: 6px 2px 0; font-size: 13.5px; color: var(--ink3) !important; }
.hm-empty { display: grid; justify-items: center; gap: 4px; padding: 20px 10px; border-radius: 14px; background: var(--paper); text-align: center; color: var(--ink3); font-size: 14px; }
.hm-empty b { color: var(--ink2); font-weight: 500; font-size: 15px; }
.hm-quote { margin: 12px 0 0; padding: 12px 14px; border-inline-start: 3px solid var(--gold2); border-radius: 12px; background: var(--paper); color: var(--ink2) !important; line-height: 1.8; }
.hm-quote small { display: block; margin-top: 2px; color: var(--ink3); font-size: 12.5px; }
.hm-more { margin-top: 12px; display: flex; justify-content: flex-end; }
.hm-link { border: 0; background: none; padding: 6px 4px; color: var(--gold-t); font: inherit; font-size: 13.5px; cursor: pointer; }
.hm-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.hm-act { margin-top: 14px; }
.hm-skel { display: grid; gap: 10px; }
.hm-skel i { height: 52px; border-radius: 14px; background: linear-gradient(90deg, var(--paper2), var(--paper), var(--paper2)); background-size: 200% 100%; animation: sx-shine 1.4s linear infinite; }
@keyframes sx-shine { to { background-position: -200% 0; } }
/* «تخصيص الرئيسية»: headers only, arrows + hide; hidden cards wait faded until shown again */
.hm-grid.is-editing .hm-tools { display: inline-flex; }
.hm-tools button { font-family: var(--sans); font-size: 13px; font-weight: 500; }
.hm-card:first-child [data-hm="up"], .hm-card:last-child [data-hm="down"] { opacity: .3; pointer-events: none; }
.hm-grid.is-editing .sx-fold, .hm-grid.is-editing .hm-card > :not(h2) { display: none; }
.hm-grid.is-editing .hm-card { padding-block: 12px; outline: 2px dashed color-mix(in srgb, var(--gold) 40%, transparent); outline-offset: 3px; }
.hm-grid.is-editing .hm-card > h2 { margin: 0; cursor: default; }
.hm-grid:not(.is-editing) .hm-card.is-off { display: none; }
.hm-grid.is-editing .hm-card.is-off { opacity: .55; }

/* ---------- أدواتي + خطة المحتوى (tools.js) ---------- */
.sx-search, .pl-table input.st-sec-title { font-family: var(--sans); font-size: 15px; }
.sx-search { width: 100%; margin-bottom: 14px; }
.pl-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.pl-nav b { font-family: var(--display); font-weight: 600; font-size: 1.1rem; }
.pl-sum { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px; margin-bottom: 10px; color: var(--ink2); }
.pl-sum b { font-family: var(--display); font-weight: 600; font-size: 1.7rem; color: var(--gold-t); }
.pl-sum small { color: var(--ink3); font-size: 13px; }
.pl-card .st-ready { height: 8px; margin-bottom: 8px; }
.pl-table { margin-top: 6px; }
.pl-table td { vertical-align: middle; }
.pl-table td:first-child b { display: block; font-weight: 600; }
.pl-table td:first-child small { color: var(--ink3); font-size: 13px; }
.pl-table tr.is-full td:first-child b::after { content: ' ✓'; color: var(--ok); }
.pl-n { font-family: var(--display); font-size: 1.15rem; color: var(--gold-t); text-align: center; }
.pl-table th:nth-child(2) { text-align: center; }
.pl-ticks { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.pl-tick { width: 36px; height: 36px; padding: 0; border-radius: 10px; border: 1.5px dashed color-mix(in srgb, var(--gold) 50%, transparent); background: transparent; color: transparent; font-size: 16px; font-weight: 700; cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .15s; }
.pl-tick:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-1px); }
.pl-tick[aria-pressed="true"] { border-style: solid; border-color: transparent; background: linear-gradient(135deg, #f3dc97, #d6b25a); color: #1c1914; }
.pl-tick:disabled { cursor: default; opacity: .6; }
.pl-step { display: inline-flex; align-items: center; gap: 8px; }
.pl-step output { min-width: 28px; text-align: center; font-family: var(--display); font-size: 1.15rem; }
.pl-table input.st-sec-title { width: 100%; min-width: 170px; }
.pl-edit { margin-top: 14px; }
.pl-left { margin: 14px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--paper); line-height: 1.9; }
.pl-hint { margin: 12px 2px 0; font-size: 13px; color: var(--ink3) !important; }
@media (max-width: 560px) { /* phones: the line and its target on top, the ticks under them */
  .pl-table thead { display: none; }
  .pl-table, .pl-table tbody { display: block; }
  .pl-table tr { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .pl-table td { padding: 0; border: 0; }
  .pl-table td:last-child { grid-column: 1 / -1; }
  .pl-tick { width: 40px; height: 40px; }
  .pl-n::before { content: 'المطلوب '; font-family: var(--sans); font-size: 12.5px; color: var(--ink3); }
  .pl-nav .st-btn { padding: 0 10px; font-size: 12.5px; }
}

/* ---------- تخصيص اللوحة (dialog) ---------- */
.sx-dlg { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto; border: 1px solid var(--rule); border-radius: 24px; background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg); }
.sx-dlg::backdrop { background: rgba(20, 15, 5, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sx-dlg[open] { animation: sx-pop .35s var(--ease); }
@keyframes sx-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.sx-dh, .sx-df { position: sticky; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--card); }
.sx-dh { top: 0; padding: 16px 22px; border-bottom: 1px solid var(--rule); }
.sx-df { bottom: 0; padding: 14px 22px 18px; border-top: 1px solid var(--rule); }
.sx-dh h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.3rem; }
.sx-db { padding: 2px 22px; }
.sx-opt { padding: 16px 0; border-bottom: 1px solid var(--line); }
.sx-opt:last-child { border-bottom: 0; }
.sx-opt h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; }
.sx-opt p { margin: 0 0 12px; color: var(--ink3); font-size: 13.5px; line-height: 1.7; }
.sx-seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--paper2); }
.sx-seg button { min-height: 38px; padding: 0 18px; border: 0; border-radius: 999px; background: none; color: var(--ink2); font: inherit; cursor: pointer; }
.sx-seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 500; box-shadow: var(--shadow); }
.sx-fs { display: inline-flex; align-items: center; gap: 12px; }
.sx-fs output { min-width: 64px; text-align: center; font-family: var(--display); font-size: 1.15rem; }
.sx-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.sx-check { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--rule); cursor: pointer; font-size: 14px; }
.sx-check:hover { background: var(--gold-soft); }
.sx-check input { width: 18px; height: 18px; margin: 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* «اقتراحات العملاء» (tools.js suggest view) */
.sg-p { border: 1px solid var(--line, rgba(0,0,0,.1)); border-radius: 14px; padding: 10px 14px; margin: 0 0 10px; }
.sg-p > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 0; }
.sg-p .hm-x small { display: block; line-height: 1.7; }

/* «مراجعة المحتوى» (review.js): tabs, toolbar, the text as a white page in both themes, notes on the side */
.rv-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.rv-main { min-width: 0; }
.rv-tabs { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; padding-inline-end: 4px; scrollbar-width: thin; }
.rv-tab { display: block; width: 100%; text-align: start; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--rule); background: var(--card); color: var(--ink2); font: inherit; font-size: 14px; line-height: 1.5; cursor: pointer; overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .rv-shell { grid-template-columns: 1fr; }
  .rv-tabs { flex-direction: row; position: static; max-height: none; overflow-x: auto; overflow-y: hidden; padding-bottom: 6px; }
  .rv-tab { flex: none; width: auto; border-radius: 999px; padding: 8px 16px; white-space: nowrap; }
}
.rv-tab:hover { color: var(--ink); border-color: var(--gold); }
.rv-tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 500; }
.rv-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.rv-head .st-sec-title { flex: 1 1 260px; min-height: 42px; padding: 0 14px; font: inherit; font-size: 16px; font-weight: 500; }
.rv-st { font-size: 13px; color: var(--ink3); }
.rv-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.rv-bar { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 8px; margin-bottom: 10px; background: var(--card); border: 1px solid var(--rule); border-radius: 14px; box-shadow: 0 6px 18px -12px rgba(0, 0, 0, .35); }
.rv-b { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 6px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; }
.rv-b:hover { background: var(--gold-soft); }
.rv-sw { display: block; width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .18); }
.rv-col { width: 26px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; }
.rv-sel { height: 34px; padding: 0 8px; border: 1px solid var(--rule); border-radius: 9px; background: var(--paper); color: var(--ink); font: inherit; font-size: 13px; }
.rv-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--rule); }
.rv-lab { margin-inline: 4px 2px; font-size: 12px; color: var(--ink3); }
.rv-ed { min-height: 62vh; padding: 28px clamp(18px, 3vw, 40px); background: #fffefb; color: #1c1914; border: 1px solid var(--rule); border-radius: 14px; font-size: 17px; line-height: 1.95; outline: none; overflow-wrap: anywhere; box-shadow: 0 10px 30px -22px rgba(0, 0, 0, .4); }
.rv-ed:focus { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); }
.rv-ed:empty::before { content: attr(data-ph); color: #9c937f; }
.rv-ed h2 { margin: .6em 0 .3em; font-size: 1.5em; color: inherit; } .rv-ed h3 { margin: .5em 0 .25em; font-size: 1.22em; color: inherit; }
.rv-ed p, .rv-ed div { margin: 0 0 .35em; color: inherit; } .rv-ed ul, .rv-ed ol { padding-inline-start: 1.6em; margin: .3em 0; }
.rv-ed blockquote { margin: .5em 0; padding: 4px 14px; border-inline-start: 3px solid #c9a24d; background: #faf5e8; color: #4a453a; }
.rv-ed img, .rv-ed video { display: inline-block; vertical-align: top; width: min(100%, 240px); height: auto; margin: 6px; border-radius: 12px; border: 1px solid #e3dccb; cursor: zoom-in; }
.rv-ed video { width: min(100%, 320px); cursor: auto; }
.rv-ed a { color: #1565c0; } .rv-ed hr { border: 0; border-top: 1px solid #e3dccb; margin: 1em 0; }
.rv-notes { position: sticky; top: 8px; max-height: calc(100vh - 24px); overflow-y: auto; padding: 16px; }
.rv-notes h2 { margin: 0 0 10px; font-size: 1.1rem; }
.rv-nl { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.rv-n { padding: 10px 12px; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); }
.rv-n.is-done { opacity: .55; }
.rv-n.is-done p { text-decoration: line-through; }
.rv-nh { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.rv-nh small { color: var(--ink3); }
.rv-n q, .rv-q q { display: block; margin: 6px 0; padding: 4px 8px; border-radius: 6px; background: #fff3b0; color: #1c1914; font-size: 13.5px; quotes: "«" "»"; }
.rv-n p { margin: 4px 0 8px; white-space: pre-wrap; font-size: 14px; }
.rv-nf { display: grid; gap: 8px; }
.rv-nf textarea { padding: 10px 12px; font: inherit; font-size: 14px; resize: vertical; }
.rv-nf .st-row { align-items: center; gap: 8px; flex-wrap: wrap; }
.rv-pic { cursor: pointer; } .rv-mic.on { background: #b3261e; border-color: #b3261e; color: #fff; } .rv-fn { font-size: 12px; color: var(--muted, #7a7466); overflow-wrap: anywhere; flex: 1; }
.rv-nimg { display: block; max-width: 100%; max-height: 260px; margin: 6px 0; border-radius: 10px; border: 1px solid #e3dccb; cursor: zoom-in; }
.rv-q { margin: 0; font-size: 12.5px; color: var(--ink2); }
.rv-x { border: 0; background: none; color: var(--ink3); cursor: pointer; font-size: 13px; }
@media (max-width: 1000px) { .rv-wrap { grid-template-columns: 1fr; } .rv-notes { position: static; max-height: none; } }
/* with the tab list on the right the text needs the room: notes go under the text until the screen is wide */
@media (max-width: 1500px) { .rv-shell .rv-wrap { grid-template-columns: 1fr; } .rv-shell .rv-notes { position: static; max-height: none; } }
@media (min-width: 1501px) { .rv-shell { grid-template-columns: 210px minmax(0, 1fr); } .rv-shell .rv-wrap { grid-template-columns: minmax(0, 1fr) 280px; } }
@media (max-width: 860px) { .rv-bar { top: 64px; } .rv-ed { min-height: 50vh; font-size: 16px; } }
@media (max-width: 860px) { .rv-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; } .rv-bar > * { flex: none; } }
/* 28 Nov: «💬 الشات» — one WhatsApp-style chat between Faiq, Maysam and Noor */
.rv-chatwrap { display: flex; flex-direction: column; min-height: 70vh; }
.rv-ct { font-size: 1.1em; }
.rv-cl { flex: 1; max-height: 64vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; margin: 8px 0; border-radius: 16px; background: rgba(160,125,46,.06); }
.rv-msg { display: flex; justify-content: flex-start; }
.rv-msg.me { justify-content: flex-end; }
.rv-bub { max-width: min(78%, 560px); padding: 8px 12px 6px; border-radius: 16px 16px 16px 4px; background: var(--st-card, #fff); box-shadow: 0 1px 2px rgba(0,0,0,.12); line-height: 1.75; }
.rv-msg.me .rv-bub { border-radius: 16px 16px 4px 16px; background: #f3e7c8; color: #1c1914; }
.rv-bub > b { display: block; font-size: .8em; color: var(--gold, #a07d2e); }
.rv-bub p { margin: 2px 0; white-space: pre-wrap; word-break: break-word; }
.rv-bub img { display: block; max-width: 100%; max-height: 360px; border-radius: 10px; margin: 6px 0; cursor: zoom-in; }
.rv-bub small { display: block; text-align: end; font-size: .72em; opacity: .65; }
.rv-bub .rv-x { background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.rv-cf { position: sticky; bottom: 0; }
.rv-chattab { font-weight: 700; }
.rv-arch summary { cursor: pointer; padding: 8px 10px; opacity: .75; }
.rv-bub { background: #ffffff; color: #1c1914; }
.rv-bub p, .rv-bub small { color: #1c1914; }
.rv-bub a { color: #8a6a1f; }
.rv-dot { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; margin-inline-start: 6px; border-radius: 999px; background: #d32f2f; color: #fff; font-size: 12px; font-weight: 700; align-items: center; justify-content: center; }
.rv-dot[hidden] { display: none; }
.rv-ed table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: .95em; }
.rv-ed th, .rv-ed td { border: 1px solid rgba(160,125,46,.35); padding: 8px 10px; text-align: right; vertical-align: top; }
.rv-ed th { background: rgba(160,125,46,.12); }
/* every tab: pinned content on top + WhatsApp-style chat under it (Faiq, 28 Nov) */
.rv-shell .rv-wrap.rv-stack { grid-template-columns: 1fr; }
.rv-stack .rv-doc { max-height: 55vh; overflow-y: auto; border: 2px solid rgba(160,125,46,.35); border-radius: 16px; padding: 8px; background: rgba(160,125,46,.04); resize: vertical; }
.rv-stack .rv-ed { min-height: 20vh; }
.rv-pin { margin: 2px 6px 8px; font-weight: 700; color: #a07d2e; font-size: .95rem; }
.rv-tchat { min-height: 0; }
.rv-tchat .rv-cl { max-height: 55vh; min-height: 30vh; }
.rv-th { margin: 14px 4px 0; font-size: 1.05rem; }
