/* ─── Utility helpers — PLX HCSN ─── */

/* ── Visibility ── */
.hidden { display: none !important; }
.plx-collapsed { display: none !important; }

/* ── Display utils ── */
.flex   { display: flex; }
.grid   { display: grid; }
.center { display: flex; justify-content: center; align-items: center; }

/* ── Text ── */
.text-muted { color: var(--muted); }
.hint       { color: var(--muted); font-size: .875rem; padding: 8px 0; }
.page-sub   { 
  font-size: 0.875rem; 
  color: var(--text-body); 
  margin: 6px 0 16px; 
  display: block; 
  line-height: 1.5;
  opacity: 0.85;
}

/* ── Animation ── */
.page-enter {
  animation: pageFadeIn 0.4s cubic-bezier(0.2, 0, 0, 1) forwards;
}

@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Head Layout ── */
.page-head { margin-bottom: 20px; }
.page-title { font-size: 1.5rem; font-weight: 800; color: var(--text-heading); }

/* ── Box ── */
.shadow     { box-shadow: var(--shadow); }
.rounded    { border-radius: var(--radius); }
.w-full     { width: 100%; }

/* ── Neumorphism Utilities (Phase 5) ── */
.nm-flat {
  background: var(--nm-bg);
  box-shadow: var(--nm-flat);
  transition: box-shadow var(--nm-anim), transform var(--nm-anim);
}

.nm-inset {
  background: var(--nm-bg);
  box-shadow: var(--nm-inset);
  transition: box-shadow var(--nm-anim);
}

.nm-flat--hover:hover {
  box-shadow: var(--shadow); /* Quay lại đổ bóng truyền thống khi hover để tạo chiều sâu */
  transform: translateY(-2px);
}

.nm-inset--hover:active {
  box-shadow: var(--nm-inset);
}

/* ── Gap utils ── */
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* ── Margin utils ── */
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mb-8   { margin-bottom: 8px; }

/* ── Grid column helpers ── */
.col-10 { grid-column: span 10; }
.col-8  { grid-column: span 8; }
.col-6  { grid-column: span 6; }
.col-4  { grid-column: span 4; }

/* ══════════════════════════════════════
   PLX PAGE SHELL — Step 6 (UI-V01)
   Shared page layout dùng bởi NV, PC, Approval
══════════════════════════════════════ */

/* GRID SAFETY NET (Nuclear) — Ép tất cả con trực tiếp của #content phải span 10 cột */
#content > *,
.plx-page {
  grid-column: span 10 !important;
  width: 100% !important;
  display: flex;
  flex-direction: column;
}

/* ── Page Body — Container cho nội dung có padding chuẩn ── */
.plx-page__body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Page Header — Soft Monolithic Header ── */
.plx-page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface);
  border-bottom: 2px solid rgba(0,0,0,0.02);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: relative;
  box-shadow: 0 4px 10px rgba(0,0,0,0.02);
  z-index: 5;
}

.plx-page__header-text {
  flex: 1;
  min-width: 0;
}

.plx-page__title {
  font-size: 1.5rem; /* Giảm nhẹ để fix lỗi "title lỗi" */
  font-weight: 800;
  color: var(--primary);
  margin: 0;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.01em;
}

.plx-page__subtitle {
  font-size: .85rem;
  color: var(--text-body);
  margin: 4px 0 0;
  font-weight: 500;
  opacity: 0.6;
}

/* ── Layout Grid 3:7 — Meticulous Soft Design ── */
.plx-layout-3-7 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 16px; /* Giảm padding ngoại để khít màn hình hơn */
  background: var(--bg);
}

.plx-col-3, .plx-col-7, .plx-col-10 { 
  grid-column: span 1; 
  width: 100%; 
}

@media (min-width: 1100px) {
  .plx-layout-3-7 {
    grid-template-columns: repeat(10, 1fr) !important;
    gap: 32px;
    padding: 32px;
  }

  .plx-col-3  { grid-column: span 3 !important; }
  .plx-col-7  { grid-column: span 7 !important; }
  .plx-col-10 { grid-column: span 10 !important; }
}

/* ── Filter bar ── */
.plx-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.plx-filter-bar__search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 0 10px;
}

.plx-filter-bar__icon {
  font-size: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.plx-filter-bar__search {
  flex: 1;
  border: none;
  background: transparent;
  height: 36px;
  padding: 0 12px;
  font-size: .875rem;
  color: var(--text-main) !important;
  outline: none;
  min-width: 0;
}

.plx-filter-bar__search::placeholder {
  color: var(--muted) !important;
  opacity: 0.7;
}

.plx-filter-bar__select {
  height: 36px;
  padding: 0 32px 0 12px !important; /* Fix lỗi 'mất chữ' do padding 12px lấn át height 36px */
  min-width: 140px;
  font-size: .875rem;
  color: var(--text-main) !important;
  background-position: right 8px center !important; /* Đẩy mũi tên khít hơn */
}

/* ── Name cell in table ── */
.plx-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.plx-name-cell__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── ID cell ── */
.plx-id-cell {
  font-family: monospace;
  font-size: .8125rem;
  color: var(--text-body);
}

/* ══════════════════════════════════════
   NV Group (details/summary)
══════════════════════════════════════ */
.nv-chxd-group {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.nv-chxd-group__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-weight: 600;
  font-size: .875rem;
  color: var(--text-heading);
  list-style: none;
  user-select: none;
}

.nv-chxd-group__summary::-webkit-details-marker {
  display: none;
}

.nv-chxd-group__count {
  margin-left: auto;
  font-size: .75rem;
  font-weight: 400;
  color: var(--text-body);
  padding-left: 8px;
}

/* ══════════════════════════════════════
   Badge / Lock states
══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.badge--pending {
  background: rgba(var(--accent-rgb), .12);
  color: var(--accent-dark);
  border: 1px solid rgba(var(--accent-rgb), .25);
}

/* ══════════════════════════════════════
   Shift action bar
══════════════════════════════════════ */

/* ══════════════════════════════════════
   Empty state (Step 5 — UI-V02)
   Dùng khi data = [] trong approval, NV, PC
══════════════════════════════════════ */
.plx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 56px 24px;
  text-align: center;
  color: var(--text-body);
}

.plx-empty__icon {
  font-size: 3rem;
  opacity: .35;
  color: var(--primary);
  line-height: 1;
}

.plx-empty__title {
  font-size: .9375rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 0;
}

.plx-empty__sub {
  font-size: .8125rem;
  color: var(--muted);
  margin: 0;
  max-width: 300px;
}

/* ══════════════════════════════════════
   Shift inline input
══════════════════════════════════════ */
.shift-inline-input {
  width: 100%;
  min-width: 80px;
  border: none;
  border-bottom: 1px solid var(--border-2);
  border-radius: 0;
  background: transparent;
  padding: 4px 2px;
  font-size: .8125rem;
  color: var(--text-main);
  outline: none;
  transition: border-color var(--anim);
}

.shift-inline-input:focus {
  border-bottom-color: var(--primary);
}
