/* OS Author v2.45: dark mode and right to left, loaded last.
   Dark keeps the warm character: deep warm greys, warm off-white text, the brand colour as the one accent, and the
   institution's reversed (white) logo, as brand guides ask for dark grounds. Arabic turns the layout right to left. */

/* ---------- the reversed logo ---------- */
.lg-dark{display:none!important}
:root[data-theme=dark] .lg-light{display:none!important}
:root[data-theme=dark] .lg-dark{display:block!important}

/* ---------- dark: the palette ---------- */
:root[data-theme=dark]{color-scheme:dark}
:root.calm[data-theme=dark]{
  --bg:#161513; --panel:#1f1d1a; --sunk:#292723; --ink:#f2eee7; --muted:#aaa397; --faint:#857f75; --line:#35322d; --line-2:#3e3a34;
  --blue:#f2eee7; --blue-2:#ffffff; --blue-soft:#2c2a26;
}
:root[data-theme=dark] .ez,:root[data-theme=dark] .ez-ck,:root[data-theme=dark] .shp-fix,:root[data-theme=dark] .gb,:root[data-theme=dark] .bsp,:root[data-theme=dark] .pt,:root[data-theme=dark] .pt-modal,:root[data-theme=dark] .si,:root[data-theme=dark] .shpop{
  --paper:#161513; --surface:#1f1d1a; --surface-sunk:#292723; --hairline:#35322d; --control-line:#77716a; --ink:#f2eee7; --ink-muted:#aaa397;
  --success-soft:#1d2e24; --warning-soft:#33291a; --danger-soft:#3a201d; --seal-soft:#2f281c;
}
:root[data-theme=dark] .lc{--paper:#161513;--surface:#1f1d1a;--sunk:#292723;--line:#35322d;--ink:#f2eee7;--mut:#aaa397}
/* the soft brand tint is set inline from the institution's colour; on dark it is mixed with the dark surface */
:root[data-theme=dark] .pt-side,:root[data-theme=dark] .pt-col,:root[data-theme=dark] .pt-auth-card,:root[data-theme=dark] .pt-tenant,:root[data-theme=dark] .pt-modal .modal-b{--brand-soft:color-mix(in srgb,var(--brand) 24%,#1f1d1a)}
:root[data-theme=dark] body,html.calm[data-theme=dark] body{background:#161513;color:#f2eee7}

/* surfaces that were white */
:root[data-theme=dark] .pt-side,html.calm[data-theme=dark] .side{background:#1b1a17}
@media (min-width:961px){:root[data-theme=dark] .pt.pt-shell{background:linear-gradient(to right,#1b1a17 272px,#161513 272px)}}
:root[data-theme=dark] .pt-si.on,html.calm[data-theme=dark] .side a.on:not(.sd-new){background:#2c2a26}
:root[data-theme=dark] .pt-si:hover,html.calm[data-theme=dark] .side a:not(.sd-new):hover{background:#252320}
:root[data-theme=dark] .pt-si.on svg{color:color-mix(in srgb,var(--brand) 60%,#fff)}
:root[data-theme=dark] .pt-mtop,html.calm[data-theme=dark] .top{background:#1b1a17;border-color:#35322d}
html.gb-full[data-theme=dark] body,html.gb-full[data-theme=dark] .gb-page{background-color:#161513;background-image:linear-gradient(rgba(242,238,231,.05) 1px,transparent 1px),linear-gradient(90deg,rgba(242,238,231,.05) 1px,transparent 1px)}
:root[data-theme=dark] .gb-dock{background:linear-gradient(to top,#161513 70%,transparent)}
html.calm[data-theme=dark] .modal,html.calm[data-theme=dark] .menu,html.calm[data-theme=dark] .pop{background:#1f1d1a;color:#f2eee7;border-color:#35322d}
html.calm[data-theme=dark] input,html.calm[data-theme=dark] select,html.calm[data-theme=dark] textarea{background:#1f1d1a;color:#f2eee7;border-color:#4a463f}
:root[data-theme=dark] .pt-rings{color:color-mix(in srgb,var(--brand) 35%,transparent)}
/* links and the brand accent stay readable on dark */
:root[data-theme=dark] .pt a:not(.pt-btn):not(.pt-si):not(.pt-card):not(.hb-res):not(.hb-evm):not(.hb-tile):not(.pt-sbrand):not(.pt-sstudio),:root[data-theme=dark] .hb-tlink,:root[data-theme=dark] .ez-link,:root[data-theme=dark] .ez-add,:root[data-theme=dark] .pt-full,:root[data-theme=dark] .hb-kick{color:color-mix(in srgb,var(--brand) 55%,#fff)}

/* buttons: on dark the primary takes the brand colour (a near-black button would disappear) */
:root[data-theme=dark] .ez-btn,:root[data-theme=dark] .gb-go,:root[data-theme=dark] .pt .pt-btn:not(.secondary):not(.quiet),:root[data-theme=dark] .pt-modal .pt-btn:not(.secondary):not(.quiet),:root[data-theme=dark] .sp-btn:not(.second),:root[data-theme=dark] .pt-auth .pt-btn,html.calm[data-theme=dark] .b.pri{
  background:var(--brand,#0b5563);border-color:var(--brand,#0b5563);color:#fff;box-shadow:inset 0 1px 0 rgba(255,255,255,.12),0 8px 20px -12px rgba(0,0,0,.6)}
:root[data-theme=dark] .ez-btn::after,:root[data-theme=dark] .pt-auth .pt-btn::after{background-color:rgba(255,255,255,.2)}
:root[data-theme=dark] .gb-go svg{background:rgba(255,255,255,.2)}
:root[data-theme=dark] .ez-cat[aria-checked="true"]::after,:root[data-theme=dark] .pt .pt-chips button[aria-pressed=true]::after{background:#f2eee7}
:root[data-theme=dark] .pt-seg-s button[aria-pressed=true]{background:#2c2a26;color:#f2eee7}

/* ---------- the switches ---------- */
.ui-theme button svg{width:14px;height:14px;vertical-align:-2px}
.pt-prefs{position:absolute;top:16px;right:16px;z-index:5;display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.pt-prefs .ui-langs{display:inline-flex;gap:2px;background:var(--surface);border:1px solid var(--hairline);border-radius:12px;padding:3px}
.pt-prefs .ui-langs button{border:0;background:none;border-radius:9px;min-height:32px;padding:0 10px;font:500 13px var(--font-ui);color:var(--ink-muted);cursor:pointer}
.pt-prefs .ui-langs button.on{background:var(--surface-sunk);color:var(--ink);font-weight:600}
.pt-prefs .ui-theme button{padding:0 8px}
.pt.pt-auth{position:relative}
@media (max-width:640px){.pt-prefs{position:static;justify-content:center;margin:12px 0 0}}

/* ---------- right to left (Arabic) ---------- */
:root[dir=rtl] *{letter-spacing:0!important}   /* Arabic letters join; spacing would break them */
:root[dir=rtl] .hb-t th,:root[dir=rtl] .sp-t th{text-align:right}
@media (min-width:961px){:root[dir=rtl] .pt.pt-shell{background:linear-gradient(to left,#fff 272px,var(--paper) 272px)}:root[dir=rtl][data-theme=dark] .pt.pt-shell{background:linear-gradient(to left,#1b1a17 272px,#161513 272px)}}
:root[dir=rtl] .pt-side{border-right:0;border-left:1px solid var(--hairline)}
@media (max-width:960px){:root[dir=rtl] .pt-side{left:auto;right:0;transform:translateX(100%)}:root[dir=rtl] .pt-side.open{transform:none}}
:root[dir=rtl] .pt-sg:not([open])>summary svg,:root[dir=rtl] .sd-acc:not([open])>summary svg{transform:rotate(90deg)}
:root[dir=rtl] .ez-btn::after,:root[dir=rtl] .pt-auth .pt-btn::after,:root[dir=rtl] .gb-go svg,:root[dir=rtl] .pt-arr svg,:root[dir=rtl] .hb-tlink svg,:root[dir=rtl] .pt-back svg,:root[dir=rtl] .gb-back svg,:root[dir=rtl] .pt-sstudio svg:last-child{transform:scaleX(-1)}
:root[dir=rtl] .pt-prefs{right:auto;left:16px}
html.calm[dir=rtl] #root.has-side{padding-left:0;padding-right:var(--sw)}
html.calm[dir=rtl] .side{left:auto;right:0;border-right:0;border-left:1px solid var(--line)}
@media (max-width:820px){html.calm[dir=rtl] #root.has-side{padding-right:0}html.calm[dir=rtl] .side{transform:translateX(100%)}html.calm[dir=rtl].side-out .side{transform:none}}
:root[dir=rtl] .gb-dock-in{transform:none}
@media (min-width:1100px){:root[dir=rtl] .gb-dock-in{transform:translateX(-134px)}}

/* text that was set for light grounds */
:root[data-theme=dark] .hb-eva,:root[data-theme=dark] .hb-pbody p,:root[data-theme=dark] .hb-comm p,:root[data-theme=dark] .hb-pfull,:root[data-theme=dark] .hb-cm p,:root[data-theme=dark] .sp-steps,:root[data-theme=dark] .pt-card p{color:#ddd7cc}
html.calm[data-theme=dark] .avatar{background:#f2eee7;color:#161513}
:root[data-theme=dark] .hb-date{background:color-mix(in srgb,var(--brand) 22%,#1f1d1a);color:color-mix(in srgb,var(--brand) 55%,#fff)}
