/* ============================================================================
   VIETPACKING — 12 TẦNG HỆ THỐNG (PHASE 2: DUAL-FLOW ADMIN / VIEWER + ISO CATALOG)
   Nhận diện: Nền xanh ngọc lục bảo Vietpacking + Tháp 12 Tầng + Cổng Quản Trị
   ============================================================================ */

:root {
  --bg-poster: radial-gradient(circle at 50% 42%, #056835 0%, #024a24 55%, #013318 100%);
  --surface-nav: rgba(1, 36, 17, 0.92);
  --surface-modal: #052614;
  --surface-admin-bg: #031d0f;
  --surface-card: rgba(255, 255, 255, 0.045);

  --border-subtle: rgba(255, 255, 255, 0.11);
  --border-accent: rgba(52, 211, 153, 0.42);

  --text-primary: #ffffff;
  --text-secondary: #d1fae5;
  --text-muted: #94b8a6;

  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --amber-400: #fbbf24;
  --red-400: #f87171;
  --red-500: #ef4444;

  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.12);
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background: var(--bg-poster);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.text-emerald { color: var(--emerald-400); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
::-webkit-scrollbar-thumb { background: rgba(52, 211, 153, 0.28); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(52, 211, 153, 0.45); }

/* ============================================================================
   BUTTONS & FORM CONTROLS
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border-color: rgba(52, 211, 153, 0.4);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  border-color: rgba(248, 113, 113, 0.4);
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-danger-outline {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
}
.btn-danger-outline:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.24);
  color: #fff;
}

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-xs { padding: 4px 10px; font-size: 0.74rem; }
.btn-lg { padding: 12px 20px; font-size: 0.94rem; }
.btn-block { width: 100%; }

.btn-icon-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-icon-close:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

.btn-icon-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-icon-danger:hover { background: rgba(239, 68, 68, 0.3); color: #fff; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.form-group:last-child { margin-bottom: 0; }

.form-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.label-with-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.saved-pass-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.35);
  padding: 1px 8px;
  border-radius: 999px;
}

.form-input,
.form-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  font-family: inherit;
  font-size: 0.86rem;
  outline: none;
  transition: var(--transition);
}
.form-input:focus,
.form-select:focus {
  border-color: var(--emerald-400);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}
.form-input:disabled,
.form-select:disabled { opacity: 0.6; cursor: not-allowed; }
.form-select option { background: #062a16; color: #fff; }
.form-input-sm,
.form-select-sm { padding: 6px 10px; font-size: 0.8rem; }
.form-file-input { padding: 7px 10px; }

.form-helper { font-size: 0.75rem; color: var(--text-muted); }

.form-inline-error {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: #fecaca;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 4px;
}

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.col-span-2 { grid-column: span 2; }
.form-checkbox-align { justify-content: flex-end; padding-bottom: 4px; }

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
  color: var(--text-secondary);
  cursor: pointer;
}
.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--emerald-500);
}

.input-with-action { display: flex; gap: 8px; }
.input-with-action .form-input { flex: 1; }

/* ============================================================================
   LOGIN GATE
   ============================================================================ */

.login-gate {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(3, 35, 18, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 20px;
  padding: 32px 30px 24px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55), 0 0 40px rgba(16, 185, 129, 0.14);
}

.login-brand { text-align: center; margin-bottom: 26px; }

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.4);
  flex-shrink: 0;
}
.brand-icon svg { width: 20px; height: 20px; stroke: #ffffff; fill: none; stroke-width: 2.2; }
.brand-icon-admin { background: linear-gradient(135deg, #059669 0%, #065f46 100%); }
.brand-icon-lg { width: 54px; height: 54px; border-radius: 14px; margin-bottom: 14px; }
.brand-icon-lg svg { width: 28px; height: 28px; }

.login-brand h1 { font-size: 1.18rem; font-weight: 900; letter-spacing: 0.02em; color: #fff; margin-bottom: 6px; }
.login-brand p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.45; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form .form-group { margin-bottom: 0; }

.password-input-wrap { position: relative; display: flex; align-items: center; }
.password-input-wrap .form-input { padding-right: 42px; }
.btn-toggle-pass {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
}
.btn-toggle-pass:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

.login-footer-health {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-muted);
  text-align: center;
}

/* ============================================================================
   TOP NAVBAR (VIEWER + ADMIN)
   ============================================================================ */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-nav {
  width: 100%;
  padding: 9px 18px;
  background: var(--surface-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 200;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
  flex-shrink: 0;
}
.brand-name-wrap h1 { font-size: 0.9rem; font-weight: 800; letter-spacing: 0.02em; color: #fff; line-height: 1.2; }
.brand-name-wrap p { font-size: 0.66rem; color: #a7f3d0; letter-spacing: 0.03em; }

/* Global Search Bar (single custom clear button; native cancel hidden) */
.global-search-wrap { position: relative; flex: 1; max-width: 420px; min-width: 180px; }

.global-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 6px 11px;
  transition: var(--transition);
}
.global-search-box:focus-within {
  border-color: var(--emerald-400);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}
.global-search-box .search-icon { color: var(--text-muted); flex-shrink: 0; }
.global-search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.81rem;
  width: 100%;
}
.global-search-box input::placeholder { color: rgba(209, 250, 229, 0.48); }
#globalSearchInput::-webkit-search-cancel-button,
#globalSearchInput::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.btn-clear-search {
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.global-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(580px, 92vw);
  background: #062b17;
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  overflow: hidden;
  display: none;
  z-index: 300;
}
.global-search-dropdown.open { display: block; }
.search-dd-header {
  padding: 9px 14px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-subtle);
}
.search-dd-state { padding: 18px 16px; font-size: 0.82rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.search-dd-state.error { color: #fca5a5; }
.search-dd-list { max-height: 380px; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.search-result-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; transition: var(--transition); }
.search-result-row:hover { background: rgba(255, 255, 255, 0.07); }
.search-result-main { flex: 1; min-width: 0; }
.search-result-name { font-size: 0.83rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-path { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.search-result-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.top-nav-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: #fff;
  font-family: inherit;
  font-size: 0.73rem;
  cursor: pointer;
  transition: var(--transition);
}
.health-pill:hover { background: rgba(16, 185, 129, 0.18); border-color: var(--emerald-400); }
.health-pill .health-label { color: var(--text-muted); }
.health-pill strong { color: var(--emerald-400); font-size: 0.72rem; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #64748b; flex-shrink: 0; }
.status-dot.online { background: #34d399; box-shadow: 0 0 8px #34d399; }
.status-dot.warn { background: #fbbf24; box-shadow: 0 0 8px #fbbf24; }
.status-dot.offline { background: #f87171; box-shadow: 0 0 8px #f87171; }

.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-nav:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.3); }
.btn-nav-admin {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fef08a;
  font-weight: 700;
}
.btn-nav-admin:hover { background: rgba(245, 158, 11, 0.3); color: #fff; }
.btn-nav-viewer {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(52, 211, 153, 0.5);
  color: #a7f3d0;
  font-weight: 700;
}
.btn-nav-viewer:hover { background: rgba(16, 185, 129, 0.36); color: #fff; }

.user-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 5px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 999px;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}
.user-pill-btn:hover { background: rgba(16, 185, 129, 0.32); }

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #047857);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.user-pill-info { display: flex; flex-direction: column; text-align: left; line-height: 1.15; }
.user-pill-info strong { font-size: 0.76rem; font-weight: 700; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-pill-info small { font-size: 0.64rem; color: #a7f3d0; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dropdown-wrap { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 245px;
  background: #062b17;
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 300;
}
.dropdown-menu.open { display: flex; }
.dropdown-user-header { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.dropdown-user-header strong { font-size: 0.84rem; color: #fff; }
.dropdown-user-header span { font-size: 0.72rem; color: var(--text-muted); }
.dropdown-divider { height: 1px; background: var(--border-subtle); margin: 4px 0; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #e2f7ec;
  font-family: inherit;
  font-size: 0.81rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}
.dropdown-item:hover { background: rgba(16, 185, 129, 0.2); color: #fff; }
.dropdown-item-danger { color: #fca5a5; }
.dropdown-item-danger:hover { background: rgba(239, 68, 68, 0.2); color: #fff; }

/* ============================================================================
   VIEWER MAIN STAGE: 12-TIER PYRAMID
   ============================================================================ */

.poster-stage {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 2-Direction Home Stage Switcher (Theo Tháp 12 Tầng <-> Xem Ngược Phòng Ban) */
.viewer-direction-bar {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.viewer-direction-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(1, 24, 12, 0.72);
  border: 1px solid rgba(52, 211, 153, 0.3);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.dir-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(209, 250, 229, 0.78);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}
.dir-switch-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.dir-switch-btn.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: rgba(110, 231, 183, 0.65);
  color: #fff;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}
.dir-switch-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}
.dir-switch-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.dir-switch-text strong {
  font-size: 0.85rem;
  font-weight: 800;
}
.dir-switch-text small {
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.82;
}

/* Reverse Home Stage: Khối -> Phòng Ban -> 12 Tầng */
.org-reverse-stage {
  width: 100%;
  max-width: 1240px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 6px 0 28px;
}

.org-stage-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 24px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(4, 42, 22, 0.9) 0%, rgba(2, 26, 14, 0.94) 100%);
  border: 1px solid rgba(52, 211, 153, 0.3);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.36);
}
.org-stage-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 760px;
}
.org-stage-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #6ee7b7;
}
.org-stage-title-wrap h2 {
  font-size: 1.38rem;
  font-weight: 900;
  color: #fff;
  line-height: 1.25;
}
.org-stage-title-wrap p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.org-stage-title-wrap p strong { color: #d1fae5; }
.org-stage-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.org-blocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  width: 100%;
}
.org-skeleton {
  height: 340px;
}

.org-block-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(165deg, rgba(6, 48, 25, 0.92) 0%, rgba(3, 27, 14, 0.96) 100%);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.org-block-card.has-docs {
  border-color: rgba(52, 211, 153, 0.34);
}
.org-block-card:hover {
  border-color: rgba(52, 211, 153, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.45);
}

.org-block-head {
  width: 100%;
  padding: 20px 20px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: background 0.18s ease;
}
.org-block-head:hover {
  background: rgba(16, 185, 129, 0.1);
}
.org-block-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.org-block-icon {
  width: 46px;
  height: 46px;
  font-size: 1.5rem;
  border-radius: 13px;
}
.org-block-title {
  font-size: 1.12rem;
  font-weight: 900;
  color: #fff;
}
.org-block-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.org-dept-section {
  padding: 14px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.org-dept-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(209, 250, 229, 0.68);
}
.org-dept-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.org-dept-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #e2f7ec;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.org-dept-chip.has-docs {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(52, 211, 153, 0.36);
  color: #fff;
}
.org-dept-chip.is-empty {
  color: rgba(203, 213, 225, 0.65);
}
.org-dept-chip:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: rgba(110, 231, 183, 0.75);
  color: #fff;
  transform: translateY(-1px);
}
.org-dept-chip-count {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: #6ee7b7;
}
.org-dept-chip.is-empty .org-dept-chip-count {
  color: rgba(255, 255, 255, 0.45);
}

.org-block-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-top: 1px solid rgba(52, 211, 153, 0.2);
  background: rgba(16, 185, 129, 0.14);
  color: #d1fae5;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}
.org-block-cta:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}

.svg-poster-wrapper {
  width: 100%;
  max-width: 1080px;
  max-height: calc(100vh - 132px);
  aspect-ratio: 1160 / 850;
  filter: drop-shadow(0 16px 36px rgba(0, 0, 0, 0.48));
}
.svg-poster-wrapper svg { width: 100%; height: 100%; display: block; }

.tier-interactive-group { cursor: pointer; outline: none; transition: filter 0.18s ease, opacity 0.18s ease; }
.tier-interactive-group:hover:not(.tier-locked),
.tier-interactive-group:focus-visible:not(.tier-locked) {
  filter: brightness(1.14) drop-shadow(0 0 10px rgba(255, 255, 255, 0.35));
}
.tier-interactive-group:hover:not(.tier-locked) .pyramid-layer,
.tier-interactive-group:hover:not(.tier-locked) .tier-pill-rect {
  stroke: #ffffff;
  stroke-width: 2;
}
.tier-interactive-group:hover:not(.tier-locked) .tier-left-label { fill: #fef08a; }
.tier-interactive-group.tier-locked { opacity: 0.42; cursor: not-allowed; }

/* ============================================================================
   DEDICATED ADMIN CONTROL CENTER (/admin)
   ============================================================================ */

.admin-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #022613 0%, #031b0e 100%);
}

.admin-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 214px 1fr;
  min-height: calc(100vh - 58px);
}

.admin-sidebar {
  background: rgba(1, 24, 12, 0.85);
  border-right: 1px solid var(--border-subtle);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-sidebar-section {
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 10px 5px;
}
.admin-sidebar-section:first-child { padding-top: 2px; }

.admin-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}
.admin-nav-btn:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.admin-nav-btn.active {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(52, 211, 153, 0.45);
  color: #fff;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.16);
}
.admin-nav-icon { font-size: 1rem; flex-shrink: 0; }

.admin-main {
  padding: 16px 18px;
  min-width: 0;
  overflow-y: auto;
}

.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1440px;
}
.admin-panel-flex {
  height: calc(100vh - 98px);
}

.admin-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.admin-panel-header.compact { gap: 10px; }
.admin-panel-header h2 { font-size: 1.2rem; font-weight: 800; color: #fff; }
.admin-panel-header p { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat-card {
  background: rgba(5, 38, 20, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-label { font-size: 0.74rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.35rem; font-weight: 900; color: #fff; }
.stat-sub { font-size: 0.73rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.admin-card {
  background: rgba(5, 38, 20, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
}
.admin-card-pad { padding: 18px 20px; }
.admin-card-header {
  padding: 13px 18px;
  background: rgba(0, 0, 0, 0.24);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-card-header h3 { font-size: 0.94rem; font-weight: 800; color: #fff; }
.admin-card-toolbar {
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ov-tier-grid {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 9px;
}

.ov-tier-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 4px solid var(--tier-accent, #10b981);
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}
.ov-tier-card:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.45);
  transform: translateY(-1px);
}
.ov-tier-card.locked { opacity: 0.4; cursor: not-allowed; }
.ov-tier-root { --tier-accent: #34d399; }
.ov-tier-num {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.36);
  color: #a7f3d0;
  flex-shrink: 0;
}
.ov-tier-name { font-size: 0.79rem; font-weight: 700; line-height: 1.25; }

/* Embedded Admin Catalog Body */
.admin-cat-strip {
  border-radius: 10px 10px 0 0;
  border: 1px solid var(--border-subtle);
  border-bottom: none;
}
.admin-catalog-body {
  flex: 1;
  display: grid;
  grid-template-columns: 234px 1fr;
  min-height: 0;
  background: rgba(5, 38, 20, 0.72);
  border: 1px solid var(--border-subtle);
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

/* ============================================================================
   WORKSPACE MODAL (VIEWER 2-COLUMN EXPLORER)
   ============================================================================ */

.workspace-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--surface-modal);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}
.workspace-overlay.active { opacity: 1; visibility: visible; }

.workspace-modal {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: 100vh;
  background: var(--surface-modal);
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: none;
}

.workspace-header {
  padding: 12px 22px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.workspace-title-group { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }

.btn-back-pyramid {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(52, 211, 153, 0.38);
  background: rgba(16, 185, 129, 0.16);
  color: #d1fae5;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-back-pyramid:hover {
  background: rgba(16, 185, 129, 0.32);
  border-color: rgba(52, 211, 153, 0.65);
  color: #fff;
}
.workspace-level-badge {
  font-size: 0.76rem;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: 8px;
  color: #fff;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.workspace-level-badge.badge-reverse {
  background: linear-gradient(135deg, #0ea5e9 0%, #059669 100%);
  border: 1px solid rgba(125, 211, 252, 0.45);
}
.workspace-title-group h2 { font-size: 1.04rem; font-weight: 800; color: #fff; line-height: 1.2; }

.workspace-tier-select {
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 5px 10px;
  color: #d1fae5;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  max-width: 205px;
}
.workspace-tier-select:focus { border-color: var(--emerald-400); }
.workspace-tier-select option { background: #052614; color: #fff; }

.viewer-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.viewer-mode-pills {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 3px;
}
.viewer-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-family: inherit;
  font-size: 0.79rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.viewer-mode-btn:hover { color: #fff; }
.viewer-mode-btn.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-jump-admin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(251, 191, 36, 0.42);
  background: rgba(245, 158, 11, 0.14);
  color: #fef08a;
  font-family: inherit;
  font-size: 0.77rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-jump-admin:hover {
  background: rgba(245, 158, 11, 0.28);
  color: #fff;
}

/* ============================================================================
   FULL-SCREEN 3-STEP VIEWER SETUP WIZARD (STEPPER + CARDS + FULL-WIDTH STEP 3)
   ============================================================================ */

.wizard-stepper-track {
  flex-shrink: 0;
  background: rgba(2, 22, 11, 0.92);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 24px;
}

.wizard-stepper-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.wizard-step-node {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.62);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  min-width: 0;
}
.wizard-step-node:disabled {
  cursor: default;
}
.wizard-step-node:not(:disabled):hover {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.45);
  color: #fff;
}

.wizard-step-node.is-active {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(52, 211, 153, 0.65);
  color: #fff;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.2);
}
.wizard-step-node.is-completed {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(52, 211, 153, 0.32);
  color: #d1fae5;
}
.wizard-step-node.is-skipped {
  opacity: 0.72;
}

.wizard-step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.72);
  flex-shrink: 0;
}
.wizard-step-node.is-active .wizard-step-circle {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #6ee7b7;
  color: #fff;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}
.wizard-step-node.is-completed .wizard-step-circle {
  background: rgba(16, 185, 129, 0.28);
  border-color: rgba(52, 211, 153, 0.65);
  color: #6ee7b7;
}

.wizard-step-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.wizard-step-label {
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}
.wizard-step-sub {
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 175px;
  margin-top: 2px;
}
.wizard-step-node.is-active .wizard-step-sub { color: #a7f3d0; }
.wizard-step-node.is-completed .wizard-step-sub { color: #6ee7b7; }

.wizard-step-connector {
  flex: 1;
  min-width: 24px;
  max-width: 96px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.25s ease;
}
.wizard-step-connector.filled {
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.45);
}

/* Full-Screen Wizard Body Container (ZERO left sidebar) */
.workspace-nas-view.workspace-wizard-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(16, 185, 129, 0.12), transparent 46%),
    radial-gradient(circle at 82% 88%, rgba(5, 150, 105, 0.1), transparent 46%),
    var(--surface-modal);
}

/* Step 1 & Step 2 Centered Cards Stage */
.wizard-step-stage {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.wizard-stage-inner {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.wizard-prompt-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.wizard-prompt-header.compact {
  gap: 6px;
}
.wizard-step-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.42);
  padding: 4px 12px;
  border-radius: 999px;
}
.wizard-prompt-header h3 {
  font-size: 1.55rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.015em;
  line-height: 1.25;
}
.wizard-prompt-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 720px;
  line-height: 1.5;
}
.wizard-prompt-header p strong {
  color: #d1fae5;
}

.wizard-error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.42);
  color: #fecaca;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Shared Live Document Count Pill */
.wizard-count-pill {
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.wizard-count-pill.has-docs {
  background: rgba(16, 185, 129, 0.24);
  border: 1px solid rgba(52, 211, 153, 0.55);
  color: #6ee7b7;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.18);
}
.wizard-count-pill.zero-docs {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(209, 250, 229, 0.52);
}
.wizard-count-pill.is-loading {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(209, 250, 229, 0.7);
  animation: wizardPulse 1.4s ease-in-out infinite;
}

@keyframes wizardPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* Step 1: 3-Column Executive Khối Cards Grid (adapts cleanly to 4 cols when tier-common card is shown) */
.wizard-blocks-grid,
.wizard-loading-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.wizard-blocks-grid.has-four-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.wizard-common-card {
  border-color: rgba(251, 191, 36, 0.45);
  background: linear-gradient(165deg, rgba(245, 158, 11, 0.14) 0%, rgba(5, 42, 22, 0.96) 100%);
}
.wizard-common-icon {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(251, 191, 36, 0.42);
}

.wizard-skeleton-card {
  height: 260px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: wizardPulse 1.4s ease-in-out infinite;
}

.wizard-block-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(165deg, rgba(6, 48, 25, 0.92) 0%, rgba(3, 27, 14, 0.96) 100%);
  color: #fff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}
.wizard-block-card.has-docs {
  border-color: rgba(52, 211, 153, 0.34);
}
.wizard-block-card:hover {
  transform: translateY(-4px);
  border-color: rgba(52, 211, 153, 0.78);
  background: linear-gradient(165deg, rgba(10, 68, 36, 0.96) 0%, rgba(4, 34, 18, 0.98) 100%);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.42), 0 0 24px rgba(16, 185, 129, 0.18);
}

.wizard-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.wizard-card-icon {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.34);
  flex-shrink: 0;
}

.wizard-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.wizard-card-title {
  font-size: 1.18rem;
  font-weight: 900;
  color: #fff;
  line-height: 1.25;
}
.wizard-card-desc {
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.wizard-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  min-width: 0;
}
.wizard-meta-chip {
  font-size: 0.71rem;
  font-weight: 800;
  color: #d1fae5;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px 9px;
  border-radius: 6px;
  flex-shrink: 0;
}
.wizard-meta-preview {
  font-size: 0.72rem;
  color: rgba(209, 250, 229, 0.56);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wizard-card-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 11px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.42);
  color: #d1fae5;
  font-size: 0.86rem;
  font-weight: 800;
  transition: var(--transition);
}
.wizard-block-card:hover .wizard-card-cta,
.wizard-dept-card:hover .wizard-card-cta {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #6ee7b7;
  color: #fff;
}
.wizard-card-cta .cta-arrow {
  transition: transform 0.2s ease;
}
.wizard-block-card:hover .cta-arrow,
.wizard-dept-card:hover .cta-arrow {
  transform: translateX(4px);
}
.wizard-card-cta-sm {
  padding: 8px 14px;
  font-size: 0.8rem;
  border-radius: 9px;
}

/* Step 2: Top Context Bar & Department Cards Grid */
.wizard-step2-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-subtle);
}
.wizard-step2-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.wizard-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #e2f7ec;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.wizard-back-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.wizard-active-block-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.38);
  color: #d1fae5;
  font-size: 0.82rem;
}
.wizard-pill-sep { color: rgba(255, 255, 255, 0.35); }

.wizard-depts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.wizard-dept-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: linear-gradient(165deg, rgba(6, 46, 24, 0.9) 0%, rgba(3, 26, 13, 0.95) 100%);
  color: #fff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}
.wizard-dept-card.has-docs {
  border-color: rgba(52, 211, 153, 0.38);
}
.wizard-dept-card.is-empty {
  opacity: 0.86;
}
.wizard-dept-card:hover {
  opacity: 1;
  transform: translateY(-3px);
  border-color: rgba(52, 211, 153, 0.78);
  background: linear-gradient(165deg, rgba(10, 66, 35, 0.96) 0%, rgba(4, 33, 17, 0.98) 100%);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38), 0 0 20px rgba(16, 185, 129, 0.16);
}

.wizard-dept-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.32);
  color: #34d399;
  flex-shrink: 0;
}
.wizard-dept-card.is-empty .wizard-dept-icon {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(209, 250, 229, 0.5);
}

.wizard-dept-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}
.wizard-dept-title {
  font-size: 1.02rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}
.wizard-dept-role {
  font-size: 0.79rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Step 3: Full-Width Panoramic ISO Table Stage (ZERO left sidebar) */
.wizard-step3-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 24px 18px;
  gap: 10px;
  overflow: hidden;
}

.wizard-context-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 7px 12px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.wizard-ctx-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-right: 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.wizard-ctx-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: 7px;
  border: 1px solid rgba(52, 211, 153, 0.34);
  background: rgba(16, 185, 129, 0.14);
  color: #d1fae5;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.wizard-ctx-btn:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: rgba(52, 211, 153, 0.65);
  color: #fff;
}

