/*
 * RCA Track — App shell (spec §11.2 ; IMG_2609 แบบหลัก, IMG_2603 responsive)
 * sidebar 248px (ย่อ 72px — class .rt-sidebar-collapsed บน <html>) ; topbar 60px sticky ; content padding 24px (mobile 16px)
 * < 992px: sidebar เป็น drawer (class .rt-sidebar-open บน <html>) + backdrop
 */

[x-cloak] { display: none !important; }

.rt-skip {
  position: fixed; top: .5rem; left: .5rem; z-index: 2000;
  background: var(--rt-surface); color: var(--rt-text); padding: .5rem 1rem;
  border-radius: var(--rt-radius); box-shadow: var(--rt-shadow-pop);
}

.rt-shell { min-height: 100vh; }

/* ---------------- Sidebar ---------------- */
.rt-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1045;
  width: var(--rt-sidebar-w);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--rt-sidebar-bg) 0%, var(--rt-sidebar-bg-2) 100%);
  color: var(--rt-sidebar-text);
  border-right: 1px solid var(--rt-sidebar-border);
  transition: width .2s ease, transform .25s ease;
}
.rt-brand {
  display: flex; align-items: center; gap: .7rem;
  height: 76px; padding: 0 1.1rem; flex-shrink: 0;
  color: #fff; text-decoration: none;
}
.rt-brand:hover { color: #fff; }
.rt-brand__mark { width: 40px; height: 40px; flex-shrink: 0; }
.rt-brand__mark .ring { stroke: var(--rt-primary); }
.rt-brand__mark .check { stroke: #fff; }
.rt-brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.rt-brand__name { font-size: 1.25rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.rt-brand__name em { font-style: normal; color: var(--rt-primary); }
.rt-brand__tagline {
  font-size: .6875rem; color: var(--rt-sidebar-muted); margin-top: .2rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.rt-nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: .5rem .75rem 1rem; scrollbar-width: thin; scrollbar-color: rgba(203, 213, 225, .2) transparent; }
.rt-nav__group { margin: 0; padding: 0; list-style: none; }
.rt-nav__group + .rt-nav__group { margin-top: .75rem; }
.rt-nav__heading {
  display: block; font-size: .72rem; font-weight: 500; color: var(--rt-sidebar-muted);
  padding: .9rem .75rem .4rem; letter-spacing: .02em; white-space: nowrap;
}
.rt-nav__link {
  position: relative;
  display: flex; align-items: center; gap: .75rem;
  min-height: 44px; padding: .55rem .75rem; margin: 2px 0;
  border-radius: 10px; color: var(--rt-sidebar-text); text-decoration: none;
  font-size: .9rem; font-weight: 400;
  transition: background-color .15s ease, color .15s ease;
}
.rt-nav__link .bi { font-size: 1.1rem; width: 1.25rem; text-align: center; flex-shrink: 0; }
.rt-nav__link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.rt-nav__link:focus-visible { outline: 2px solid var(--rt-primary); outline-offset: -2px; }
.rt-nav__link.is-active { background: var(--rt-sidebar-active); color: var(--rt-sidebar-text-active); font-weight: 500; }
.rt-nav__link.is-active::before {
  content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--rt-primary);
}
.rt-nav__label { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-nav__badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--rt-primary-fill); color: #fff; font-size: .7rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rt-sidebar__foot {
  flex-shrink: 0; padding: 1rem 1.25rem 1.1rem;
  border-top: 1px solid var(--rt-sidebar-border);
  font-size: .75rem; color: var(--rt-sidebar-muted);
}
.rt-sidebar__quote { font-style: italic; color: var(--rt-sidebar-text); margin: 0 0 .6rem; line-height: 1.5; }
.rt-sidebar__quote::after { content: ""; display: block; width: 36px; height: 2px; margin-top: .6rem; background: var(--rt-primary); border-radius: 2px; }
.rt-sidebar__version { margin: 0; letter-spacing: .03em; }
/* เลข version = ลิงก์ไปหน้าประวัติการปรับปรุงระบบ (/changelog) */
.rt-sidebar__version a { color: inherit; text-decoration: none; border-radius: 4px; }
.rt-sidebar__version a:hover, .rt-sidebar__version a[aria-current="page"] { text-decoration: underline; text-underline-offset: 2px; }
.rt-sidebar__version a:focus-visible { outline: 2px solid var(--rt-primary); outline-offset: 2px; }

/* ย่อ sidebar (desktop) */
@media (min-width: 992px) {
  .rt-sidebar-collapsed .rt-sidebar { width: var(--rt-sidebar-w-collapsed); }
  .rt-sidebar-collapsed .rt-brand { padding: 0; justify-content: center; }
  .rt-sidebar-collapsed .rt-brand__text,
  .rt-sidebar-collapsed .rt-sidebar__foot .rt-sidebar__quote { display: none; }
  .rt-sidebar-collapsed .rt-nav { padding-inline: .6rem; }
  .rt-sidebar-collapsed .rt-nav__heading {
    height: 1px; padding: 0; margin: .9rem .5rem .5rem; overflow: hidden;
    background: var(--rt-sidebar-border); color: transparent;
  }
  .rt-sidebar-collapsed .rt-nav__link { justify-content: center; padding-inline: 0; }
  .rt-sidebar-collapsed .rt-nav__link.is-active::before { left: -.6rem; }
  .rt-sidebar-collapsed .rt-nav__label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .rt-sidebar-collapsed .rt-nav__badge {
    position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; font-size: .6rem;
  }
  .rt-sidebar-collapsed .rt-sidebar__foot { padding-inline: .5rem; text-align: center; font-size: .65rem; }
  .rt-sidebar-collapsed .rt-main { margin-left: var(--rt-sidebar-w-collapsed); }
}

.rt-sidebar-backdrop {
  position: fixed; inset: 0; z-index: 1040; background: var(--rt-backdrop);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}

/* ---------------- Main + Topbar ---------------- */
.rt-main { margin-left: var(--rt-sidebar-w); min-width: 0; min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .2s ease; }

.rt-topbar {
  position: sticky; top: 0; z-index: 1030;
  height: var(--rt-topbar-h);
  display: flex; align-items: center; gap: .75rem;
  padding: 0 var(--rt-content-pad);
  background: color-mix(in srgb, var(--rt-surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rt-border);
}
.rt-topbar__btn {
  width: 38px; height: 38px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  border: 0; border-radius: var(--rt-radius); background: transparent; color: var(--rt-text-muted);
  font-size: 1.1rem; transition: background-color .15s ease, color .15s ease;
}
.rt-topbar__btn:hover { background: var(--bs-secondary-bg); color: var(--rt-text); }
.rt-topbar__btn:focus-visible { outline: 2px solid var(--rt-primary); outline-offset: 1px; }
.rt-topbar__btn[hidden] { display: none; }
/* BL-12 ตัวสลับภาษาแบบปุ่มเดียว (partials/locale_switch variant=cycle) — ขนาดเท่าปุ่ม dark/light */
.rt-lang-cycle { display: inline-flex; }
.rt-lang-cycle__code { font-size: .78rem; font-weight: 700; letter-spacing: .04em; line-height: 1; padding: 3px 4px; border: 1.5px solid currentColor; border-radius: 4px; }
.rt-lang-cycle[aria-busy="true"] .rt-lang-cycle__btn { opacity: .55; cursor: progress; }
.rt-topbar__dot {
  position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--rt-danger); color: #fff; font-size: .625rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--rt-surface);
}
.rt-topbar__spacer { flex: 1 1 auto; }
.rt-topbar__actions { display: flex; align-items: center; gap: .25rem; }

.rt-search { position: relative; flex: 0 1 520px; min-width: 0; margin: 0; }
.rt-search__icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--rt-text-muted); pointer-events: none; }
.rt-search__input {
  width: 100%; height: 40px; padding: 0 2.6rem 0 2.4rem;
  background: var(--rt-surface-2); border: 1px solid var(--rt-border); border-radius: 10px;
  color: var(--rt-text); font-size: .875rem;
}
.rt-search__input::placeholder { color: var(--rt-text-muted); }
.rt-search__input:focus { outline: 0; border-color: var(--rt-primary); box-shadow: var(--rt-focus-ring); background: var(--rt-surface); }
.rt-search__kbd {
  position: absolute; right: .6rem; top: 50%; transform: translateY(-50%);
  min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rt-border); border-radius: 5px; background: var(--rt-surface);
  font-size: .72rem; color: var(--rt-text-muted); font-family: var(--rt-font); padding: 0 .3rem;
}
.rt-search__input:focus + .rt-search__kbd { display: none; }

