/*!
 * HRD Platform — Layout + shared components · P0-T17 (spec §11.2, §11.3, §11.6)
 *
 * โหลดท้ายสุด (หลัง theme.css, app-alerts.css) — ใช้ var(--hrd-*) จาก theme.css เท่านั้น
 * ไม่มี inline style ใน view (CSP) — ทุกการจัดวางอยู่ในไฟล์นี้
 *
 * Signature: "growth wave" — sidebar navy ที่มีคลื่นฟ้าเรืองแสงไล่ขึ้นทางขวาที่ฐาน (เส้นขอบฟ้าของ
 * "a Better Tomorrow") และ active item เป็นแถบน้ำเงินสว่างที่ลอยเหนือ gradient; ส่วนอื่นเรียบและมีวินัย
 *
 * Breakpoints: <992 = mobile/tablet (sidebar เป็น offcanvas) · ≥992 = laptop · ≥1400 = desktop
 */

/* ================================================================ shell */

.hrd-body {
    min-height: 100vh;
    background-color: var(--hrd-bg);
    color: var(--hrd-text);
}

.hrd-skip {
    position: fixed;
    top: .75rem;
    left: .75rem;
    z-index: 2000;
    padding: .6rem 1rem;
    border-radius: var(--hrd-radius-control);
    background: var(--hrd-surface);
    color: var(--hrd-navy);
    font-weight: 600;
    box-shadow: var(--hrd-shadow-raised);
}

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

.min-w-0 { min-width: 0; }

.hrd-main {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    /* ห้าม isolation/z-index/transform ที่นี่: modal ของแต่ละหน้าอยู่ใน .hrd-main แต่ backdrop ของ Bootstrap อยู่ใต้ body
       ถ้า .hrd-main เป็น stacking context → backdrop (z 1050) ทับ modal ทั้งก้อน กดอะไรไม่ได้ */
}

/* คลื่นฟ้าอ่อนมุมขวาบน (§11.3 --hrd-bg + wave) */
.hrd-main::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    z-index: -1;
    width: min(900px, 70%);
    height: 260px;
    background: url("../images/page-wave.svg") no-repeat top right / 100% 100%;
    pointer-events: none;
}

/* ================================================================ sidebar */

.hrd-sidebar {
    --bs-offcanvas-width: 280px;
    --bs-offcanvas-bg: var(--hrd-sidebar-start);
    --bs-offcanvas-color: var(--hrd-sidebar-text);
    --bs-offcanvas-border-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-image: var(--hrd-sidebar);
    color: var(--hrd-sidebar-text);
}

.hrd-sidebar__brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: var(--hrd-navbar-height);
    padding: .9rem 1.1rem .9rem 1.25rem;
}