.wizard-root-tag {
  font-size: 0.78rem;
  font-weight: 800;
  color: #a7f3d0;
  white-space: nowrap;
}

.wizard-sibling-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  scrollbar-width: thin;
}

.wizard-sibling-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #e2f7ec;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
}
.wizard-sibling-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.wizard-sibling-pill.active {
  background: rgba(16, 185, 129, 0.26);
  border-color: rgba(52, 211, 153, 0.62);
  color: #fff;
}
.wizard-sibling-pill.is-empty:not(.active) {
  color: rgba(203, 213, 225, 0.58);
}
.sibling-pill-count {
  font-size: 0.69rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  color: #6ee7b7;
}
.wizard-sibling-pill.is-empty:not(.active) .sibling-pill-count {
  color: rgba(255, 255, 255, 0.42);
}

/* Reverse Wizard Enhancements: Step Tag, Tier Coverage Chips, 12-Tier Filter Strip, Color-Coded Tier Chips */
.wizard-step-tag-reverse {
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
}

.wizard-dept-coverage {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.tier-cov-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(209, 250, 229, 0.68);
}
.tier-cov-empty {
  font-size: 0.7rem;
  font-style: italic;
  color: rgba(209, 250, 229, 0.42);
}
.tier-cov-list {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.tier-cov-chip {
  font-size: 0.67rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid var(--tier-chip-color, #10b981);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Reverse Step 3: Interactive 12-Tier Filter Strip */
.reverse-tier-filter-bar {
  flex-shrink: 0;
  padding: 7px 12px;
  border-radius: 11px;
  background: rgba(2, 24, 12, 0.78);
  border: 1px solid rgba(56, 189, 248, 0.24);
  overflow-x: auto;
}
.reverse-tier-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: max-content;
}
.reverse-tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #e2f7ec;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
}
.reverse-tier-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--tier-pill-color, rgba(52, 211, 153, 0.6));
  color: #fff;
}
.reverse-tier-pill.has-docs {
  border-color: color-mix(in srgb, var(--tier-pill-color, #10b981) 65%, transparent);
  background: rgba(255, 255, 255, 0.075);
  color: #fff;
}
.reverse-tier-pill.is-empty:not(.active):not(.reverse-tier-all) {
  opacity: 0.52;
}
.reverse-tier-pill.is-empty:not(.active):not(.reverse-tier-all):hover {
  opacity: 0.92;
}
.reverse-tier-pill.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.34) 0%, rgba(14, 165, 233, 0.28) 100%);
  border-color: var(--tier-pill-color, #34d399);
  color: #fff;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.28);
}
.reverse-tier-all.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #6ee7b7;
}
.reverse-tier-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tier-pill-color, #10b981);
  flex-shrink: 0;
}
.reverse-tier-count {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: #6ee7b7;
}
.reverse-tier-pill.is-empty:not(.active) .reverse-tier-count {
  color: rgba(255, 255, 255, 0.45);
}