/* P2-T14 global search dropdown (combobox listbox — js/global-search.js) */
.rt-search__panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 1040;
  background: var(--rt-surface); border: 1px solid var(--rt-border); border-radius: var(--rt-radius-lg);
  box-shadow: var(--rt-shadow-pop); overflow: hidden;
}
.rt-search__panel[hidden] { display: none; }
.rt-search__list { list-style: none; margin: 0; padding: .35rem; max-height: min(420px, 60vh); overflow-y: auto; }
.rt-search__list:empty { display: none; }
.rt-search__option {
  display: flex; flex-direction: column; gap: .15rem; padding: .5rem .65rem; border-radius: var(--rt-radius);
  cursor: pointer; color: var(--rt-text); min-width: 0;
}
.rt-search__option.is-active, .rt-search__option[aria-selected="true"] { background: var(--rt-primary-soft); box-shadow: inset 3px 0 0 var(--rt-primary); }
.rt-search__head { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.rt-search__no { font-weight: 600; font-size: .85rem; color: var(--rt-primary-text); white-space: nowrap; }
.rt-search__head .rt-badge { font-size: .68rem; }
.rt-search__title { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-search__meta { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--rt-text-muted); min-width: 0; }
.rt-search__meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-search__status { padding: .55rem .9rem; font-size: .78rem; color: var(--rt-text-muted); }
.rt-search__status:empty { display: none; }
.rt-search__all {
  display: flex; align-items: center; gap: .45rem; padding: .6rem .9rem; font-size: .8rem; font-weight: 500;
  border-top: 1px solid var(--rt-border); color: var(--rt-primary-text); text-decoration: none;
}
.rt-search__all[hidden] { display: none; }
.rt-search__all:hover, .rt-search__all:focus-visible { background: var(--rt-surface-2); outline: 0; }
@media (prefers-reduced-motion: no-preference) {
  .rt-search__option { transition: background-color .1s ease; }
}

.rt-user { display: flex; align-items: center; gap: .6rem; padding: .25rem .4rem; border: 0; background: transparent; border-radius: 10px; color: var(--rt-text); text-align: left; }
.rt-user:hover { background: var(--bs-secondary-bg); }
.rt-user__avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #0F766E; color: #fff; font-size: .8rem; font-weight: 600;
}
.rt-user__avatar .bi { font-size: 1.05rem; }
.rt-user__text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.rt-user__name { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.rt-user__role { font-size: .72rem; color: var(--rt-text-muted); white-space: nowrap; }
.rt-user .bi-chevron-down { font-size: .75rem; color: var(--rt-text-muted); }
.rt-divider-v { width: 1px; height: 28px; background: var(--rt-border); margin: 0 .35rem; }

.rt-notify-menu { width: min(360px, 92vw); padding: 0; }
.rt-notify-menu__head { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-bottom: 1px solid var(--rt-border); font-weight: 600; }
.rt-notify-menu__empty { padding: 1.5rem 1rem; text-align: center; color: var(--rt-text-muted); font-size: .85rem; }
.rt-notify-menu__empty .bi { display: block; font-size: 1.6rem; margin-bottom: .35rem; opacity: .6; }

/* P3-T04 กระดิ่ง (js/notification-bell.js) — แถบสีซ้าย = priority (critical แดง / high อำพัน) ; จุดน้ำเงิน = ยังไม่อ่าน */
.rt-topbar__dot[hidden], .rt-notify-menu__empty[hidden], .rt-notify-menu__readall[hidden] { display: none; }
.rt-notify-menu__readall {
  display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .5rem; border: 0; border-radius: var(--rt-radius-sm);
  background: transparent; color: var(--rt-primary-text); font-size: .78rem; font-weight: 500;
}
.rt-notify-menu__readall:hover { background: var(--rt-primary-soft); }
.rt-notify-menu__readall:focus-visible { outline: 2px solid var(--rt-primary); outline-offset: 1px; }
.rt-notify-menu__readall:disabled { opacity: .55; }
.rt-notify-menu__list { list-style: none; margin: 0; padding: .3rem; max-height: min(440px, 60vh); overflow-y: auto; overscroll-behavior: contain; }
.rt-notify-menu__list:empty { display: none; }
.rt-notify-menu__status { padding: .5rem 1rem; font-size: .78rem; color: var(--rt-text-muted); }
.rt-notify-menu__status:empty { display: none; }
.rt-notify-menu__foot { display: flex; border-top: 1px solid var(--rt-border); }
.rt-notify-menu__foot a {
  flex: 1 1 50%; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .6rem .5rem;
  font-size: .8rem; font-weight: 500; color: var(--rt-primary-text); text-decoration: none;
}
.rt-notify-menu__foot a + a { border-left: 1px solid var(--rt-border); color: var(--rt-text-muted); }
.rt-notify-menu__foot a:hover, .rt-notify-menu__foot a:focus-visible { background: var(--rt-surface-2); outline: 0; }
.rt-notify-menu__foot a:focus-visible { box-shadow: inset 0 0 0 2px var(--rt-primary); }

.rt-notify-item { position: relative; }
.rt-notify-item + .rt-notify-item { margin-top: 2px; }
.rt-notify-item__link {
  position: relative; display: flex; align-items: flex-start; gap: .5rem; width: 100%; padding: .55rem .7rem .55rem .85rem;
  border: 0; border-radius: var(--rt-radius); background: transparent; color: var(--rt-text); text-align: left; text-decoration: none;
}
.rt-notify-item__link::before {
  content: ""; position: absolute; left: 0; top: .45rem; bottom: .45rem; width: 3px; border-radius: 3px; background: transparent;
}
.rt-notify-item--high .rt-notify-item__link::before { background: var(--rt-warning); }
.rt-notify-item--critical .rt-notify-item__link { background: var(--rt-sev-critical-bg); }
.rt-notify-item--critical .rt-notify-item__link::before { background: var(--rt-sev-critical); }
.rt-notify-item__link:hover { background: var(--rt-row-hover); color: var(--rt-text); }
.rt-notify-item__link:focus-visible { outline: 2px solid var(--rt-primary); outline-offset: -2px; }
.rt-notify-item__link[aria-disabled="true"] { cursor: default; }
.rt-notify-item__body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; flex: 1 1 auto; }
.rt-notify-item__head { display: flex; align-items: baseline; gap: .4rem; min-width: 0; }
.rt-notify-item__head .rt-badge { font-size: .66rem; flex-shrink: 0; }
.rt-notify-item__title { font-size: .84rem; line-height: 1.35; overflow-wrap: anywhere; color: var(--rt-text-muted); }
.rt-notify-item.is-unread .rt-notify-item__title { color: var(--rt-text); font-weight: 600; }
.rt-notify-item__text {
  font-size: .78rem; color: var(--rt-text-muted); overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.rt-notify-item__time { font-size: .72rem; color: var(--rt-text-muted); font-variant-numeric: tabular-nums; }
.rt-notify-item__dot { flex-shrink: 0; width: 8px; height: 8px; margin-top: .4rem; border-radius: 50%; background: var(--rt-info); }
.rt-notify-item--critical .rt-notify-item__dot { background: var(--rt-sev-critical); }
@media (prefers-reduced-motion: no-preference) {
  .rt-notify-item__link { transition: background-color .12s ease; }
}
@media (forced-colors: active) {
  .rt-notify-item__link::before, .rt-notify-item__dot { background: CanvasText; }
}

.rt-content { flex: 1 1 auto; padding: var(--rt-content-pad); min-width: 0; }
.rt-content:focus { outline: 0; }

/* ---------------- Responsive ---------------- */
@media (max-width: 991.98px) {
  /* P8-T04: drawer ที่ปิดอยู่ต้องไม่รับ focus/ไม่ถูกอ่าน (visibility หลังเลื่อนออกเสร็จ) ; เปิด = มองเห็นทันที */
  .rt-sidebar { transform: translateX(-100%); box-shadow: none; visibility: hidden; transition: transform .25s ease, visibility 0s linear .25s; }
  .rt-sidebar-open .rt-sidebar { transform: none; box-shadow: var(--rt-shadow-pop); visibility: visible; transition: transform .25s ease, visibility 0s; }
  .rt-main { margin-left: 0; }
  .rt-sidebar-open { overflow: hidden; }
}
@media (min-width: 992px) {
  .rt-sidebar-backdrop { display: none; }
  .rt-only-drawer { display: none !important; }
}
@media (max-width: 991.98px) {
  .rt-only-desktop { display: none !important; }
}
@media (max-width: 767.98px) {
  :root { --rt-content-pad: 16px; }
  .rt-topbar { gap: .25rem; }
  .rt-search { display: none; }
  .rt-search-open .rt-search {
    display: block; position: absolute; left: 12px; right: 12px; top: 10px; flex: none; z-index: 2;
  }
  .rt-search-open .rt-search__input { background: var(--rt-surface); }
  .rt-user__text, .rt-divider-v, .rt-hide-sm { display: none !important; }
}
@media (min-width: 768px) {
  .rt-show-sm { display: none !important; }
}

/* ---------------- Error page (layouts/error.php) ---------------- */
.rt-error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--rt-bg); }
.rt-error {
  width: min(520px, 100%); text-align: center; padding: 2.5rem 2rem;
  background: var(--rt-surface); border: 1px solid var(--rt-border); border-radius: var(--rt-radius-xl); box-shadow: var(--rt-shadow-card);
}
.rt-error__brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--rt-text); text-decoration: none; margin-bottom: 1.75rem; }
.rt-error__brand .rt-brand__mark { width: 30px; height: 30px; }
.rt-error__brand .rt-brand__mark .check { stroke: var(--rt-text); }
.rt-error__brand em { font-style: normal; color: var(--rt-primary-text); } /* P8-T04: บนพื้นขาว #F97316 ได้ 2.8:1 */
.rt-error__code { font-size: 3.5rem; font-weight: 700; line-height: 1; margin: 0 0 .5rem; color: var(--rt-primary-text); font-variant-numeric: tabular-nums; }
.rt-error__title { font-size: 1.15rem; font-weight: 600; margin: 0 0 .5rem; }
.rt-error__message { color: var(--rt-text-muted); margin: 0 0 1.5rem; }
.rt-error__ref { font-size: .85rem; color: var(--rt-text-muted); margin: -0.5rem 0 1.5rem; }
.rt-error__ref code { color: var(--rt-text); background: var(--bs-secondary-bg); padding: .15rem .4rem; border-radius: 4px; user-select: all; }
.rt-error__debug { text-align: left; font-size: .75rem; max-height: 320px; overflow: auto; background: var(--rt-surface-2); border: 1px solid var(--rt-border); border-radius: var(--rt-radius); padding: .75rem; margin-bottom: 1.5rem; }
.rt-error__actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

