/* ==========================================================================
   หน้า SSO / Portal กลาง — ธีมเดียวกับ spnan / planpua / oes / puacar / pythonpua (2026-11-14)
   โหลดต่อจาก <style> ในหน้า (index.php, users_layout.php) — แถบบน + เมนูข้าง (sso_shell.php), ฟอนต์ Sarabun ในเครื่อง
   ========================================================================== */
/* Sarabun — SIL Open Font License 1.1 (assets/fonts/OFL.txt) */
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/sarabun-400-thai.woff2') format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/sarabun-400-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/sarabun-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/sarabun-500-thai.woff2') format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/sarabun-500-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/sarabun-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/sarabun-600-thai.woff2') format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/sarabun-600-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/sarabun-600-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/sarabun-700-thai.woff2') format('woff2'); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Sarabun'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/sarabun-700-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --primary-color: #7562C9; --primary-hover: #6A57BE; --primary-dark: #5B48A8; --primary-soft: #EFEBFB; --primary-rgb: 117, 98, 201;
  --bs-primary: #7562C9; --bs-primary-rgb: 117, 98, 201;
  --bs-link-color: #6A57BE; --bs-link-hover-color: #5B48A8;
}
:root {
  --ss-bg: #f7f5fc; --ss-surface: #fff; --ss-ink: #0f172a; --ss-ink2: #334155; --ss-muted: #64748b;
  --ss-line: #e2e8f0; --ss-line2: #cbd5e1; --ss-subtle: #f1f5f9;
  --ss-r: 10px; --ss-r-sm: 7px;
  --ss-sh-1: 0 1px 2px rgba(15, 23, 42, .05); --ss-sh-2: 0 4px 16px rgba(15, 23, 42, .08); --ss-sh-3: 0 24px 60px rgba(15, 23, 42, .22);
  --ss-focus: 0 0 0 3px rgba(var(--primary-rgb), .22);
  --ss-top-h: 56px; --ss-side-w: 240px;
  --ss-font: "Sarabun", "TH Sarabun New", "Sukhumvit Set", "Leelawadee UI", Tahoma, system-ui, sans-serif;
  --bs-body-font-family: var(--ss-font);
  --bs-body-bg: var(--ss-bg);
  --bs-body-color: var(--ss-ink);
  --bs-border-color: var(--ss-line);
}
html body { font-family: var(--ss-font); background-color: var(--ss-bg); color: var(--ss-ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { color: var(--ss-ink); }
/* ---------- แถบบน + เมนูข้าง (sso_shell.php) ---------- */
body.ss-has-side { padding-left: var(--ss-side-w); padding-top: var(--ss-top-h); }
body.ss-nav-collapsed { --ss-side-w: 68px; }
.ss-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1030; height: var(--ss-top-h);
  display: flex; align-items: center; gap: .75rem; padding: 0 1rem;
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--ss-line);
}
.ss-icon-btn {
  flex: none; width: 40px; height: 40px; display: inline-grid; place-items: center; font-size: 1.3rem;
  border: 1px solid transparent; border-radius: var(--ss-r-sm); background: transparent; color: var(--ss-ink2); text-decoration: none;
}
.ss-icon-btn:hover { background: var(--ss-subtle); border-color: var(--ss-line); color: var(--ss-ink); }
.ss-icon-btn:focus-visible { outline: none; box-shadow: var(--ss-focus); }
.ss-brand { display: flex; align-items: center; gap: .6rem; min-width: calc(var(--ss-side-w) - 4.25rem); flex: none; color: var(--ss-ink); text-decoration: none; white-space: nowrap; }
.ss-brand:hover { color: var(--ss-ink); }
.ss-brand img { width: 30px; height: 30px; object-fit: contain; flex: none; }
.ss-brand-t { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.ss-brand-t b { font-size: 1rem; font-weight: 700; }
.ss-brand-t small { font-size: .72rem; font-weight: 500; color: var(--ss-muted); }
.ss-spacer { flex: 1; }
.ss-who { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.ss-who-t { display: flex; flex-direction: column; line-height: 1.25; text-align: right; min-width: 0; max-width: 240px; }
.ss-who-t b { font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-who-t small { font-size: .76rem; color: var(--ss-muted); }
.ss-avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; background: rgba(var(--primary-rgb), .14); color: var(--primary-dark); }

.ss-side {
  position: fixed; top: var(--ss-top-h); left: 0; bottom: 0; width: var(--ss-side-w); z-index: 1020;
  display: flex; flex-direction: column; gap: 1.1rem; padding: 1rem .75rem; overflow-y: auto; overscroll-behavior: contain;
  background: var(--ss-surface); border-right: 1px solid var(--ss-line);
}
.ss-nav-g { display: flex; flex-direction: column; gap: 2px; }
.ss-nav-h { font-size: .72rem; font-weight: 600; letter-spacing: .04em; color: #94a3b8; padding: 0 .7rem .35rem; }
.ss-side a { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; min-height: 40px; border-radius: var(--ss-r-sm); color: var(--ss-ink2); font-size: .92rem; line-height: 1.3; text-decoration: none; }
.ss-side a > i { font-size: 1.05rem; width: 1.2rem; text-align: center; color: #94a3b8; flex: none; }
.ss-side a:hover { background: var(--ss-subtle); color: var(--ss-ink); }
.ss-side a.active { background: rgba(var(--primary-rgb), .09); color: var(--primary-dark); font-weight: 600; }
.ss-side a.active > .bi { color: var(--primary-color); }
.ss-side-foot { margin-top: auto; font-size: .76rem; color: #94a3b8; padding: 0 .7rem; }
.ss-scrim { position: fixed; inset: var(--ss-top-h) 0 0 0; background: rgba(15, 23, 42, .35); z-index: 1019; }

body.ss-nav-collapsed .ss-side a { justify-content: center; }
body.ss-nav-collapsed .ss-side a > span, body.ss-nav-collapsed .ss-nav-h, body.ss-nav-collapsed .ss-side-foot { display: none; }
body.ss-nav-collapsed .ss-brand { min-width: 0; }
body.ss-nav-collapsed .ss-brand-t { display: none; }

@media (max-width: 1199.98px) { .ss-who-t { display: none; } }
@media (max-width: 991.98px) {
  body.ss-has-side, body.ss-has-side.ss-nav-collapsed { padding-left: 0; --ss-side-w: 280px; }
  .ss-brand, body.ss-nav-collapsed .ss-brand { min-width: 0; }
  body.ss-nav-collapsed .ss-brand-t { display: flex; }
  .ss-side { width: min(280px, 85vw); transform: translateX(-100%); transition: transform .2s ease, box-shadow .2s ease; box-shadow: none; }
  body.ss-nav-open .ss-side { transform: none; box-shadow: var(--ss-sh-3); }
  body.ss-nav-collapsed .ss-side a { justify-content: flex-start; }
  body.ss-nav-collapsed .ss-side a > span, body.ss-nav-collapsed .ss-nav-h, body.ss-nav-collapsed .ss-side-foot { display: revert; }
}
@media (max-width: 575.98px) { .ss-top { gap: .5rem; padding: 0 .6rem; } .ss-brand-t small { display: none; } }
@media (prefers-reduced-motion: reduce) { .ss-side { transition: none; } }
@media print {
  .ss-top, .ss-side, .ss-scrim { display: none !important; }
  body.ss-has-side { padding: 0 !important; }
}
.ss-icon-btn { font-size: 1.1rem; }
.ss-brand img { width: 32px; height: 32px; }

/* แถบเลือกหลายรายการที่ติดขอบบน (users.php) ต้องอยู่ใต้แถบบน */
body.ss-has-side .bulk-bar { top: var(--ss-top-h); }