/* Color-Coded Tier Chip inside Reverse 6-Column ISO Table */
.doc-tier-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid var(--tier-chip-color, #10b981);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.doc-tier-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tier-chip-color, #10b981);
  flex-shrink: 0;
}
.doc-tier-chip-sm {
  padding: 1px 6px;
  font-size: 0.65rem;
  gap: 4px;
}
.doc-tier-chip-sm .doc-tier-dot {
  width: 6px;
  height: 6px;
}

/* Bar 2: Single Clean Viewer Filter Bar */
.viewer-explorer { padding: 16px 24px; gap: 14px; }
.viewer-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 10px 14px;
  flex-shrink: 0;
}
.viewer-location-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}
.viewer-location-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
}
.viewer-total-pill {
  font-size: 0.74rem;
  font-weight: 800;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.35);
  padding: 3px 10px;
  border-radius: 999px;
}
.viewer-filter-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.viewer-search-box { min-width: 230px; width: 255px; max-width: 300px; }

.btn-refresh-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #d1fae5;
  cursor: pointer;
  transition: var(--transition);
}
.btn-refresh-icon:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

/* Helpful Viewer Empty Card */
.viewer-empty-card {
  margin: auto;
  max-width: 500px;
  padding: 40px 28px;
  text-align: center;
  background: rgba(0, 0, 0, 0.22);
  border: 1px dashed rgba(52, 211, 153, 0.3);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.viewer-empty-icon { font-size: 2.2rem; }
.viewer-empty-card h4 { font-size: 1rem; font-weight: 800; color: #fff; }
.viewer-empty-card p { font-size: 0.83rem; color: var(--text-muted); line-height: 1.55; }
.viewer-empty-actions { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

.workspace-tier-strip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 18px;
  background: rgba(0, 0, 0, 0.24);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}
.tier-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.78);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.tier-pill-btn.has-docs:not(.active) {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(52, 211, 153, 0.36);
  color: #d1fae5;
}
.tier-pill-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); color: #fff; }
.tier-pill-btn.active {
  background: #10b981;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}
.tier-pill-cnt {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
  color: #6ee7b7;
  line-height: 1.4;
}
.tier-pill-btn.active .tier-pill-cnt {
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
}
.tier-pill-btn.locked { opacity: 0.35; cursor: not-allowed; }

.workspace-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  background: rgba(0, 0, 0, 0.16);
  border-bottom: 1px solid var(--border-subtle);
}
.workspace-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(255, 255, 255, 0.65);
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.workspace-tab-btn:hover { color: #fff; }
.workspace-tab-btn.active { color: var(--emerald-400); border-bottom-color: var(--emerald-400); }

.workspace-nas-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Sidebar Tree */
.workspace-sidebar {
  background: rgba(0, 0, 0, 0.26);
  border-right: 1px solid var(--border-subtle);
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tree-section-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 6px 2px;
}
.tree-divider { height: 1px; background: var(--border-subtle); margin: 6px 0; }
.tree-node {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #e2f7ec;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}
.tree-node:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.tree-node.active { background: rgba(16, 185, 129, 0.22); border-color: rgba(52, 211, 153, 0.55); color: #fff; }
.tree-node-icon { font-size: 1.05rem; flex-shrink: 0; }
.tree-node-text { display: flex; flex-direction: column; min-width: 0; }
.tree-node-title { font-size: 0.8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-node-sub { font-size: 0.67rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tree-group { display: flex; flex-direction: column; gap: 3px; margin-bottom: 4px; }
.tree-group.collapsed .tree-group-list { display: none; }
.tree-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.77rem;
  font-weight: 700;
  cursor: pointer;
}
.tree-group-header:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.tree-group-title { display: inline-flex; align-items: center; gap: 6px; }
.tree-group-count { font-family: var(--font-mono); font-size: 0.68rem; padding: 1px 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.35); color: var(--text-muted); }
.tree-group-list { display: flex; flex-direction: column; gap: 3px; padding-left: 6px; }

.tree-dept-node {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: #cbd5e1;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}
.tree-dept-node:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.tree-dept-node.active { background: rgba(16, 185, 129, 0.2); border-color: rgba(52, 211, 153, 0.5); color: #fff; }
.tree-folder-svg { color: var(--emerald-400); flex-shrink: 0; }
.tier-mini-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.tree-dept-text { display: flex; flex-direction: column; min-width: 0; }
.tree-dept-name { font-size: 0.78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-dept-role { font-size: 0.67rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-loading, .tree-empty { padding: 10px 8px; font-size: 0.76rem; color: var(--text-muted); }

/* Right Explorer Panel */
.workspace-explorer {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 12px 16px;
  gap: 10px;
}

.explorer-drop-overlay {
  position: absolute;
  inset: 10px;
  z-index: 20;
  background: rgba(5, 65, 34, 0.92);
  border: 2px dashed var(--emerald-400);
  border-radius: 14px;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.workspace-explorer.drag-over .explorer-drop-overlay { display: flex; }
.drop-overlay-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--emerald-400); font-size: 0.94rem; }

.explorer-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: 9px;
  padding: 6px 10px;
  overflow-x: auto;
  flex-shrink: 0;
}
.btn-crumb-up {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-crumb-up:hover { background: rgba(255, 255, 255, 0.16); }
.crumb-trail { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.crumb-sep { color: rgba(255, 255, 255, 0.3); font-size: 0.78rem; }
.crumb-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.79rem;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 5px;
  cursor: pointer;
}
.crumb-item:hover:not(.current) { background: rgba(255, 255, 255, 0.1); color: #fff; }
.crumb-item.current { color: var(--emerald-400); font-weight: 700; cursor: default; }

.explorer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.explorer-filter-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 6px 11px;
  min-width: 190px;
  flex: 1;
  max-width: 280px;
}
.explorer-filter-box svg { color: var(--text-muted); flex-shrink: 0; }
.explorer-filter-box input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 0.8rem;
  width: 100%;
}
.explorer-filter-box input::placeholder { color: rgba(209, 250, 229, 0.45); }

.status-filter-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.28);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}
.status-filter-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.status-filter-btn:hover { color: #fff; }
.status-filter-btn.active {
  background: rgba(16, 185, 129, 0.26);
  color: #fff;
}

.explorer-toolbar-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.perm-badge { font-size: 0.7rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1px solid transparent; }
.perm-full { background: rgba(16, 185, 129, 0.18); border-color: rgba(52, 211, 153, 0.4); color: #34d399; }
.perm-write { background: rgba(59, 130, 246, 0.18); border-color: rgba(96, 165, 250, 0.4); color: #93c5fd; }
.perm-readonly { background: rgba(245, 158, 11, 0.15); border-color: rgba(251, 191, 36, 0.35); color: #fde68a; }
.perm-loading { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }

.item-count-pill { font-size: 0.72rem; font-weight: 700; color: var(--text-secondary); background: rgba(255, 255, 255, 0.07); padding: 4px 9px; border-radius: 999px; }

/* ============================================================================
   6-COLUMN ISO DOCUMENT CATALOG TABLE ("DANH MỤC") + SUBFOLDERS STRIP
   ============================================================================ */

.explorer-file-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.subfolders-strip {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 10px 12px;
  flex-shrink: 0;
}
.subfolders-strip-label {
  font-size: 0.71rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.subfolders-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.subfolder-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  color: #fff;
  font-size: 0.81rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.subfolder-chip:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(52, 211, 153, 0.45);
}
.subfolder-icon { color: #fbbf24; flex-shrink: 0; }
.subfolder-tools { display: inline-flex; gap: 3px; margin-left: 4px; }
.folder-chip-tool {
  background: rgba(0, 0, 0, 0.35);
  border: none;
  border-radius: 4px;
  color: #cbd5e1;
  padding: 3px 4px;
  display: inline-flex;
  cursor: pointer;
}
.folder-chip-tool:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.folder-chip-tool.danger:hover { background: rgba(239, 68, 68, 0.4); color: #fff; }

.catalog-table-card {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(52, 211, 153, 0.24);
  border-radius: 12px;
  overflow: hidden;
}
.catalog-table-card:not(.viewer-catalog-card):not(.admin-inline-catalog-card) {
  flex-shrink: 0;
}
.viewer-catalog-card,
.admin-inline-catalog-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.admin-cat-explorer {
  padding: 10px 12px;
  gap: 8px;
}
.catalog-table-banner {
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.14);
  border-bottom: 1px solid rgba(52, 211, 153, 0.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.catalog-banner-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.catalog-banner-title {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  color: #d1fae5;
}
.catalog-banner-count {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--emerald-400);
}
.catalog-missing-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.catalog-bulk-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.bulk-dirty-badge {
  font-size: 0.74rem;
  font-weight: 800;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.48);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.catalog-table-scroll { width: 100%; overflow-x: auto; }
.viewer-catalog-card .catalog-table-scroll,
.admin-inline-catalog-card .catalog-table-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
}
.catalog-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.catalog-table th {
  text-align: left;
  padding: 10px 8px;
  background: #041d0f;
  color: #a7f3d0;
  font-size: 0.71rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viewer-catalog-card .catalog-table thead th,
.admin-inline-catalog-card .catalog-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #041d0f;
  box-shadow: inset 0 -1px 0 rgba(52, 211, 153, 0.25);
}
.catalog-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}
.catalog-table-viewer tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.catalog-table tbody tr:hover { background: rgba(16, 185, 129, 0.11); }
.catalog-row.viewer-clickable { cursor: pointer; }
.catalog-table-viewer td { padding: 12px 10px; }
.catalog-table-viewer th { padding: 11px 10px; }
.catalog-table-admin th { font-size: 0.67rem; padding: 9px 6px; letter-spacing: 0.02em; }
.catalog-table-admin td { padding: 7px 5px; }

/* Admin 7-column inline widths (sum of 6 fixed cols = 584px; TÊN = ~350px -> 0px overflow at 1440px!) */
.col-stt { width: 36px; text-align: center !important; padding-left: 3px !important; padding-right: 3px !important; color: var(--text-muted); font-weight: 700; }
.col-code { width: 112px; }
.col-title { width: auto; }
.col-date { width: 128px; color: var(--text-secondary); font-size: 0.77rem; }
.col-status { width: 120px; }
.col-doc { width: 74px; }
.col-manage { width: 114px; }

/* Spacious Viewer 6-column widths */
.catalog-table-viewer .col-stt { width: 48px; }
.catalog-table-viewer .col-code { width: 108px; }
.catalog-table-viewer .col-date { width: 142px; }
.catalog-table-viewer .col-status { width: 130px; }
.catalog-table-viewer .col-doc { width: 112px; }

/* Admin Inline Spreadsheet Controls */
.admin-inline-row.row-dirty {
  background: rgba(245, 158, 11, 0.11) !important;
  box-shadow: inset 3px 0 0 #fbbf24;
}

.inline-cell-input,
.inline-cell-select {
  width: 100%;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  padding: 5px 7px;
  color: #fff;
  font-family: inherit;
  font-size: 0.78rem;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.inline-cell-input:hover,
.inline-cell-select:hover {
  border-color: rgba(52, 211, 153, 0.42);
  background: rgba(0, 0, 0, 0.48);
}
.inline-cell-input:focus,
.inline-cell-select:focus {
  border-color: var(--emerald-400);
  background: rgba(0, 0, 0, 0.62);
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.22);
}
.inline-cell-input::placeholder {
  color: rgba(209, 250, 229, 0.34);
  font-style: italic;
}

.inline-code-input {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: #6ee7b7;
  padding: 5px 6px;
}
.inline-title-input {
  font-weight: 700;
  font-size: 0.81rem;
  padding: 5px 8px;
}
.inline-date-input {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 5px 4px;
  color-scheme: dark;
}

.inline-cell-select {
  font-size: 0.73rem;
  font-weight: 700;
  padding: 5px 5px;
  cursor: pointer;
}
.inline-cell-select option {
  background: #052614;
  color: #fff;
}
.inline-cell-select.eff-select-active {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
}
.inline-cell-select.eff-select-expired {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fca5a5;
}
.inline-cell-select.eff-select-draft {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(251, 191, 36, 0.48);
  color: #fde68a;
}

.catalog-view-link.compact {
  padding: 4px 7px;
  font-size: 0.73rem;
}

.inline-manage-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.inline-save-btn {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.36);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: default;
  transition: var(--transition);
}
.inline-save-btn.is-dirty {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #6ee7b7;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}
.inline-save-btn.is-dirty:hover {
  filter: brightness(1.1);
}

.inline-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #d1fae5;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}
.inline-icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.inline-icon-btn.inline-icon-danger {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(239, 68, 68, 0.12);
}
.inline-icon-btn.inline-icon-danger:hover {
  background: rgba(239, 68, 68, 0.34);
  color: #fff;
}

/* Admin Sidebar Live Counts & Missing Code Badges */
.tree-node-space,
.tree-dept-space {
  justify-content: space-between;
  gap: 6px;
}
.tree-node-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.tree-group-header.active {
  background: rgba(16, 185, 129, 0.2);
  color: #fff;
}
.tree-dept-space.is-empty:not(.active) {
  color: rgba(203, 213, 225, 0.52);
}
.admin-tree-badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.admin-tree-count {
  font-size: 0.67rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.admin-tree-count.has-docs {
  background: rgba(16, 185, 129, 0.24);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
}
.admin-tree-count.zero-docs {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.38);
}
.admin-tree-missing {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
}

.status-filter-warn {
  color: #fde68a;
}
.status-filter-warn.active {
  background: rgba(245, 158, 11, 0.3);
  color: #fff;
}

.doc-code-badge {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
  font-size: 0.73rem;
  font-weight: 700;
}
.doc-code-empty { color: rgba(255, 255, 255, 0.3); }

.doc-title-main {
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.38;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.doc-title-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.71rem;
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
}
.doc-title-sub .file-badge-ext,
.doc-title-sub .mono {
  white-space: nowrap;
  flex-shrink: 0;
}
.doc-location-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.28);
  color: #a7f3d0;
  font-weight: 700;
  font-size: 0.68rem;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.doc-filename-sub {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-badge-ext {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}
.ext-pdf { background: rgba(239, 68, 68, 0.22); color: #fca5a5; }
.ext-xlsx, .ext-xls, .ext-csv { background: rgba(16, 185, 129, 0.22); color: #6ee7b7; }
.ext-docx, .ext-doc { background: rgba(59, 130, 246, 0.24); color: #93c5fd; }

.eff-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.eff-active { background: rgba(16, 185, 129, 0.2); border: 1px solid rgba(52, 211, 153, 0.45); color: #34d399; }
.eff-expired { background: rgba(239, 68, 68, 0.2); border: 1px solid rgba(248, 113, 113, 0.45); color: #fca5a5; }
.eff-draft { background: rgba(245, 158, 11, 0.18); border: 1px solid rgba(251, 191, 36, 0.45); color: #fde68a; }

.catalog-doc-actions { display: inline-flex; align-items: center; gap: 5px; }
.catalog-view-link {
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid rgba(52, 211, 153, 0.55);
  border-radius: 6px;
  padding: 4px 10px;
  color: #6ee7b7;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: var(--transition);
}
.catalog-view-link:hover { background: #10b981; color: #fff; }

.catalog-dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #d1fae5;
  cursor: pointer;
  transition: var(--transition);
}
.catalog-dl-btn:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }

.catalog-manage-actions { display: inline-flex; align-items: center; gap: 4px; }
.catalog-manage-actions .row-action-btn { padding: 4px 8px; font-size: 0.72rem; }
.catalog-no-files-note {
  padding: 20px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 1px dashed var(--border-subtle);
}

/* Shared File Icons & Row Action Buttons */
.file-icon-box { width: 38px; height: 38px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-icon-box.small { width: 32px; height: 32px; border-radius: 7px; }
.file-icon-box.large { width: 62px; height: 62px; border-radius: 16px; }
.type-folder { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.type-pdf    { background: rgba(239, 68, 68, 0.2);   color: #f87171; }
.type-excel  { background: rgba(16, 185, 129, 0.2);  color: #34d399; }
.type-word   { background: rgba(59, 130, 246, 0.2);  color: #60a5fa; }
.type-image  { background: rgba(168, 85, 247, 0.2);  color: #c084fc; }
.type-ppt    { background: rgba(249, 115, 22, 0.2);  color: #fb923c; }
.type-text   { background: rgba(20, 184, 166, 0.2);  color: #2dd4bf; }
.type-generic { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }

.row-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #e2f7ec;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.row-action-btn:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.row-action-preview { background: rgba(16, 185, 129, 0.18); border-color: rgba(52, 211, 153, 0.4); color: #6ee7b7; }
.row-action-preview:hover { background: rgba(16, 185, 129, 0.34); color: #fff; }
.row-action-danger { color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); }
.row-action-danger:hover { background: rgba(239, 68, 68, 0.28); color: #fff; }

/* States & Spinners */
.explorer-state-box {
  margin: auto;
  padding: 36px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 480px;
}
.state-title { font-size: 0.92rem; font-weight: 700; color: #fff; }
.state-sub { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.state-error .state-title { color: #fecaca; }

.spinner-ring {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(52, 211, 153, 0.2);
  border-top-color: var(--emerald-400);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.spinner-inline {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(52, 211, 153, 0.25);
  border-top-color: var(--emerald-400);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   WORKSPACE MODE 2: HƯỚNG DẪN & CHECKLIST SOẠN THẢO
   ============================================================================ */

.workspace-guide-view { flex: 1; overflow-y: auto; padding: 20px 24px; }
.guide-layout { display: flex; flex-direction: column; gap: 18px; }
.guide-hero-card { background: rgba(0, 0, 0, 0.28); border: 1px solid var(--border-subtle); border-left: 5px solid var(--emerald-500); border-radius: 12px; padding: 18px 20px; }
.guide-hero-eyebrow { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 800; color: var(--emerald-400); letter-spacing: 0.06em; margin-bottom: 6px; }
.guide-hero-card h3 { font-size: 1.15rem; font-weight: 800; margin-bottom: 8px; }
.guide-hero-card p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; }
.guide-owner-pill { margin-top: 12px; display: inline-block; padding: 6px 12px; background: rgba(16, 185, 129, 0.14); border: 1px solid rgba(52, 211, 153, 0.3); border-radius: 8px; font-size: 0.79rem; color: #d1fae5; }
.guide-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; }
.guide-section { background: rgba(0, 0, 0, 0.24); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 16px 18px; }
.guide-section-title { font-size: 0.92rem; font-weight: 800; color: #fff; margin-bottom: 12px; }
.guide-section-note { font-size: 0.76rem; color: var(--text-muted); margin-top: -6px; margin-bottom: 12px; }
.guide-docs-list { display: flex; flex-direction: column; gap: 10px; }
.guide-doc-card { display: flex; gap: 12px; padding: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 9px; }
.guide-doc-code { font-size: 0.72rem; font-weight: 700; color: var(--emerald-400); background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(52, 211, 153, 0.3); padding: 3px 8px; border-radius: 6px; height: fit-content; flex-shrink: 0; }
.guide-doc-body h4 { font-size: 0.85rem; font-weight: 700; color: #fff; margin-bottom: 4px; }
.guide-doc-body p { font-size: 0.79rem; color: var(--text-muted); line-height: 1.5; }
.guide-checklist { display: flex; flex-direction: column; gap: 8px; }
.guide-checklist-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 9px; font-size: 0.82rem; color: #e2f7ec; line-height: 1.45; cursor: pointer; }
.guide-checklist-item input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--emerald-500); flex-shrink: 0; }
.guide-checklist-item.checked { background: rgba(16, 185, 129, 0.14); border-color: rgba(52, 211, 153, 0.35); color: #a7f3d0; }

/* ============================================================================
   MODALS, PERMISSION MATRIX, DATA TABLES & NAS CONFIG
   ============================================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(1, 20, 10, 0.84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-overlay-top { z-index: 1100; }
.modal-overlay-highest { z-index: 1200; }

.modal-card {
  width: 100%;
  max-height: 92vh;
  background: var(--surface-modal);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 16px;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-card-sm { max-width: 470px; }
.modal-card-md { max-width: 620px; }
.modal-card-lg { max-width: 820px; }
.modal-card-xl { max-width: 1060px; }
.modal-dialog-preview {
  width: 96vw;
  max-width: 1600px;
  height: 94vh;
  max-height: 94vh;
}

.modal-header {
  padding: 14px 20px;
  background: rgba(0, 0, 0, 0.34);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.modal-title-block { min-width: 0; }
.modal-title-block h3 { font-size: 1rem; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-title-block p { font-size: 0.76rem; color: var(--text-muted); margin-top: 2px; }
.modal-sub-path { color: var(--emerald-400) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; background: rgba(0, 0, 0, 0.28); border-top: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.subbar-pg-info { display: inline-flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--text-secondary); }
.subbar-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.subbar-label { font-size: 0.78rem; font-weight: 700; color: var(--text-secondary); }

/* Preview Modal */
.preview-modal-body { padding: 14px; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.preview-pdf-frame { width: 100%; flex: 1; min-height: 0; height: 100%; border: 1px solid var(--border-subtle); border-radius: 10px; background: #ffffff; }
.preview-image-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.35); border-radius: 10px; padding: 16px; overflow: auto; }
.preview-image { max-width: 100%; max-height: 100%; border-radius: 6px; object-fit: contain; }
.preview-text-pre { width: 100%; flex: 1; min-height: 0; overflow: auto; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 16px; font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.55; color: #e2f7ec; white-space: pre-wrap; word-break: break-word; }
.preview-fallback-card { margin: auto; max-width: 480px; text-align: center; padding: 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.preview-fallback-card h4 { font-size: 1rem; word-break: break-word; }
.preview-fallback-meta { font-size: 0.82rem; color: var(--emerald-400); }
.preview-fallback-desc { font-size: 0.83rem; color: var(--text-muted); line-height: 1.55; }

/* Permission Matrix Modal */
.matrix-modal-body { display: flex; flex-direction: column; gap: 14px; }
.super-admin-notice {
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fef08a;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.81rem;
  line-height: 1.45;
}
.matrix-section {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.matrix-section-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.matrix-section-title { font-size: 0.8rem; font-weight: 800; color: var(--emerald-400); text-transform: uppercase; letter-spacing: 0.04em; }

.matrix-checks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.matrix-check-card {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: var(--transition);
}
.matrix-check-card:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(52, 211, 153, 0.35); }
.matrix-check-card input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--emerald-500); flex-shrink: 0; }
.matrix-check-card strong { display: block; font-size: 0.8rem; color: #fff; }
.matrix-check-card small { font-size: 0.68rem; color: var(--text-muted); }

.matrix-tiers-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
}
.matrix-tiers-grid.is-all { opacity: 0.65; }
.matrix-tier-pill {
  padding: 7px 4px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
}
.matrix-tier-pill.selected {
  background: rgba(16, 185, 129, 0.28);
  border-color: var(--emerald-400);
  color: #fff;
}

.matrix-depts-wrap { display: flex; flex-direction: column; gap: 10px; max-height: 220px; overflow-y: auto; padding-right: 4px; }
.matrix-depts-wrap.dimmed { opacity: 0.5; pointer-events: none; }
.dept-scope-group { background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 8px; padding: 9px 11px; }
.dept-scope-block { display: flex; align-items: center; gap: 8px; font-size: 0.81rem; color: #fff; cursor: pointer; margin-bottom: 7px; }
.dept-scope-block input { accent-color: var(--emerald-500); width: 15px; height: 15px; }
.dept-scope-group-title { font-size: 0.81rem; font-weight: 700; color: #fff; margin-bottom: 7px; }
.dept-scope-children { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 6px; padding-left: 20px; }
.dept-scope-item { display: flex; align-items: center; gap: 7px; font-size: 0.77rem; color: var(--text-secondary); cursor: pointer; }
.dept-scope-item input { accent-color: var(--emerald-500); }

/* Users Table Badges & Permission Chips */
.super-admin-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.67rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.22);
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: #fef08a;
}
.super-avatar { background: linear-gradient(135deg, #f59e0b, #b45309) !important; border-color: #fde68a !important; }
.protected-tag { font-size: 0.72rem; font-weight: 700; color: #fde68a; white-space: nowrap; }

.pchip-list { display: flex; flex-wrap: wrap; gap: 4px; }
.pchip { font-size: 0.68rem; font-weight: 800; padding: 2px 7px; border-radius: 5px; }
.pchip-view   { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.pchip-dl     { background: rgba(59, 130, 246, 0.2);  color: #93c5fd; }
.pchip-create { background: rgba(20, 184, 166, 0.22); color: #5eead4; }
.pchip-edit   { background: rgba(245, 158, 11, 0.22); color: #fde68a; }
.pchip-del    { background: rgba(239, 68, 68, 0.22);  color: #fca5a5; }
.pchip-admin  { background: rgba(168, 85, 247, 0.24); color: #d8b4fe; }
.scope-summary { font-size: 0.76rem; color: var(--text-secondary); line-height: 1.35; }

/* NAS Config & Share Browser */
.nas-test-banner { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 0.82rem; }
.nas-test-banner.info { background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(96, 165, 250, 0.35); color: #bfdbfe; }
.nas-test-banner.success { background: rgba(16, 185, 129, 0.16); border: 1px solid rgba(52, 211, 153, 0.45); color: #d1fae5; }
.nas-test-banner.error { background: rgba(239, 68, 68, 0.16); border: 1px solid rgba(248, 113, 113, 0.45); color: #fecaca; }
.test-banner-title { font-weight: 800; margin-bottom: 6px; }
.test-banner-grid { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.78rem; }
.test-banner-err { margin-top: 6px; font-size: 0.78rem; opacity: 0.92; }

.nas-share-browser { margin-top: 12px; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(52, 211, 153, 0.3); border-radius: 10px; overflow: hidden; }
.share-browser-bar { padding: 8px 12px; background: rgba(0, 0, 0, 0.35); border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.share-current-path { font-size: 0.76rem; color: var(--emerald-400); flex: 1; min-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-browser-actions { display: flex; gap: 6px; }
.share-browser-list { max-height: 220px; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.share-item-btn { display: flex; align-items: center; gap: 9px; padding: 7px 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid transparent; border-radius: 7px; color: #fff; font-family: inherit; font-size: 0.81rem; cursor: pointer; text-align: left; }
.share-item-btn svg { color: #fbbf24; flex-shrink: 0; }
.share-item-btn:hover { background: rgba(16, 185, 129, 0.18); border-color: rgba(52, 211, 153, 0.35); }
.share-item-name { font-weight: 700; }
.share-item-path { margin-left: auto; font-size: 0.71rem; color: var(--text-muted); }
.share-browser-state { padding: 16px; text-align: center; font-size: 0.8rem; color: var(--text-muted); }
.share-browser-state.error { color: #fca5a5; }

/* Tier Structure Editor */
.struct-editor-body { display: flex; flex-direction: column; gap: 14px; }
.struct-cat-card { background: rgba(0, 0, 0, 0.28); border: 1px solid var(--border-subtle); border-radius: 12px; overflow: hidden; }
.struct-cat-header { padding: 10px 14px; background: rgba(255, 255, 255, 0.04); border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.struct-cat-inputs { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 260px; }
.struct-icon-input { width: 52px !important; text-align: center; flex-shrink: 0; }
.struct-cat-name { min-width: 180px; font-weight: 700; }
.struct-cat-actions { display: flex; align-items: center; gap: 6px; }
.struct-depts-list { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.struct-dept-row { display: grid; grid-template-columns: 1.2fr 0.9fr 1.6fr 1.1fr auto; gap: 8px; align-items: end; padding: 8px; background: rgba(255, 255, 255, 0.03); border-radius: 8px; }
.struct-field { display: flex; flex-direction: column; gap: 4px; }
.struct-field label { font-size: 0.68rem; font-weight: 700; color: var(--text-muted); }
.struct-empty-depts { font-size: 0.78rem; color: var(--text-muted); padding: 6px; }

/* Data Tables */
.data-table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.81rem; }
.data-table th { text-align: left; padding: 10px 14px; background: rgba(0, 0, 0, 0.34); color: var(--text-secondary); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: middle; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.04); }
.table-state-cell { text-align: center; padding: 32px 16px !important; color: var(--text-muted); }
.table-state-cell.error { color: #fca5a5; }
.table-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.table-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar-sm { width: 32px; height: 32px; border-radius: 50%; background: rgba(16, 185, 129, 0.25); border: 1px solid rgba(52, 211, 153, 0.45); display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 800; color: #fff; flex-shrink: 0; }
.user-cell-name { font-weight: 700; color: #fff; display: flex; align-items: center; flex-wrap: wrap; }
.user-cell-sub { font-size: 0.72rem; color: var(--text-muted); }

.role-badge { display: inline-block; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.role-admin   { background: rgba(239, 68, 68, 0.2);   color: #fca5a5; }
.role-ceo     { background: rgba(168, 85, 247, 0.22); color: #d8b4fe; }
.role-manager { background: rgba(59, 130, 246, 0.22); color: #93c5fd; }
.role-lead    { background: rgba(245, 158, 11, 0.2);  color: #fde68a; }
.role-staff   { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }
.role-viewer  { background: rgba(148, 163, 184, 0.22); color: #e2e8f0; }

.status-pill { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.status-active { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.status-inactive { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

/* Audit Logs */
.audit-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.audit-filters .form-select-sm,
.audit-filters .form-input-sm { width: auto; min-width: 150px; }
.audit-action-badge { display: inline-block; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 5px; }
.act-danger { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.act-create { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.act-update { background: rgba(245, 158, 11, 0.2); color: #fde68a; }
.act-auth   { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
.act-read   { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.audit-path-cell { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.74rem; color: var(--emerald-400); }
.audit-detail-cell { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.75rem; color: var(--text-muted); }

/* Dialog Modal */
.dialog-message { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.55; }
.dialog-detail-mono { margin-top: 10px; padding: 8px 11px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border-subtle); border-radius: 7px; font-family: var(--font-mono); font-size: 0.77rem; color: var(--emerald-400); word-break: break-all; }

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 11px;
  background: #062b17;
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #fff;
  font-size: 0.83rem;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-icon { display: inline-flex; flex-shrink: 0; }
.toast-success { border-color: rgba(52, 211, 153, 0.6); }
.toast-success .toast-icon { color: #34d399; }
.toast-error { border-color: rgba(248, 113, 113, 0.65); background: #2c0d10; }
.toast-error .toast-icon { color: #f87171; }
.toast-warning { border-color: rgba(251, 191, 36, 0.6); }
.toast-warning .toast-icon { color: #fbbf24; }
.toast-info .toast-icon { color: #60a5fa; }
.toast-message { flex: 1; line-height: 1.4; }
.toast-close { background: transparent; border: none; color: rgba(255, 255, 255, 0.6); font-size: 1.15rem; line-height: 1; cursor: pointer; padding: 0 2px; }
.toast-close:hover { color: #fff; }

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 1180px) {
  .top-nav { flex-wrap: wrap; padding: 10px 14px; }
  .global-search-wrap { order: 3; max-width: 100%; flex-basis: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .wizard-blocks-grid,
  .wizard-blocks-grid.has-four-cards,
  .wizard-loading-grid,
  .wizard-depts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 8px 12px;
  }
  .admin-sidebar-section { display: none; }
  .admin-nav-btn { width: auto; white-space: nowrap; padding: 8px 12px; }
  .admin-panel-flex { height: auto; }
  .admin-catalog-body {
    grid-template-columns: 1fr;
    grid-template-rows: 200px 1fr;
  }
  .workspace-sidebar { border-right: none; border-bottom: 1px solid var(--border-subtle); }
  .wizard-stage-inner { padding: 18px 18px 28px; }
  .wizard-step3-stage { padding: 10px 14px 14px; }
  .wizard-stepper-track { padding: 8px 14px; }
  .wizard-step-sub { max-width: 115px; }
  .guide-grid { grid-template-columns: 1fr; }
  .struct-dept-row { grid-template-columns: 1fr 1fr; }
  .matrix-tiers-grid { grid-template-columns: repeat(6, 1fr); }
  .health-pill { display: none; }
}

@media (max-width: 680px) {
  .viewer-direction-tabs { width: 100%; justify-content: stretch; }
  .dir-switch-btn { flex: 1; padding: 8px 10px; justify-content: center; }
  .dir-switch-text small { display: none; }
  .org-blocks-grid { grid-template-columns: 1fr; }
  .wizard-blocks-grid,
  .wizard-blocks-grid.has-four-cards,
  .wizard-loading-grid,
  .wizard-depts-grid { grid-template-columns: 1fr; }
  .wizard-step-connector { display: none; }
  .wizard-stepper-inner { gap: 6px; overflow-x: auto; justify-content: flex-start; }
  .wizard-context-bar { flex-direction: column; align-items: stretch; }
  .wizard-ctx-actions { border-right: none; border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-right: 0; padding-bottom: 6px; }
}

@media (max-width: 600px) {
  .stats-grid,
  .form-grid-2,
  .form-grid-3 { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: auto; }
  .brand-name-wrap p,
  .user-pill-info { display: none; }
  .workspace-modal { height: 100vh; border-radius: 0; }
}