@media print {
  .rt-sidebar, .rt-topbar, .rt-sidebar-backdrop { display: none !important; }
  .rt-main { margin-left: 0 !important; }
  .rt-content { padding: 0; }
}

/* ---------------- User menu (P1-T18) ---------------- */
.rt-user-menu { min-width: 240px; }
.rt-user-menu__head { display: flex; flex-direction: column; padding: .5rem 1rem .35rem; line-height: 1.3; }
.rt-user-menu__name { font-weight: 600; font-size: .9rem; color: var(--rt-text); }
.rt-user-menu__role { font-size: .78rem; color: var(--rt-text-muted); }

/* ---------------- Account pages: โปรไฟล์ / MFA (P1-T09, P1-T18) ---------------- */
.rt-account__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.rt-account__grid--profile { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.rt-account__stack { display: grid; gap: 1rem; }
.rt-account__card { border: 1px solid var(--rt-border); border-radius: var(--rt-radius-lg); box-shadow: var(--rt-shadow-card); background: var(--rt-surface); }
.rt-account__card .card-body { padding: 1.25rem 1.35rem; }
.rt-account__card--danger { border-color: color-mix(in srgb, var(--rt-danger) 35%, var(--rt-border)); }
.rt-account__heading { font-size: 1rem; font-weight: 600; margin: 0 0 .25rem; }
.rt-account__meta { font-size: .85rem; color: var(--rt-text-muted); margin: 0 0 1rem; }
.rt-account__hint { display: flex; gap: .4rem; font-size: .8rem; color: var(--rt-text-muted); margin: 1rem 0 0; }
.rt-account__warn { display: flex; gap: .4rem; margin: 1rem 0 0; font-size: .85rem; color: var(--rt-warning-strong); }
.rt-account__status { display: flex; gap: .9rem; align-items: center; margin-bottom: 1rem; }
.rt-account__status .rt-account__meta { margin: 0; }
.rt-account__icon {
  width: 44px; height: 44px; border-radius: var(--rt-radius-lg); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem;
  background: var(--rt-warning-soft); color: var(--rt-warning-strong);
}
.rt-account__icon.is-on { background: var(--rt-success-soft); color: var(--rt-success-strong); }
.rt-account .alert[hidden] { display: none; }
.rt-account .rt-auth__alert { display: flex; gap: .6rem; }
.rt-account .rt-auth__alert[hidden] { display: none; }

.rt-profile__id { display: flex; gap: .9rem; align-items: center; margin-bottom: 1.25rem; }
.rt-profile__id .rt-avatar--lg { --rt-avatar-size: 56px; }
.rt-profile__name { font-size: 1.2rem; font-weight: 700; margin: 0; }
.rt-profile__who .rt-account__meta { margin: .15rem 0 0; }
.rt-kv { margin: 0; display: grid; gap: .1rem; }
.rt-kv > div { display: grid; grid-template-columns: 9.5rem 1fr; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--rt-border); }
.rt-kv dt { font-weight: 500; font-size: .82rem; color: var(--rt-text-muted); }
.rt-kv dd { margin: 0; font-size: .9rem; word-break: break-word; }

