/* Mô hình dựng từ dữ liệu: Giá trị cốt lõi (ngôi sao) & Sơ đồ tổ chức — dùng cho website và trang xem trước trong admin */

/* ---------- Ngôi sao giá trị cốt lõi ---------- */
.opa-star { max-width: 540px; margin: 1.6em auto; }
.opa-star svg { display: block; width: 100%; height: auto; overflow: visible; font-family: inherit; font-weight: 800; letter-spacing: .02em; }
.opa-star__arm { transform-origin: 0 0; transition: transform .25s ease, filter .25s ease; animation: opa-star-in .7s cubic-bezier(.2, .8, .2, 1) both; animation-delay: var(--d); cursor: default; }
.opa-star__arm:hover { transform: scale(1.045); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .18)); }
.opa-star__labels { pointer-events: none; }
@keyframes opa-star-in { from { transform: scale(.55) rotate(-14deg); opacity: 0; } to { transform: none; opacity: 1; } }
.opa-star__list { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.opa-star__list.show { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 18px; margin-top: 18px; text-align: left; }
.opa-star__list span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-weight: 700; }
.opa-star__list b { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.opa-star__list small { flex-basis: 100%; padding-left: 18px; font-weight: 400; color: #5b6b80; font-size: .9em; }

/* ---------- Sơ đồ tổ chức ----------
   Cấu trúc HTML (public/assets/js/structures.js):
     ul.opa-org__tree > li                       ô gốc
       ul.opa-org__kids > li                     các ô cùng cấp, xếp NGANG, nối bằng thanh ngang + đường thả xuống
       ol.opa-org__stack > li                    bộ phận cuối của một phòng, xếp DỌC, nối bằng đoạn dọc
   Mỗi loại danh sách có quy tắc riêng (chọn bằng ">" trực tiếp) nên không ảnh hưởng lẫn nhau.
   Bản máy tính và bản điện thoại nằm trong hai khối @container riêng → không có quy tắc nào phải "đè" quy tắc khác. */
.opa-org { --line: #9cc7ae; --gap: 10px; --sgap: 10px; --lw: 2px; --elbow: 14px; /* biến phải khai báo ngoài @container: container query không áp lên chính container */ margin: 1.6em 0; container-type: inline-size; }
.opa-org__scroll { overflow-x: auto; padding: 4px 2px 12px; -webkit-overflow-scrolling: touch; }
.opa-org ul, .opa-org ol, .opa-org li { list-style: none; margin: 0; padding: 0; }
.opa-org li { position: relative; }
.opa-org li::before, .opa-org li::after { content: none; }
/* Ô */
.opa-org__node { --node: #1b8046; position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 96px; max-width: 150px; min-height: 44px; padding: 8px 10px; border-radius: 9px; background: var(--node); color: #fff; text-align: center; font-weight: 700; font-size: .72rem; line-height: 1.35; box-shadow: 0 8px 18px -10px rgba(11, 59, 41, .55); transition: transform .2s ease, box-shadow .2s ease; }
.opa-org__node:hover { transform: translateY(-2px); box-shadow: 0 14px 24px -12px rgba(11, 59, 41, .6); }
.opa-org__node small { font-weight: 500; font-size: .92em; opacity: .9; text-transform: none; }
.opa-org__node.lv0 { --node: #0b3b29; font-size: .86rem; min-width: 180px; padding: 13px 22px; }
.opa-org__node.lv1 { --node: #146a39; min-width: 140px; }
.opa-org__node.leaf { --node: #e3f3e8; color: #0b3b29; font-weight: 600; box-shadow: none; border: 1px solid #b9dcc5; }
.opa-org.is-upper .opa-org__node > span { text-transform: uppercase; letter-spacing: .01em; }

/* Máy tính: cây từ trên xuống */
@container (min-width: 721px) {
  .opa-org .opa-org__tree { display: flex; justify-content: center; min-width: max-content; margin: 0 auto; }
  .opa-org .opa-org__tree li { display: flex; flex-direction: column; align-items: center; }
  /* Hàng ngang: đường thân từ ô cha xuống thanh ngang */
  .opa-org .opa-org__kids { display: flex; justify-content: center; position: relative; padding-top: var(--gap); }
  .opa-org .opa-org__kids::before { content: ''; position: absolute; top: 0; left: calc(50% - var(--lw) / 2); height: var(--gap); border-left: var(--lw) solid var(--line); }
  .opa-org .opa-org__kids > li { padding: var(--gap) 4px 0; }
  /* Thanh ngang: từ tâm ô đầu tiên tới tâm ô cuối cùng */
  .opa-org .opa-org__kids > li::before { content: ''; position: absolute; top: 0; left: 0; right: 0; border-top: var(--lw) solid var(--line); }
  .opa-org .opa-org__kids > li:first-child::before { left: 50%; }
  .opa-org .opa-org__kids > li:last-child::before { right: 50%; }
  .opa-org .opa-org__kids > li:only-child::before { content: none; }
  /* Đường thả xuống từng ô */
  .opa-org .opa-org__kids > li::after { content: ''; position: absolute; top: 0; left: calc(50% - var(--lw) / 2); height: var(--gap); border-left: var(--lw) solid var(--line); }
  /* Cột dọc: đoạn nối phía trên mỗi bộ phận (đoạn đầu nối với ô phòng ban) */
  .opa-org .opa-org__stack { display: flex; flex-direction: column; align-items: center; gap: var(--sgap); margin-top: var(--sgap); }
  .opa-org .opa-org__stack > li::before { content: ''; position: absolute; top: calc(-1 * var(--sgap)); left: calc(50% - var(--lw) / 2); height: var(--sgap); border-left: var(--lw) solid var(--line); }
  .opa-org .has-stack > .opa-org__node, .opa-org .opa-org__stack .opa-org__node { width: 114px; max-width: none; font-size: .7rem; }
}

/* Điện thoại / khung hẹp: cây dọc thụt lề, không phải cuộn ngang. Dùng container query nên xem trước trong admin cũng đúng. */
@container (max-width: 720px) {
  .opa-org .opa-org__kids, .opa-org .opa-org__stack { padding-left: 16px; }
  .opa-org .opa-org__kids > li, .opa-org .opa-org__stack > li { padding: 8px 0 0 18px; }
  /* Khuỷu nối vào giữa ô */
  .opa-org .opa-org__kids > li::before, .opa-org .opa-org__stack > li::before { content: ''; position: absolute; left: 0; top: 0; width: 14px; height: var(--elbow); border-left: var(--lw) solid var(--line); border-bottom: var(--lw) solid var(--line); border-radius: 0 0 0 8px; }
  /* Đường dọc chạy tiếp xuống các ô cùng cấp phía dưới */
  .opa-org .opa-org__kids > li::after, .opa-org .opa-org__stack > li::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; border-left: var(--lw) solid var(--line); }
  .opa-org .opa-org__kids > li:last-child::after, .opa-org .opa-org__stack > li:last-child::after { content: none; }
  .opa-org__node { width: auto; max-width: none; min-width: 0; min-height: 0; text-align: left; padding: 9px 12px; }
}
@media (prefers-reduced-motion: reduce) { .opa-star__arm { animation-name: opa-star-fade; } .opa-star__arm:hover { transform: none; } }
@keyframes opa-star-fade { from { opacity: 0; } }

/* Giá trị cốt lõi dạng vòng tròn (theo ảnh gốc): múi màu quanh bánh răng trắng. Rê chuột / chạm / Tab vào múi → múi trồi ra, hiện mô tả */
.opa-wheel { max-width: 560px; margin: 1.6em auto; }
.opa-wheel svg { display: block; width: 100%; height: auto; overflow: visible; font-family: inherit; letter-spacing: .01em; -webkit-tap-highlight-color: transparent; }
.opa-wheel__seg { cursor: pointer; outline: none; transition: transform .35s cubic-bezier(.2, .8, .2, 1), filter .35s ease; animation: opa-wheel-in .8s cubic-bezier(.2, .8, .2, 1) both; animation-delay: var(--d); }
.opa-wheel__seg:focus-visible .opa-wheel__shape { stroke: #0b3b29; stroke-width: 5; }
.opa-wheel__seg.is-hl { transform: translate(var(--dx), var(--dy)); filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .22)) brightness(1.04); }
@media (hover: hover) { .opa-wheel__seg:hover { transform: translate(var(--dx), var(--dy)); filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .22)) brightness(1.04); } }
.opa-wheel.has-active .opa-wheel__seg:not(.is-hl) { filter: saturate(.85) opacity(.9); }
.opa-wheel__num { letter-spacing: -.01em; }
.opa-wheel__center { pointer-events: none; }
@keyframes opa-wheel-in { from { opacity: 0; transform: scale(.72) rotate(-12deg); } }
@media (prefers-reduced-motion: reduce) { .opa-wheel__seg { animation: none; transition: none; } }
