/* Light/dark toggle (theme.js wires every [data-theme-toggle]). One empty <button class="theme-tg"> on each page;
   the icon is drawn here, so no page repeats SVG. It shows the theme a click switches to: moon in light, sun in dark.
   Colours come from the host page's tokens (site.css, register.css, net.css) with light fallbacks. */
:root{
  --tg-moon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.2 14.6A8.3 8.3 0 0 1 9.4 3.8a8.3 8.3 0 1 0 10.8 10.8z'/%3E%3C/svg%3E");
  --tg-sun:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.2'/%3E%3Cpath d='M12 2.6v2.1M12 19.3v2.1M2.6 12h2.1M19.3 12h2.1M5.4 5.4l1.5 1.5M17.1 17.1l1.5 1.5M5.4 18.6l1.5-1.5M17.1 6.9l1.5-1.5'/%3E%3C/svg%3E");
}
.theme-tg{flex:none;display:inline-grid;place-items:center;width:42px;height:42px;padding:0;margin:0;
  border:1px solid var(--line,#E6E8EC);border-radius:12px;background:var(--paper,#FFFFFF);color:var(--ink-2,#1F242B);
  cursor:pointer;-webkit-tap-highlight-color:transparent;
  transition:border-color .15s ease,color .15s ease,transform .12s ease}
.theme-tg::before{content:"";width:19px;height:19px;background:currentColor;
  -webkit-mask:var(--tg-moon) center/contain no-repeat;mask:var(--tg-moon) center/contain no-repeat}
:where([data-theme="dark"]) .theme-tg::before{-webkit-mask-image:var(--tg-sun);mask-image:var(--tg-sun)}
.theme-tg:hover{border-color:var(--blue,#2563EB);color:var(--blue-deep,#1D4ED8)}
.theme-tg:active{transform:scale(.92)}
.theme-tg:focus-visible{outline:2px solid var(--blue,#2563EB);outline-offset:2px}
@media (prefers-reduced-motion:reduce){.theme-tg{transition:none}.theme-tg:active{transform:none}}

/* placements that the host headers do not already lay out */
/* CPIRD TOT Enneagram logo beside the สพพ. logo (headers, footers, the cohort6 sidebar) */
.logo-cpird{flex:none;display:inline-block;border-radius:50%;vertical-align:middle}
.sb-logo a{display:inline-flex;align-items:center;gap:8px}
.sb-logo .theme-tg{margin-left:auto}
@media (max-width:1000px){.sb-logo .theme-tg{margin-right:52px}} /* clear the drawer's close button */
.login-card{position:relative}
.login-card > .theme-tg{position:absolute;top:16px;right:16px}
.login-card > .theme-tg + .tb-brand{padding-right:48px} /* the brand wraps instead of running under the button */
/* .nh header (home, network, hub) on phones: the bar has no room left (the brand must never end in "…"),
   so the icon leaves the bar and the open menu carries a labelled switch: on = dark. */
.nh-theme{display:none}
@media (max-width:520px){
  .nh-act .theme-tg{display:none}
  .nh-nav .nh-theme{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;
    margin:6px 0 0;padding:14px 10px 4px;border:0;border-top:1px solid var(--line,#E6E8EC);border-radius:0;
    background:none;font:inherit;font-size:16px;font-weight:600;color:var(--ink-2,#1F242B);text-align:left;cursor:pointer}
  .nh-theme::after{content:"";flex:none;width:42px;height:24px;border-radius:999px;
    background:var(--gray-2,#98A0AC) radial-gradient(circle at 12px 12px,#FFFFFF 8px,transparent 8.6px)}
  .nh-theme[aria-pressed="true"]::after{background:var(--blue,#2563EB) radial-gradient(circle at 30px 12px,#FFFFFF 8px,transparent 8.6px)}
}