.hrd-brand__mark {
    display: inline-flex;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(145deg, #5AA2FF 0%, #2F80ED 45%, #1A5FD0 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 14px rgba(3, 18, 52, .35);
    color: #FFFFFF;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.hrd-brand__logo {
    flex: 0 0 auto;
    max-width: 40px;
    max-height: 40px;
    border-radius: 10px;
    object-fit: contain;
    background: #FFFFFF;
}

.hrd-brand__text { min-width: 0; line-height: 1.2; }

.hrd-brand__name {
    display: block;
    overflow: hidden;
    color: var(--hrd-sidebar-text-strong);
    font-size: 1.1875rem;
    font-weight: 700;
    letter-spacing: -.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hrd-brand__by {
    display: block;
    overflow: hidden;
    margin-top: .15rem;
    color: var(--hrd-sidebar-text);
    font-size: var(--hrd-fs-xs);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hrd-sidebar__close {
    margin-left: auto;
    color: var(--hrd-sidebar-text-strong);
}

.hrd-sidebar__nav {
    flex: 1 1 auto;
    min-height: 0;
    padding: .25rem .75rem 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-color: rgba(255, 255, 255, .22) transparent;
    scrollbar-width: thin;
}

.hrd-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hrd-nav__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: .8rem;
    min-height: 40px;
    padding: .45rem .8rem;
    border-radius: 10px;
    color: var(--hrd-sidebar-text);
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    transition: background-color var(--hrd-duration) var(--hrd-ease), color var(--hrd-duration) var(--hrd-ease);
}

.hrd-nav__link:hover {
    background: var(--hrd-sidebar-hover);
    color: var(--hrd-sidebar-text-strong);
}

.hrd-nav__link:focus-visible {
    outline: 2px solid #FFFFFF;
    outline-offset: -2px;
}

.hrd-nav__icon {
    flex: 0 0 22px;
    width: 22px;
    font-size: 1.1rem;
    line-height: 1;
    text-align: center;
}

.hrd-nav__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* v1.0.137 กลุ่มเมนู (ภาพรวม / HRM / HRD / HROD / ระบบ) — หัวข้อยุบ/ขยายได้ จำสถานะใน localStorage (app-layout.js) */
.hrd-nav__group + .hrd-nav__group { margin-top: .55rem; }
.hrd-nav__group-title {
    display: flex; align-items: center; gap: .45rem; width: 100%; margin: 0 0 .2rem; padding: .3rem .6rem;
    border: 0; border-radius: 8px; background: transparent; color: var(--hrd-sidebar-text);
    font-size: .6875rem; font-weight: 600; letter-spacing: .04em; text-align: left; text-transform: uppercase; opacity: .72;
}
.hrd-nav__group-title:hover { opacity: 1; background: var(--hrd-sidebar-hover); }
.hrd-nav__group-title:focus-visible { outline: 2px solid #FFFFFF; outline-offset: -2px; opacity: 1; }
.hrd-nav__group-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrd-nav__group-dot { flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: #94A3B8; }
.hrd-nav__group-dot--overview { background: #60A5FA; }
.hrd-nav__group-dot--hrm { background: #F87171; }
.hrd-nav__group-dot--hrd { background: #4ADE80; }
.hrd-nav__group-dot--hrod { background: #A78BFA; }
.hrd-nav__group-chev { font-size: .7rem; transition: transform var(--hrd-duration) var(--hrd-ease); }
.hrd-nav__group.is-collapsed .hrd-nav__group-chev { transform: rotate(-90deg); }
.hrd-nav__group.is-collapsed > .hrd-nav { display: none; }

/* active = แถบน้ำเงินสว่าง (§11.2) — มีเพียงรายการเดียวเสมอ (MenuBuilder) */
.hrd-nav__link.is-active {
    background: var(--hrd-primary-gradient);
    box-shadow: 0 8px 18px rgba(3, 18, 52, .35), inset 0 1px 0 rgba(255, 255, 255, .22);
    color: #FFFFFF;
    font-weight: 600;
}

.hrd-nav__link.is-active::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -.75rem;
    width: 4px;
    height: 22px;
    border-radius: 0 4px 4px 0;
    background: #9CC6FF;
    transform: translateY(-50%);
}

.hrd-nav__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 .35rem;
    border-radius: var(--hrd-radius-pill);
    background: #DC2626;
    color: #FFFFFF;
    font-size: var(--hrd-fs-2xs);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.hrd-sidebar__foot {
    position: relative;
    flex: 0 0 auto;
    min-height: 150px;
    padding: 3.75rem 1.25rem 1.25rem;
    background: url("../images/sidebar-wave.svg") no-repeat bottom center / 100% 100%;
}

.hrd-sidebar__foot-name {
    display: block;
    color: var(--hrd-sidebar-text-strong);
    font-size: .95rem;
    font-weight: 700;
}

.hrd-sidebar__foot-text {
    display: block;
    max-width: 12rem;
    margin-top: .1rem;
    color: #E4EBF8;
    font-size: var(--hrd-fs-xs);
    line-height: 1.4;
}

.hrd-sidebar__collapse {
    position: absolute;
    top: calc(var(--hrd-navbar-height) / 2 - 14px);
    right: -14px;
    z-index: 2;
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--hrd-border);
    border-radius: 50%;
    background: var(--hrd-surface);
    box-shadow: var(--hrd-shadow-card);
    color: var(--hrd-navy);
    font-size: .8rem;
    transition: transform var(--hrd-duration) var(--hrd-ease);
}

.hrd-sidebar__collapse:hover { color: var(--hrd-primary); }

.hrd-sidebar__collapse:focus-visible {
    outline: 3px solid rgba(var(--hrd-primary-rgb), .55);
    outline-offset: 2px;
}

@media (min-width: 992px) {
    .hrd-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1030;
        width: var(--hrd-sidebar-width);
        overflow: visible;
        transition: width var(--hrd-duration) var(--hrd-ease);
    }

    .hrd-sidebar__collapse { display: inline-flex; }

    .hrd-main {
        margin-left: var(--hrd-sidebar-width);
        transition: margin-left var(--hrd-duration) var(--hrd-ease);
    }

    /* ---- ย่อ (desktop): icon อย่างเดียว, ชื่อยังอยู่สำหรับ screen reader + title tooltip */
    .hrd-sidebar-collapsed .hrd-sidebar { width: var(--hrd-sidebar-collapsed); }
    .hrd-sidebar-collapsed .hrd-main { margin-left: var(--hrd-sidebar-collapsed); }
    .hrd-sidebar-collapsed .hrd-sidebar__brand { justify-content: center; padding-right: .5rem; padding-left: .5rem; }
    .hrd-sidebar-collapsed .hrd-brand__text,
    .hrd-sidebar-collapsed .hrd-sidebar__foot-text,
    .hrd-sidebar-collapsed .hrd-sidebar__foot-name,
    .hrd-sidebar-collapsed .hrd-nav__label {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        margin: -1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }
    .hrd-sidebar-collapsed .hrd-sidebar__nav { padding-right: .6rem; padding-left: .6rem; }
    .hrd-sidebar-collapsed .hrd-nav__link { justify-content: center; padding-right: 0; padding-left: 0; }
    /* ย่อ sidebar: ซ่อนหัวข้อกลุ่ม แสดงทุกเมนูเป็นไอคอน (กลุ่มที่ยุบไว้ก็แสดง) */
    .hrd-sidebar-collapsed .hrd-nav__group-title { display: none; }
    .hrd-sidebar-collapsed .hrd-nav__group.is-collapsed > .hrd-nav { display: flex; }
    .hrd-sidebar-collapsed .hrd-nav__group + .hrd-nav__group { margin-top: .35rem; padding-top: .35rem; border-top: 1px solid rgba(255, 255, 255, .12); }
    .hrd-sidebar-collapsed .hrd-nav__link.is-active::before { left: -.6rem; }
    .hrd-sidebar-collapsed .hrd-nav__badge {
        position: absolute;
        top: 2px;
        right: 6px;
        min-width: 1.05rem;
        height: 1.05rem;
        font-size: .625rem;
    }
    .hrd-sidebar-collapsed .hrd-sidebar__foot { min-height: 110px; padding: 0; }
    .hrd-sidebar-collapsed .hrd-sidebar__collapse { transform: rotate(180deg); }

    /* ไม่ animate ตอนโหลดหน้า (สถานะที่จำไว้ถูกใส่ก่อน paint) */
    .hrd-no-transition .hrd-sidebar,
    .hrd-no-transition .hrd-main { transition: none !important; }
}

/* ================================================================ navbar */

.hrd-navbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: var(--hrd-navbar-height);
    padding: .75rem var(--hrd-gutter);
    background: rgba(244, 247, 252, .82);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    backdrop-filter: saturate(160%) blur(10px);
}

.hrd-navbar.is-scrolled { box-shadow: 0 1px 0 var(--hrd-border), 0 6px 18px rgba(15, 45, 107, .05); }

.hrd-icon-btn {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--hrd-navy);
    font-size: 1.25rem;
    line-height: 1;
    transition: background-color var(--hrd-duration) var(--hrd-ease);
}

.hrd-icon-btn:hover,
.hrd-icon-btn[aria-expanded="true"] { background: var(--hrd-surface); border-color: var(--hrd-border); }

.hrd-icon-btn:focus-visible { outline: 3px solid rgba(var(--hrd-primary-rgb), .55); outline-offset: 1px; }

.hrd-icon-btn__badge {
    position: absolute;
    top: 3px;
    right: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 .3rem;
    border: 2px solid var(--hrd-bg);
    border-radius: var(--hrd-radius-pill);
    background: #DC2626;
    color: #FFFFFF;
    font-size: .625rem;
    font-weight: 700;
    line-height: 1;
}

.hrd-search {
    position: relative;
    flex: 1 1 auto;
    max-width: 540px;
    margin: 0;
}

.hrd-search__icon {
    position: absolute;
    top: 50%;
    left: 1rem;
    color: var(--hrd-muted);
    font-size: 1.05rem;
    transform: translateY(-50%);
    pointer-events: none;
}

.hrd-search__input {
    height: 46px;
    padding-left: 2.75rem;
    border-color: var(--hrd-border);
    border-radius: 12px;
    background: var(--hrd-surface);
    box-shadow: 0 2px 8px rgba(15, 45, 107, .04);
    font-size: var(--hrd-fs-base);
}

/* --- global search type-ahead (P1-T14) — รหัส (monospace) เป็นคอลัมน์ซ้ายให้สแกนเหมือนสมุดรายชื่อ */
.hrd-search__input::-webkit-search-cancel-button { cursor: pointer; }

.hrd-search.is-loading .hrd-search__icon { color: var(--hrd-primary); }

.hrd-search__panel {
    position: absolute;
    top: calc(100% + .4rem);
    left: 0;
    right: 0;
    z-index: 1060;
    max-height: min(70vh, 480px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: .35rem;
    border: 1px solid var(--hrd-border);
    border-radius: 14px;
    background: var(--hrd-surface);
    box-shadow: var(--hrd-shadow-raised);
    animation: hrd-search-in .14s var(--hrd-ease);
}

.hrd-search__panel[hidden] { display: none; }

@keyframes hrd-search-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.hrd-search.is-loading .hrd-search__list { opacity: .6; transition: opacity var(--hrd-duration) var(--hrd-ease); }

.hrd-search__status:empty { display: none; }

.hrd-search__status {
    padding: 1rem .9rem;
    color: var(--hrd-muted);
    font-size: var(--hrd-fs-sm);
    text-align: center;
}

.hrd-search__status-text { display: flex; align-items: center; justify-content: center; font-weight: 500; }
.hrd-search__status.is-empty .hrd-search__status-text { color: var(--hrd-text); }
.hrd-search__status.is-error .hrd-search__status-text { color: var(--hrd-danger-ink); }
.hrd-search__status-hint { margin-top: .2rem; font-size: var(--hrd-fs-xs); }

.hrd-search__group + .hrd-search__group {
    margin-top: .25rem;
    padding-top: .25rem;
    border-top: 1px solid var(--hrd-border);
}

.hrd-search__group-label {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .45rem .6rem .3rem;
    color: var(--hrd-muted);
    font-size: var(--hrd-fs-xs);
    font-weight: 600;
    letter-spacing: .02em;
}

.hrd-search__group-label .bi { color: var(--hrd-primary); }

.hrd-search__group-count {
    margin-left: auto;
    padding: 0 .45rem;
    border-radius: var(--hrd-radius-pill);
    background: var(--hrd-tile-gray);
    font-size: var(--hrd-fs-2xs);
    line-height: 1.6;
}

.hrd-search__option {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .5rem .6rem;
    border-radius: var(--hrd-radius-control);
    color: var(--hrd-text);
    text-decoration: none;
}

.hrd-search__option:hover,
.hrd-search__option.is-active {
    background: var(--hrd-primary-soft);
    color: var(--hrd-text);
}

.hrd-search__option.is-active { box-shadow: inset 3px 0 0 var(--hrd-primary); }

.hrd-search__code {
    flex: 0 0 6.5rem;
    overflow: hidden;
    padding: .1rem .45rem;
    border: 1px solid var(--hrd-border-strong);
    border-radius: 6px;
    background: var(--hrd-surface-muted);
    color: var(--hrd-navy);
    font-family: SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: var(--hrd-fs-xs);
    line-height: 1.6;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hrd-search__code.is-empty { border-style: dashed; color: var(--hrd-subtle); }
.hrd-search__option.is-active .hrd-search__code { border-color: #BCD4FA; background: var(--hrd-surface); }

.hrd-search__text { display: flex; flex-direction: column; min-width: 0; }

.hrd-search__title {
    overflow: hidden;
    color: var(--hrd-navy);
    font-size: var(--hrd-fs-sm);
    font-weight: 600;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hrd-search__subtitle {
    overflow: hidden;
    color: var(--hrd-muted);
    font-size: var(--hrd-fs-xs);
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hrd-search__option mark {
    padding: 0;
    border-radius: 2px;
    background: rgba(var(--hrd-primary-rgb), .16);
    color: inherit;
}

@media (prefers-reduced-motion: reduce) {
    .hrd-search__panel { animation: none; }
    .hrd-search.is-loading .hrd-search__list { transition: none; }
}

.hrd-navbar__actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-left: auto;
}

.hrd-navbar__divider {
    width: 1px;
    height: 32px;
    margin: 0 .4rem;
    background: var(--hrd-border-strong);
}

.hrd-user {
    display: flex;
    align-items: center;
    gap: .7rem;
    max-width: 280px;
    padding: .25rem .5rem .25rem .25rem;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: var(--hrd-text);
    text-align: left;
}

.hrd-user:hover,
.hrd-user[aria-expanded="true"] { background: var(--hrd-surface); border-color: var(--hrd-border); }

.hrd-user:focus-visible { outline: 3px solid rgba(var(--hrd-primary-rgb), .55); outline-offset: 1px; }

.hrd-avatar {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(145deg, #2F80ED, #0F2D6B);
    box-shadow: 0 0 0 3px var(--hrd-surface), 0 4px 10px rgba(15, 45, 107, .18);
    color: #FFFFFF;
    font-size: .95rem;
    font-weight: 700;
}

.hrd-avatar--sm { width: 32px; height: 32px; font-size: .75rem; box-shadow: none; }

.hrd-user__text { min-width: 0; line-height: 1.3; }

.hrd-user__name {
    display: block;
    overflow: hidden;
    color: var(--hrd-navy);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hrd-user__role {
    display: block;
    overflow: hidden;
    color: var(--hrd-muted);
    font-size: var(--hrd-fs-sm);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hrd-user__caret { color: var(--hrd-muted); font-size: .8rem; }

.hrd-menu-head {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: -.1rem -.1rem .4rem;
    padding: .6rem .75rem .75rem;
    border-bottom: 1px solid var(--hrd-border);
}

.hrd-menu-head__name { color: var(--hrd-navy); font-weight: 700; line-height: 1.3; }
.hrd-menu-head__meta { color: var(--hrd-muted); font-size: var(--hrd-fs-xs); }

.hrd-dropdown-user { min-width: 260px; }
.hrd-dropdown-user .dropdown-item { display: flex; align-items: center; gap: .6rem; }
.hrd-dropdown-user .dropdown-item i { color: var(--hrd-muted); font-size: 1.05rem; }
.hrd-dropdown-user .dropdown-item.is-danger { color: var(--hrd-danger-ink); }
.hrd-dropdown-user .dropdown-item.is-danger i { color: var(--hrd-danger-ink); }
.hrd-dropdown-user .dropdown-item:active i { color: inherit; }
.hrd-dropdown-user .dropdown-item.disabled { color: #64748B; }

.hrd-soon {
    margin-left: auto;
    padding: .05rem .45rem;
    border-radius: var(--hrd-radius-pill);
    background: var(--hrd-tile-gray);
    color: var(--hrd-neutral-ink);
    font-size: var(--hrd-fs-2xs);
    font-weight: 600;
}

.hrd-dropdown-panel { width: min(360px, calc(100vw - 1.5rem)); }

.hrd-dropdown-panel__title {
    margin: 0;
    padding: .5rem .75rem .6rem;
    border-bottom: 1px solid var(--hrd-border);
    color: var(--hrd-navy);
    font-size: var(--hrd-fs-base);
    font-weight: 700;
}

/* app launcher (ทางลัดโมดูล) */
.hrd-launcher {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .35rem;
    padding: .5rem .25rem .25rem;
}

.hrd-launcher__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    padding: .75rem .35rem;
    border-radius: 12px;
    color: var(--hrd-text);
    font-size: var(--hrd-fs-xs);
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
}

.hrd-launcher__item:hover { background: var(--hrd-surface-muted); color: var(--hrd-navy); }
.hrd-launcher__item.is-active { background: var(--hrd-primary-soft); color: var(--hrd-info-ink); }
.hrd-launcher__item:focus-visible { outline: 3px solid rgba(var(--hrd-primary-rgb), .55); outline-offset: -1px; }

.hrd-launcher__item .hrd-tile { --hrd-tile-size: 40px; border-radius: 12px; font-size: 1.15rem; }

/* ================================================================ content + footer */

.hrd-content {
    flex: 1 0 auto;
    padding: .5rem var(--hrd-gutter) var(--hrd-gutter);
}

.hrd-content:focus { outline: 0; }

.hrd-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1.5rem;
    padding: 1rem var(--hrd-gutter) 1.25rem;
    border-top: 1px solid var(--hrd-border);
    color: var(--hrd-muted);
    font-size: var(--hrd-fs-xs);
}

.hrd-footer__brand { color: var(--hrd-navy); font-size: var(--hrd-fs-sm); font-weight: 700; }
.hrd-footer__company { color: var(--hrd-navy); font-size: var(--hrd-fs-sm); font-weight: 600; }
.hrd-footer__version a { color: var(--hrd-muted); text-decoration: none; font-variant-numeric: tabular-nums; }
.hrd-footer__version a:hover { color: var(--hrd-primary); text-decoration: underline; }
.hrd-footer__version a:focus-visible { outline: none; box-shadow: var(--hrd-focus-ring); border-radius: 4px; }

/* ================================================================ page header (§11.2) */

.hrd-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    margin-bottom: 1.25rem;
}

.hrd-page-header__main {
    display: flex;
    flex: 1 1 320px;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.hrd-page-header__title {
    margin: 0;
    color: var(--hrd-navy);
    font-size: var(--hrd-fs-display);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.15;
}

.hrd-page-header__title-th {
    margin: .2rem 0 0;
    color: var(--hrd-text);
    font-size: var(--hrd-fs-md);
    font-weight: 500;
    line-height: 1.4;
}

.hrd-page-header__subtitle {
    margin: .1rem 0 0;
    color: var(--hrd-muted);
    font-size: var(--hrd-fs-sm);
}

.hrd-page-header__tagline {
    display: none;
    flex: 0 1 auto;
    text-align: center;
}

.hrd-page-header__tagline-lead {
    display: block;
    color: var(--hrd-info-ink);
    font-size: var(--hrd-fs-lg);
    font-weight: 600;
    letter-spacing: .01em;
}

.hrd-page-header__tagline-sub {
    display: block;
    margin-top: .15rem;
    color: var(--hrd-muted);
    font-size: var(--hrd-fs-xs);
}

.hrd-page-header__tagline-sub span + span::before {
    content: "|";
    margin: 0 .5rem;
    color: var(--hrd-border-strong);
}

.hrd-page-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin-left: auto;
}

.hrd-page-header__actions .btn { min-height: 46px; padding-right: 1.25rem; padding-left: 1.25rem; border-radius: 12px; }
.hrd-page-header__actions .btn-primary { background-image: var(--hrd-primary-gradient); }

.hrd-date-btn {
    display: inline-flex;
    white-space: nowrap;
    align-items: center;
    gap: .6rem;
    color: var(--hrd-navy) !important;
    font-weight: 500 !important;
}

.hrd-date-btn .bi-calendar3 { color: var(--hrd-primary); font-size: 1.1rem; }

@media (min-width: 1200px) {
    .hrd-page-header { flex-wrap: nowrap; }
}

/* tagline กลาง header เฉพาะจอกว้าง (ไม่เบียดชื่อหน้า/ปุ่มบน laptop) */
@media (min-width: 1400px) {
    .hrd-page-header__tagline { display: block; }
}

/* ================================================================ icon tile (§11.3) */

.hrd-tile {
    display: inline-flex;
    flex: 0 0 var(--hrd-tile-size);
    align-items: center;
    justify-content: center;
    width: var(--hrd-tile-size);
    height: var(--hrd-tile-size);
    border-radius: var(--hrd-radius-tile);
    background: var(--hrd-tile-blue);
    color: var(--hrd-info-ink);
    font-size: 1.6rem;
    line-height: 1;
}

.hrd-tile--lg { --hrd-tile-size: 64px; border-radius: 18px; font-size: 1.9rem; }
.hrd-tile--sm { --hrd-tile-size: 36px; border-radius: 10px; font-size: 1.05rem; }

.hrd-tone-blue { --hrd-tone-bg: var(--hrd-tile-blue); --hrd-tone-ink: var(--hrd-info-ink); --hrd-tone-dot: var(--hrd-info); }
.hrd-tone-green { --hrd-tone-bg: var(--hrd-tile-green); --hrd-tone-ink: var(--hrd-success-ink); --hrd-tone-dot: var(--hrd-success); }
.hrd-tone-red { --hrd-tone-bg: var(--hrd-tile-red); --hrd-tone-ink: var(--hrd-danger-ink); --hrd-tone-dot: var(--hrd-danger); }
.hrd-tone-purple { --hrd-tone-bg: var(--hrd-tile-purple); --hrd-tone-ink: var(--hrd-purple-ink); --hrd-tone-dot: var(--hrd-purple); }
.hrd-tone-orange { --hrd-tone-bg: var(--hrd-tile-orange); --hrd-tone-ink: var(--hrd-warning-ink); --hrd-tone-dot: var(--hrd-warning); }
.hrd-tone-teal { --hrd-tone-bg: var(--hrd-tile-teal); --hrd-tone-ink: var(--hrd-teal-ink); --hrd-tone-dot: var(--hrd-teal); }
.hrd-tone-pink { --hrd-tone-bg: var(--hrd-tile-pink); --hrd-tone-ink: var(--hrd-pink-ink); --hrd-tone-dot: var(--hrd-pink); }
.hrd-tone-gray { --hrd-tone-bg: var(--hrd-tile-gray); --hrd-tone-ink: var(--hrd-neutral-ink); --hrd-tone-dot: var(--hrd-neutral); }

.hrd-tile[class*="hrd-tone-"] { background: var(--hrd-tone-bg); color: var(--hrd-tone-ink); }

/* ---- progress bar กลาง (v1.0.134) — แถบบาง มุมมน สีตาม hrd-tone-* (ไม่มี tone = primary)
 *  <span class="hrd-progress hrd-tone-green" role="progressbar" aria-valuenow=".."><span class="hrd-progress__fill" style="width:60%"></span></span>
 *  ขนาด: --sm (4px) / ปกติ (6px) / --lg (10px) */
.hrd-progress {
    --hrd-progress-h: 6px;
    position: relative; display: block; width: 100%; height: var(--hrd-progress-h); overflow: hidden;
    border-radius: 999px; background: var(--hrd-tile-gray);
}
.hrd-progress--sm { --hrd-progress-h: 4px; }
.hrd-progress--lg { --hrd-progress-h: 10px; }
.hrd-progress__fill {
    display: block; height: 100%; max-width: 100%; border-radius: inherit;
    background: var(--hrd-tone-dot, var(--hrd-primary)); transition: width .4s ease;
}
@media (prefers-reduced-motion: reduce) { .hrd-progress__fill { transition: none; } }
/* native <progress> ทุกหน้า (อัปโหลดเอกสาร, IDP, Employee 360, Succession ฯลฯ) ให้หน้าตาเดียวกับ .hrd-progress
 * สีเปลี่ยนได้ด้วย class hrd-tone-* บน element (ใช้ --hrd-tone-dot) */
progress {
    -webkit-appearance: none; appearance: none;
    display: block; height: 6px; overflow: hidden; border: 0; border-radius: 999px;
    background: var(--hrd-tile-gray); color: var(--hrd-tone-dot, var(--hrd-primary)); vertical-align: middle;
}
progress::-webkit-progress-bar { border-radius: 999px; background: var(--hrd-tile-gray); }
progress::-webkit-progress-value { border-radius: 999px; background: var(--hrd-tone-dot, var(--hrd-primary)); transition: width .4s ease; }
progress::-moz-progress-bar { border-radius: 999px; background: var(--hrd-tone-dot, var(--hrd-primary)); }
@media (prefers-reduced-motion: reduce) { progress::-webkit-progress-value { transition: none; } }
/* สีตามระดับ (app-progress.js — v1.0.136): ≥80 เขียว · 60–79 น้ำเงิน · 40–59 ส้ม · <40 แดง */
.hrd-lv-green { --hrd-lv: var(--hrd-success); }
.hrd-lv-blue { --hrd-lv: var(--hrd-info); }
.hrd-lv-orange { --hrd-lv: var(--hrd-warning); }
.hrd-lv-red { --hrd-lv: var(--hrd-danger); }
span.hrd-lv-green, span.hrd-lv-blue, span.hrd-lv-orange, span.hrd-lv-red { background: var(--hrd-lv) !important; }
progress.hrd-lv-green, progress.hrd-lv-blue, progress.hrd-lv-orange, progress.hrd-lv-red { color: var(--hrd-lv); }
progress[class*="hrd-lv-"]::-webkit-progress-value { background: var(--hrd-lv); }
progress[class*="hrd-lv-"]::-moz-progress-bar { background: var(--hrd-lv); }

/* ================================================================ card + widget grid (§11.2) */

.hrd-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--hrd-border);
    border-radius: var(--hrd-radius-card);
    background: var(--hrd-surface);
    box-shadow: var(--hrd-shadow-card);
}

.hrd-card__header {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: 1.1rem 1.25rem .5rem;
}

.hrd-card__icon { color: var(--hrd-primary); font-size: 1.35rem; line-height: 1.3; }

.hrd-card__title {
    margin: 0;
    color: var(--hrd-navy);
    font-size: var(--hrd-fs-md);
    font-weight: 700;
    line-height: 1.4;
}

.hrd-card__subtitle { margin: .1rem 0 0; color: var(--hrd-muted); font-size: var(--hrd-fs-xs); }

.hrd-card__link {
    margin-left: auto;
    color: var(--hrd-info-ink);
    font-size: var(--hrd-fs-sm);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.hrd-card__link:hover { text-decoration: underline; }

.hrd-card__body { flex: 1 1 auto; padding: .5rem 1.25rem 1.25rem; }

.hrd-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* หน้าที่มี KPI 6 ใบ (Dashboard): 1 / 2 / 3 / 6 คอลัมน์ — 6 ใบต่อแถวเฉพาะจอกว้างพอให้ label ไม่ถูกตัด */
@media (min-width: 576px) { .hrd-kpi-grid--6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) { .hrd-kpi-grid--6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1600px) { .hrd-kpi-grid--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* 3 / 2 / 1 คอลัมน์ ที่ ≥1400 / ≥768 (tablet–laptop) / mobile — AC5 */
.hrd-widget-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 768px) {
    .hrd-widget-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hrd-widget-grid > .hrd-span-full { grid-column: 1 / -1; }
}

/* 2 คอลัมน์: การ์ดสุดท้ายที่เหลือเดี่ยวขยายเต็มแถว (ไม่เว้นช่องว่าง) */
@media (min-width: 768px) and (max-width: 1399.98px) {
    .hrd-widget-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (min-width: 1400px) {
    .hrd-widget-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hrd-widget-grid > .hrd-span-2 { grid-column: span 2; }
}

/* ================================================================ KPI card (§11.2) */

.hrd-card.hrd-kpi {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    padding: 1.1rem 1.15rem;
    color: inherit;
    text-decoration: none;
}

a.hrd-kpi { transition: box-shadow var(--hrd-duration) var(--hrd-ease), transform var(--hrd-duration) var(--hrd-ease); }
a.hrd-kpi:hover { box-shadow: var(--hrd-shadow-raised); transform: translateY(-1px); }

.hrd-kpi__body { min-width: 0; }

.hrd-kpi__label {
    margin: 0;
    overflow: hidden;
    color: var(--hrd-text);
    font-size: var(--hrd-fs-sm);
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hrd-kpi__value {
    margin: .1rem 0 .15rem;
    color: var(--hrd-navy);
    font-size: var(--hrd-fs-kpi);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
    line-height: 1.15;
}

.hrd-kpi__unit { margin-left: .3rem; font-size: var(--hrd-fs-lg); font-weight: 600; letter-spacing: 0; }

.hrd-kpi__value.is-empty { color: #64748B; }

.hrd-kpi__trend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .15rem .4rem;
    margin: 0;
    color: var(--hrd-muted);
    font-size: var(--hrd-fs-xs);
}

.hrd-trend { display: inline-flex; align-items: center; gap: .2rem; font-size: var(--hrd-fs-sm); font-weight: 700; font-variant-numeric: tabular-nums; }
.hrd-trend--good { color: var(--hrd-success-ink); }
.hrd-trend--bad { color: var(--hrd-danger-ink); }
.hrd-trend--flat { color: var(--hrd-neutral-ink); }
.hrd-trend .bi { font-size: .7rem; }

/* ================================================================ tabs (§11.2) */

.hrd-tabs {
    display: flex;
    gap: .6rem;
    margin: 0 0 1.25rem;
    padding: 0 0 .25rem;
    overflow-x: auto;
    list-style: none;
    scrollbar-width: thin;
}

.hrd-tabs__item { flex: 0 0 auto; }

.hrd-tabs__link {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-height: 46px;
    padding: .55rem 1.35rem;
    border: 1px solid var(--hrd-border);
    border-radius: 12px;
    background: var(--hrd-surface);
    color: var(--hrd-text);
    font-size: var(--hrd-fs-base);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color var(--hrd-duration) var(--hrd-ease), color var(--hrd-duration) var(--hrd-ease);
}

.hrd-tabs__link .bi { color: var(--hrd-primary); font-size: 1.1rem; }
.hrd-tabs__link:hover { border-color: #BCD4FA; color: var(--hrd-navy); }

.hrd-tabs__link.active,
.hrd-tabs__link[aria-current="page"] {
    border: 2px solid var(--hrd-primary);
    padding: calc(.55rem - 1px) calc(1.35rem - 1px);
    box-shadow: 0 6px 14px rgba(var(--hrd-primary-rgb), .14);
    color: var(--hrd-navy);
    font-weight: 700;
}

.hrd-tabs__link.disabled,
.hrd-tabs__link[aria-disabled="true"] { color: #64748B; pointer-events: none; }
.hrd-tabs__link.disabled .bi { color: #8593A8; }

.hrd-tabs__link:focus-visible { outline: 3px solid rgba(var(--hrd-primary-rgb), .55); outline-offset: 2px; }

/* ================================================================ table + toolbar (§11.2) */

.hrd-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.25rem .75rem;
}

.hrd-toolbar__title {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0 auto 0 0;
    color: var(--hrd-navy);
    font-size: var(--hrd-fs-md);
    font-weight: 700;
}

.hrd-toolbar__title .bi { color: var(--hrd-primary); font-size: 1.25rem; }

.hrd-toolbar__form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.hrd-toolbar__search { position: relative; min-width: 240px; }
.hrd-toolbar__search .bi { position: absolute; top: 50%; left: .8rem; color: var(--hrd-muted); transform: translateY(-50%); pointer-events: none; }
.hrd-toolbar__search .form-control { padding-left: 2.2rem; }
.hrd-toolbar .form-control,
.hrd-toolbar .form-select,
.hrd-toolbar .btn { min-height: 40px; font-size: var(--hrd-fs-sm); }
.hrd-toolbar .form-select { min-width: 150px; }

.hrd-table-wrap { overflow-x: auto; }

.hrd-table { margin: 0; font-size: var(--hrd-fs-sm); }

.hrd-table > thead th {
    padding: .7rem 1rem;
    border-bottom: 0;
    background: var(--hrd-table-head);
    color: var(--hrd-navy);
    font-size: var(--hrd-fs-sm);
    font-weight: 600;
    white-space: nowrap;
}

.hrd-table > tbody td { padding: .7rem 1rem; vertical-align: middle; }

.hrd-table-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1.5rem;
    padding: .85rem 1.25rem 1rem;
    color: var(--hrd-muted);
    font-size: var(--hrd-fs-sm);
}

.hrd-per-page { display: flex; align-items: center; gap: .5rem; margin: 0; }
.hrd-per-page .form-select { width: auto; min-height: 34px; padding-top: .2rem; padding-bottom: .2rem; font-size: var(--hrd-fs-sm); }

/* ================================================================ status pill (§11.3) */

.hrd-status {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .2rem .7rem .2rem .55rem;
    border-radius: var(--hrd-radius-pill);
    background: var(--hrd-tone-bg, var(--hrd-tile-gray));
    color: var(--hrd-tone-ink, var(--hrd-neutral-ink));
    font-size: var(--hrd-fs-xs);
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.hrd-status::before {
    content: "";
    flex: 0 0 auto;
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: var(--hrd-tone-dot, var(--hrd-neutral));
}

/* ================================================================ empty state (§11.6) */

.hrd-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: 2rem 1rem;
    text-align: center;
}

.hrd-empty__tile { margin-bottom: .5rem; }

.hrd-empty__title { margin: 0; color: var(--hrd-navy); font-size: var(--hrd-fs-md); font-weight: 700; }
.hrd-empty__text { max-width: 34ch; margin: 0; color: var(--hrd-muted); font-size: var(--hrd-fs-sm); }
.hrd-empty .btn { margin-top: .75rem; }
.hrd-empty--compact { padding: 1.25rem .75rem; }
.hrd-empty--compact .hrd-tile { --hrd-tile-size: 44px; border-radius: 12px; font-size: 1.25rem; }

/* ================================================================ skeleton (§11.6 Loading) */

.hrd-skeleton { display: flex; flex-direction: column; gap: .7rem; }

.hrd-skeleton__line,
.hrd-skeleton__block {
    display: block;
    border-radius: 8px;
    background: linear-gradient(90deg, #EDF2F9 0%, #F6F9FD 45%, #EDF2F9 90%);
    background-size: 200% 100%;
    animation: hrd-shimmer 1.4s ease-in-out infinite;
}

.hrd-skeleton__line { height: .8rem; }
.hrd-skeleton__line--lg { height: 1.6rem; }
.hrd-skeleton__line--w30 { width: 30%; }
.hrd-skeleton__line--w50 { width: 50%; }
.hrd-skeleton__line--w70 { width: 70%; }
.hrd-skeleton__line--w90 { width: 90%; }
.hrd-skeleton__block { height: 180px; border-radius: 12px; }
.hrd-skeleton__tile { flex: 0 0 var(--hrd-tile-size); width: var(--hrd-tile-size); height: var(--hrd-tile-size); border-radius: var(--hrd-radius-tile); }
.hrd-skeleton__row { display: flex; align-items: center; gap: 1rem; }
.hrd-skeleton__row > .hrd-skeleton { flex: 1 1 auto; }

@keyframes hrd-shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .hrd-skeleton__line,
    .hrd-skeleton__block { animation: none; }
}

/* ================================================================ dashboard placeholder (P0 — แทนที่ใน P0-T26) */

.hrd-card.hrd-welcome {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    border-color: #CFE0FB;
    background: linear-gradient(100deg, #FFFFFF 0%, #FFFFFF 55%, #EEF5FF 100%);
}

.hrd-welcome__title { margin: 0; color: var(--hrd-navy); font-size: var(--hrd-fs-lg); font-weight: 700; }
.hrd-welcome__text { margin: .2rem 0 0; color: var(--hrd-muted); font-size: var(--hrd-fs-sm); }

/* ================================================================ auth layout (layouts/auth.php — หน้าจริง P0-T19) */

.hrd-auth {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
    background: var(--hrd-bg);
}

.hrd-auth__aside {
    position: relative;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem;
    overflow: hidden;
    background-image: var(--hrd-sidebar);
    color: var(--hrd-sidebar-text);
}

.hrd-auth__aside::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 45%;
    background: url("../images/sidebar-wave.svg") no-repeat bottom center / 100% 100%;
    pointer-events: none;
}

.hrd-auth__brand { position: relative; z-index: 1; display: flex; align-items: center; gap: .85rem; }
.hrd-auth__brand .hrd-brand__mark { flex-basis: 48px; width: 48px; height: 48px; border-radius: 14px; font-size: 1.1rem; }
.hrd-auth__brand .hrd-brand__logo { max-width: 48px; max-height: 48px; border-radius: 12px; }
.hrd-auth__headline { position: relative; z-index: 1; max-width: 26rem; }
.hrd-auth__headline h2 { margin: 0 0 .6rem; color: #FFFFFF; font-size: 2rem; line-height: 1.25; }
.hrd-auth__headline p { margin: 0; color: var(--hrd-sidebar-text); }
.hrd-auth__foot { position: relative; z-index: 1; color: #E4EBF8; font-size: var(--hrd-fs-xs); }

.hrd-auth__main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.hrd-auth__card {
    width: 100%;
    max-width: 440px;
    padding: 2rem 1.75rem;
}

.hrd-auth__mobile-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.hrd-auth__mobile-brand .hrd-brand__name { color: var(--hrd-navy); }
.hrd-auth__mobile-brand .hrd-brand__by { color: var(--hrd-muted); }

@media (min-width: 992px) {
    .hrd-auth { grid-template-columns: minmax(380px, 5fr) 7fr; }
    .hrd-auth__aside { display: flex; }
    .hrd-auth__mobile-brand { display: none; }
}

/* ================================================================ auth forms (P0-T19: login / forgot / reset / change password)
 * Signature: "growth steps" — strength meter เป็นแท่ง 5 ขั้นที่สูงขึ้นทีละขั้นแบบกราฟการเติบโต (ภาษาเดียวกับ
 * ไอคอน Dashboard/แนวโน้มการพัฒนา) — ส่วนอื่นของฟอร์มเรียบตาม token เดิม */

.hrd-auth__head { margin-bottom: 1.5rem; }
.hrd-auth__title { margin: 0; color: var(--hrd-navy); font-size: 1.625rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.hrd-auth__lead { margin: .35rem 0 0; color: var(--hrd-muted); font-size: var(--hrd-fs-sm); line-height: 1.6; }

.hrd-auth__back,
.hrd-auth__link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--hrd-info-ink);
    font-size: var(--hrd-fs-sm);
    font-weight: 500;
    text-decoration: none;
}

.hrd-auth__back { margin-bottom: 1rem; }
.hrd-auth__back:hover,
.hrd-auth__link:hover { color: var(--hrd-primary-active); text-decoration: underline; }
.hrd-auth__back:focus-visible,
.hrd-auth__link:focus-visible { border-radius: 4px; outline: 3px solid rgba(var(--hrd-primary-rgb), .45); outline-offset: 2px; }

.hrd-field { margin-bottom: 1.1rem; }
.hrd-field .form-label { margin-bottom: .4rem; color: var(--hrd-navy); font-size: var(--hrd-fs-sm); font-weight: 600; }
.hrd-req { margin-left: .2rem; color: var(--hrd-danger-ink); }

.hrd-auth__form .form-control { min-height: 48px; border-color: var(--hrd-border-strong); border-radius: var(--hrd-radius-control); }
.hrd-auth__form .form-control:focus { border-color: var(--hrd-primary); box-shadow: var(--hrd-focus-ring); }

/* feedback อยู่นอก .input-group → แสดงเองเมื่อ field ใน .hrd-field ผิด; ว่าง = ไม่กินพื้นที่ */
.hrd-field:has(.is-invalid) > .invalid-feedback { display: block; }
.hrd-field > .invalid-feedback:empty { display: none !important; }

.hrd-password > .form-control { border-right: 0; }
.hrd-password__toggle {
    min-width: 48px;
    border: 1px solid var(--hrd-border-strong);
    border-left: 0;
    border-radius: 0 var(--hrd-radius-control) var(--hrd-radius-control) 0 !important;
    background: var(--hrd-surface);
    color: var(--hrd-muted);
}

.hrd-password__toggle:hover { color: var(--hrd-navy); background: var(--hrd-surface-muted); }
.hrd-password__toggle:focus-visible { position: relative; z-index: 5; box-shadow: var(--hrd-focus-ring); color: var(--hrd-navy); }
.hrd-password__toggle[aria-pressed="true"] { color: var(--hrd-info-ink); }
.hrd-password > .form-control:focus + .hrd-password__toggle { border-color: var(--hrd-primary); }
.hrd-password > .form-control.is-invalid + .hrd-password__toggle { border-color: var(--bs-form-invalid-border-color, var(--hrd-danger)); }
/* ปุ่มถูกซ่อน (ไม่มี JS) → ช่องกรอกโค้งครบ */
.hrd-password__toggle[hidden] + *,
.hrd-password:has(.hrd-password__toggle[hidden]) > .form-control { border-right: 1px solid var(--hrd-border-strong); border-radius: var(--hrd-radius-control) !important; }

.hrd-capslock {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin: .4rem 0 0;
    color: var(--hrd-warning-ink);
    font-size: var(--hrd-fs-xs);
    font-weight: 500;
}

.hrd-capslock[hidden] { display: none; }

.hrd-auth__row { display: flex; justify-content: flex-end; margin: -.35rem 0 1.25rem; }

.hrd-auth__submit {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 12px;
    background-image: var(--hrd-primary-gradient);
    font-weight: 600;
}

.hrd-auth__submit:focus-visible { box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 6px rgba(var(--hrd-primary-rgb), .55); }

.hrd-auth__help {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    margin: 1.5rem 0 0;
    color: var(--hrd-muted);
    font-size: var(--hrd-fs-xs);
    text-align: center;
}

.hrd-auth__notice {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .9rem 1rem;
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--hrd-tone-bg, var(--hrd-tile-blue));
}

.hrd-auth__notice .hrd-tile { background: var(--hrd-surface); }
.hrd-auth__notice-title { margin: 0 0 .15rem; color: var(--hrd-navy); font-size: var(--hrd-fs-base); font-weight: 700; }
.hrd-auth__notice-text { margin: 0; color: var(--hrd-text); font-size: var(--hrd-fs-sm); line-height: 1.6; }

.hrd-auth__divider { margin: .25rem 0 1.25rem; border-color: var(--hrd-border); opacity: 1; }

.hrd-auth__actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.hrd-auth__actions .btn-light { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 1.5rem; border-radius: 12px; }

/* หน้าเปลี่ยนรหัสใน layout app (ผู้ใช้เปลี่ยนเอง) */
.hrd-card.hrd-narrow-card { max-width: 600px; padding: 1.75rem; }
.hrd-narrow-card .hrd-auth__actions { justify-content: flex-end; margin-top: .5rem; }
.hrd-narrow-card .hrd-auth__submit { width: auto; padding: 0 1.75rem; }

/* เงื่อนไข + strength */
.hrd-pwpolicy {
    padding: 1rem 1.1rem;
    margin: -.35rem 0 1.25rem;
    border: 1px solid var(--hrd-border);
    border-radius: 12px;
    background: var(--hrd-surface-muted);
}

.hrd-strength { --hrd-strength-color: var(--hrd-border-strong); margin-bottom: .9rem; }
.hrd-strength[data-level="1"] { --hrd-strength-color: var(--hrd-danger); }
.hrd-strength[data-level="2"] { --hrd-strength-color: #F97316; }
.hrd-strength[data-level="3"] { --hrd-strength-color: var(--hrd-warning); }
.hrd-strength[data-level="4"] { --hrd-strength-color: var(--hrd-primary); }
.hrd-strength[data-level="5"] { --hrd-strength-color: var(--hrd-success); }

.hrd-strength__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .45rem; }
.hrd-strength__label { color: var(--hrd-muted); font-size: var(--hrd-fs-xs); font-weight: 500; }
.hrd-strength__value { color: var(--hrd-navy); font-size: var(--hrd-fs-sm); font-weight: 700; }

.hrd-strength__steps { display: flex; align-items: flex-end; gap: 5px; height: 20px; }

.hrd-strength__step {
    flex: 1 1 0;
    height: 30%;
    border-radius: 4px;
    background: var(--hrd-border);
    transition: background-color var(--hrd-duration) var(--hrd-ease), transform var(--hrd-duration) var(--hrd-ease);
    transform-origin: bottom;
}

.hrd-strength__step:nth-child(2) { height: 45%; }
.hrd-strength__step:nth-child(3) { height: 62%; }
.hrd-strength__step:nth-child(4) { height: 80%; }
.hrd-strength__step:nth-child(5) { height: 100%; }

.hrd-strength[data-level="1"] .hrd-strength__step:nth-child(-n+1),
.hrd-strength[data-level="2"] .hrd-strength__step:nth-child(-n+2),
.hrd-strength[data-level="3"] .hrd-strength__step:nth-child(-n+3),
.hrd-strength[data-level="4"] .hrd-strength__step:nth-child(-n+4),
.hrd-strength[data-level="5"] .hrd-strength__step { background: var(--hrd-strength-color); }

.hrd-pwpolicy__title { margin: 0 0 .4rem; color: var(--hrd-navy); font-size: var(--hrd-fs-xs); font-weight: 700; }

.hrd-rules { display: grid; grid-template-columns: minmax(0, 1fr); gap: .3rem 1rem; padding: 0; margin: 0; list-style: none; }

.hrd-rule { display: flex; align-items: flex-start; gap: .45rem; color: var(--hrd-muted); font-size: var(--hrd-fs-xs); line-height: 1.5; }
.hrd-rule__icon { flex: 0 0 auto; margin-top: .1rem; color: var(--hrd-subtle); font-size: .8rem; }
.hrd-rule.is-met { color: var(--hrd-text); }
.hrd-rule.is-met .hrd-rule__icon { color: var(--hrd-success-ink); }
.hrd-rule.is-server .hrd-rule__icon::before { content: "\F2E6"; } /* bi-dash-circle — ตรวจที่ server */

.hrd-pwpolicy__hint { margin: .7rem 0 0; color: var(--hrd-muted); font-size: var(--hrd-fs-2xs); line-height: 1.55; }

@media (min-width: 576px) {
    .hrd-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hrd-rule[data-rule="username"] { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
    .hrd-strength__step { transition: none; }
}

/* ================================================================ privacy notice (P0-T19, §13.1 PDPA) */

.hrd-privacy {
    margin-bottom: 1.25rem;
    border: 1px solid #CFE0FB;
    border-radius: var(--hrd-radius-card);
    background: var(--hrd-surface);
    box-shadow: var(--hrd-shadow-card);
}

.hrd-privacy__bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; padding: 1rem 1.25rem; }
.hrd-privacy__intro { flex: 1 1 260px; }
.hrd-privacy__title { margin: 0; color: var(--hrd-navy); font-size: var(--hrd-fs-base); font-weight: 700; }
.hrd-privacy__text { margin: .15rem 0 0; color: var(--hrd-muted); font-size: var(--hrd-fs-sm); }
.hrd-privacy__form { margin: 0; }
.hrd-privacy__form .btn { min-height: 42px; padding: 0 1.25rem; border-radius: 10px; }

.hrd-privacy__details { border-top: 1px solid var(--hrd-border); }

.hrd-privacy__details > summary {
    padding: .7rem 1.25rem;
    color: var(--hrd-info-ink);
    font-size: var(--hrd-fs-sm);
    font-weight: 500;
    cursor: pointer;
}

.hrd-privacy__details > summary:focus-visible { border-radius: 0 0 var(--hrd-radius-card) var(--hrd-radius-card); outline: 3px solid rgba(var(--hrd-primary-rgb), .45); outline-offset: -3px; }
.hrd-privacy__details > .hrd-privacy__body { padding: 0 1.25rem 1.25rem; }

.hrd-privacy__body { color: var(--hrd-text); font-size: var(--hrd-fs-sm); line-height: 1.7; text-align: left; }
.hrd-privacy__lead { margin: 0 0 .75rem; }
.hrd-privacy__list { display: grid; gap: .75rem; padding-left: 1.25rem; margin: 0 0 .75rem; }
.hrd-privacy__list li::marker { color: var(--hrd-primary); font-weight: 700; }
.hrd-privacy__list p { margin: .1rem 0 0; color: var(--hrd-muted); }
.hrd-privacy__heading { margin: 0; color: var(--hrd-navy); font-size: var(--hrd-fs-sm); font-weight: 700; }
.hrd-privacy__contact { margin: 0; padding: .7rem .9rem; border-radius: 10px; background: var(--hrd-tile-blue); color: var(--hrd-navy); }
.hrd-privacy__version { margin: .6rem 0 0; color: var(--hrd-muted); font-size: var(--hrd-fs-xs); }

/* เนื้อหาเดียวกันใน App.alert.notice */
.hrd-privacy__modal { max-height: min(55vh, 520px); padding-right: .35rem; overflow-y: auto; }
.hrd-swal-container .hrd-swal__content { margin-top: .75rem; }

/* ================================================================ dashboard shell + โปรไฟล์ของฉัน (P0-T26) */

.hrd-shortcuts { display: flex; flex: 1 1 100%; flex-wrap: wrap; gap: .5rem; }

.hrd-shortcut {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 40px;
    padding: .4rem .9rem;
    border: 1px solid var(--hrd-border);
    border-radius: var(--hrd-radius-pill);
    background: var(--hrd-surface);
    color: var(--hrd-navy);
    font-size: var(--hrd-fs-sm);
    font-weight: 500;
    text-decoration: none;
    transition: border-color var(--hrd-duration) var(--hrd-ease), background-color var(--hrd-duration) var(--hrd-ease);
}

.hrd-shortcut .bi { color: var(--hrd-primary); }
.hrd-shortcut:hover { border-color: #CFE0FB; background: var(--hrd-primary-soft); color: var(--hrd-navy); }
.hrd-shortcut:focus-visible { outline: 3px solid rgba(var(--hrd-primary-rgb), .5); outline-offset: 2px; }

.hrd-card.hrd-profile {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    border-color: #CFE0FB;
    background: linear-gradient(100deg, #FFFFFF 0%, #FFFFFF 55%, #EEF5FF 100%);
}

.hrd-profile__avatar { width: 72px; height: 72px; font-size: 1.5rem; }
.hrd-profile__main { flex: 1 1 260px; }
.hrd-profile__name { margin: 0; color: var(--hrd-navy); font-size: var(--hrd-fs-xl); font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.hrd-profile__handle { margin: .15rem 0 .6rem; color: var(--hrd-muted); font-size: var(--hrd-fs-sm); overflow-wrap: anywhere; }
.hrd-profile__roles { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; list-style: none; }
.hrd-profile__muted { color: var(--hrd-muted); font-size: var(--hrd-fs-sm); }

.hrd-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .7rem;
    border-radius: var(--hrd-radius-pill);
    background: var(--hrd-primary-soft);
    color: var(--hrd-info-ink);
    font-size: var(--hrd-fs-xs);
    font-weight: 600;
}

.hrd-account-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; margin-bottom: 1.25rem; }

@media (min-width: 992px) {
    .hrd-account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.hrd-dl { padding: .25rem 1.25rem 1rem; margin: 0; }
.hrd-dl > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: .15rem; padding: .7rem 0; border-bottom: 1px solid var(--hrd-border); }
.hrd-dl > div:last-child { border-bottom: 0; }
.hrd-dl dt { color: var(--hrd-muted); font-size: var(--hrd-fs-xs); font-weight: 500; }
.hrd-dl dd { margin: 0; color: var(--hrd-text); font-size: var(--hrd-fs-sm); font-weight: 500; overflow-wrap: anywhere; }
.hrd-dl__hint { display: block; margin-top: .2rem; color: var(--hrd-muted); font-size: var(--hrd-fs-xs); font-weight: 400; }

@media (min-width: 576px) {
    .hrd-dl > div { grid-template-columns: 11rem minmax(0, 1fr); gap: 1rem; align-items: baseline; }
}

.hrd-card__footer-actions { display: flex; justify-content: flex-end; padding: 0 1.25rem 1.25rem; margin-top: auto; }
.hrd-account-privacy .hrd-privacy__details { margin-top: .5rem; }

@media (prefers-reduced-motion: reduce) {
    .hrd-shortcut { transition: none; }
}

/* ================================================================ responsive */

@media (max-width: 991.98px) {
    :root { --hrd-gutter: 1rem; }

    .hrd-sidebar__foot { min-height: 130px; }
    .hrd-navbar { gap: .5rem; }
    .hrd-page-header__title { font-size: 1.5rem; }
}

@media (max-width: 575.98px) {
    .hrd-navbar { min-height: 64px; padding-top: .5rem; padding-bottom: .5rem; }
    .hrd-search__input { height: 42px; }
    /* แผงผลลัพธ์กว้างเต็มจอใต้ navbar: ฟอร์มเป็น static → panel (absolute) อิง .hrd-navbar (sticky) แทน */
    .hrd-search { position: static; display: flex; align-items: center; min-width: 0; }
    .hrd-search__icon { position: relative; top: auto; left: auto; z-index: 1; flex: 0 0 auto; margin: 0 -2.1rem 0 .85rem; transform: none; }
    .hrd-search__input { flex: 1 1 auto; min-width: 0; padding-left: 2.5rem; }
    .hrd-search__panel { top: calc(100% - .15rem); left: .5rem; right: .5rem; max-height: min(65vh, 440px); }
    .hrd-search__code { flex-basis: 5.25rem; }
    .hrd-user__text,
    .hrd-user__caret,
    .hrd-navbar__divider { display: none; }
    .hrd-user { padding: .15rem; }
    .hrd-avatar { width: 38px; height: 38px; }
    .hrd-page-header__main .hrd-tile { --hrd-tile-size: 48px; font-size: 1.35rem; }
    .hrd-page-header__actions { width: 100%; }
    .hrd-page-header__actions > * { flex: 1 1 auto; }
    .hrd-kpi-grid { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
    .hrd-toolbar__search { min-width: 0; flex: 1 1 100%; }
    .hrd-footer { justify-content: center; text-align: center; }
}

@media print {
    .hrd-sidebar,
    .hrd-navbar,
    .hrd-footer { display: none !important; }
    .hrd-main { margin-left: 0 !important; }
    .hrd-main::before { display: none; }
}

/* ------------------------------------------------------------------ กระดิ่งแจ้งเตือน (P1-T36, FR-NOTI-01, IMG_2697 กล่องแจ้งเตือน)
 * ยังไม่อ่าน = แถบซ้ายสี primary + พื้นฟ้าจาง + จุดแดง + ชื่อหนา (+ ข้อความ "ยังไม่อ่าน" สำหรับ screen reader) — ไม่สื่อด้วยสีอย่างเดียว
 * dropdown ใช้ data-bs-display="static": desktop ชิดขวาใต้ปุ่ม, mobile กว้างเต็มจอใต้ navbar (อิง .hrd-navbar ที่ sticky) */
.hrd-bell { --hrd-unread-wash: #F3F8FF; }
.hrd-bell__panel { width: min(380px, calc(100vw - 1.5rem)); padding: 0; overflow: hidden; }

.hrd-bell__head {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem .75rem .6rem .9rem;
    border-bottom: 1px solid var(--hrd-border);
}
.hrd-bell__title { flex: 0 1 auto; padding: 0; border: 0; }
.hrd-bell__unread {
    padding: .1rem .5rem;
    border-radius: var(--hrd-radius-pill);
    background: #FDECEC;
    color: var(--hrd-danger-ink);
    font-size: var(--hrd-fs-2xs);
    font-weight: 700;
    white-space: nowrap;
}
.hrd-bell__readall {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin-left: auto;
    padding: .3rem .55rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--hrd-primary);
    font-size: var(--hrd-fs-xs);
    font-weight: 600;
    white-space: nowrap;
}
.hrd-bell__readall:hover:not(:disabled) { background: var(--hrd-primary-soft); }
.hrd-bell__readall:disabled { color: var(--hrd-muted); cursor: default; opacity: .7; }
.hrd-bell__readall:focus-visible { outline: 3px solid rgba(var(--hrd-primary-rgb), .55); outline-offset: 1px; }

.hrd-bell__body { max-height: min(60vh, 430px); overflow-y: auto; overscroll-behavior: contain; }
.hrd-bell__body > .hrd-skeleton { padding: .9rem; }
.hrd-bell__list { margin: 0; padding: .25rem 0; list-style: none; }

.hrd-bell__item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    width: 100%;
    padding: .7rem .9rem .7rem 1rem;
    border: 0;
    background: transparent;
    color: var(--hrd-text);
    text-align: left;
    text-decoration: none;
    transition: background-color var(--hrd-duration) var(--hrd-ease);
}
a.hrd-bell__item:hover,
button.hrd-bell__item:hover { background: var(--hrd-surface-muted); color: var(--hrd-text); }
.hrd-bell__item:focus-visible { outline: 3px solid rgba(var(--hrd-primary-rgb), .55); outline-offset: -3px; }
.hrd-bell__item.is-unread { background: var(--hrd-unread-wash); }
.hrd-bell__item.is-unread::before {
    content: "";
    position: absolute;
    top: .7rem;
    bottom: .7rem;
    left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--hrd-primary);
}
.hrd-bell__item[aria-busy="true"] { opacity: .6; pointer-events: none; }
.hrd-bell__item .hrd-tile { flex: 0 0 auto; }
.hrd-bell__text { display: flex; flex: 1 1 auto; flex-direction: column; gap: .1rem; min-width: 0; }
.hrd-bell__item-title {
    overflow: hidden;
    color: var(--hrd-navy);
    font-size: var(--hrd-fs-sm);
    font-weight: 500;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hrd-bell__item.is-unread .hrd-bell__item-title { font-weight: 700; }
.hrd-bell__item-msg {
    display: -webkit-box;
    overflow: hidden;
    color: var(--hrd-muted);
    font-size: var(--hrd-fs-xs);
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: anywhere;
}
.hrd-bell__item-meta { color: var(--hrd-muted); font-size: var(--hrd-fs-2xs); font-variant-numeric: tabular-nums; }
.hrd-bell__dot {
    flex: 0 0 auto;
    width: .55rem;
    height: .55rem;
    margin-top: .4rem;
    border-radius: 50%;
    background: #DC2626;
}
.hrd-bell__state { padding: 1.25rem 1rem; color: var(--hrd-muted); font-size: var(--hrd-fs-sm); text-align: center; }
.hrd-bell__state .btn { margin-top: .6rem; }

.hrd-bell__foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .65rem .75rem;
    border-top: 1px solid var(--hrd-border);
    color: var(--hrd-primary);
    font-size: var(--hrd-fs-sm);
    font-weight: 600;
    text-decoration: none;
}
.hrd-bell__foot:hover { background: var(--hrd-surface-muted); color: var(--hrd-primary-hover); }
.hrd-bell__foot:focus-visible { outline: 3px solid rgba(var(--hrd-primary-rgb), .55); outline-offset: -3px; }

/* badge เด้งเบาๆ เมื่อมีรายการใหม่เข้ามา (ไม่เล่นเมื่อ prefers-reduced-motion) */
.hrd-icon-btn__badge.is-bump,
.hrd-nav__badge.is-bump { animation: hrd-badge-bump .45s var(--hrd-ease); }
@keyframes hrd-badge-bump {
    0% { transform: scale(1); }
    40% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .hrd-icon-btn__badge.is-bump,
    .hrd-nav__badge.is-bump { animation: none; }
    .hrd-bell__item { transition: none; }
}

@media (max-width: 575.98px) {
    .hrd-bell { position: static; }
    .hrd-bell__panel[data-bs-popper] { left: .5rem; right: .5rem; width: auto; }
    .hrd-bell__body { max-height: min(65vh, 480px); }
    .hrd-bell__item { padding-top: .8rem; padding-bottom: .8rem; }
}