.rt-security { list-style: none; margin: .75rem 0 0; padding: 0; }
.rt-security li { display: flex; align-items: center; gap: .85rem; padding: .7rem 0; border-top: 1px solid var(--rt-border); }
.rt-security li > .bi { font-size: 1.2rem; color: var(--rt-warning-strong); width: 1.5rem; text-align: center; }
.rt-security li > .bi.is-on, .rt-security li > .bi-key { color: var(--rt-text-muted); }
.rt-security li > .bi.is-on { color: var(--rt-success-strong); }
.rt-security li > span { flex: 1 1 auto; display: flex; flex-direction: column; font-size: .8rem; color: var(--rt-text-muted); }
.rt-security li > span strong { font-size: .9rem; color: var(--rt-text); font-weight: 600; }

.rt-roles { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; }
.rt-roles li { display: flex; flex-direction: column; padding: .6rem .8rem; border-radius: var(--rt-radius); background: var(--rt-surface-2); border-left: 3px solid var(--rt-primary); }
.rt-roles li.is-inactive { border-left-color: var(--rt-border); opacity: .7; }
.rt-roles__name { font-weight: 600; font-size: .9rem; }
.rt-roles__scope { font-size: .8rem; color: var(--rt-text-muted); }

/* ช่องรหัสผ่าน + ปุ่มแสดง/ซ่อน (ใช้ทั้ง guest และ app) */
.rt-password .form-control { border-right: 0; }
.rt-password .rt-password__toggle { border-color: var(--rt-border); color: var(--rt-text-muted); min-width: 46px; }
.rt-password .form-control.is-invalid + .rt-password__toggle { border-color: var(--rt-danger); }
.rt-password .form-control:focus + .rt-password__toggle { border-color: var(--rt-primary); }

/* นโยบายรหัสผ่าน (checklist) */
.rt-policy { margin: -.25rem 0 1.25rem; padding: .8rem 1rem; border-radius: var(--rt-radius-lg); background: var(--rt-surface-2); border: 1px solid var(--rt-border); }
.rt-policy__title { margin: 0 0 .35rem; font-size: .8rem; font-weight: 600; }
.rt-policy__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; font-size: .8rem; color: var(--rt-text-muted); }
.rt-policy__list li { display: flex; gap: .45rem; align-items: flex-start; }
.rt-policy__list .bi { flex-shrink: 0; width: 1rem; text-align: center; }
.rt-policy__list li.is-ok { color: var(--rt-success-strong); }
.rt-policy__list li.is-bad { color: var(--rt-danger-strong); }

.btn [data-rt-busy-label] + .spinner-border, .btn .spinner-border { margin-left: .1rem; }

@media (max-width: 991.98px) {
  .rt-account__grid--profile { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
  .rt-kv > div { grid-template-columns: 1fr; gap: .1rem; }
  .rt-security li { flex-wrap: wrap; }
}
