/* ============================
   WathbaGRC Admin Panel Styles
   ============================ */

/* ---------- Variables ---------- */
:root {
  --admin-navy: #0A1628;
  --admin-navy-light: #122035;
  --admin-primary: #0077CC;
  --admin-primary-rgb: 0, 119, 204;
  --admin-primary-dark: #005FA3;
  --admin-primary-light: #0088E6;
  --admin-accent: #00A3E0;
  --admin-sidebar-w: 200px;
}

/* ---------- Layout ---------- */
.admin-body {
  margin: 0;
  padding: 0;
  background: #f3f4f6;
  min-height: 100vh;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.admin-sidebar {
  width: var(--admin-sidebar-w);
  background: var(--admin-navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
}
.sidebar-logo {
  width: 32px;
  height: 32px;
  background: var(--admin-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}
.sidebar-brand-name {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
}
.sidebar-brand-tag {
  font-size: 9px;
  color: var(--admin-accent);
  font-weight: 500;
  letter-spacing: 1.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.sidebar-divider {
  margin: 8px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 40px;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  font-family: inherit;
}
.sidebar-item:hover {
  color: #fff;
  background: var(--admin-navy-light);
}
.sidebar-item.active {
  color: #fff;
  background: var(--admin-primary);
}
.sidebar-item[data-page="dashboard"] {
  padding-left: 16px;
}

.sidebar-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  font-family: inherit;
  letter-spacing: 0.5px;
}
.sidebar-section-toggle:hover {
  color: #fff;
  background: var(--admin-navy-light);
}
.sidebar-section-toggle .chevron {
  margin-left: auto;
  transition: transform 0.2s;
}
.sidebar-section-toggle.collapsed .chevron {
  transform: rotate(-90deg);
}

.sidebar-section {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.2s ease-out;
}
.sidebar-section.open {
  max-height: 300px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-back-btn,
.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  text-decoration: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.sidebar-back-btn:hover,
.sidebar-logout-btn:hover {
  color: var(--admin-accent);
  border-color: rgba(255,255,255,0.25);
  background: var(--admin-navy-light);
}

/* ---------- Main Content ---------- */
.admin-main {
  flex: 1;
  margin-left: var(--admin-sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
}
.admin-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-header-brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--admin-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.admin-header-brand-name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
}
.admin-header-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 6px 12px;
  color: #9ca3af;
}
.admin-header-search input {
  border: none;
  background: none;
  outline: none;
  font-size: 12px;
  color: #374151;
  width: 160px;
  font-family: inherit;
}
.admin-header-search input::placeholder {
  color: #9ca3af;
}
.admin-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Notification bell ─────────────────────────────────────── */
.notif-wrap {
  position: relative;
}
.notif-bell-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.notif-bell-btn:hover { background: #f3f4f6; color: #111827; }
.notif-bell-btn.is-running {
  border-color: #a5b4fc;
  color: #4f46e5;
  animation: notif-bell-pulse 2s ease-in-out infinite;
}
@keyframes notif-bell-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.2); }
  50%      { box-shadow: 0 0 0 5px rgba(99,102,241,0); }
}
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 1.5px solid #fff;
  line-height: 1;
}
.notif-badge--running { background: #6366f1; }
@keyframes notif-badge-pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.2)} }
.notif-badge--pulse { animation: notif-badge-pulse 0.6s ease 3; }

/* ── Notification panel ────────────────────────────────────── */
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15,23,42,0.14);
  z-index: 9998;
  overflow: hidden;
}
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 10px;
  border-bottom: 1px solid #f1f5f9;
}
.notif-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}
.notif-clear-btn {
  font-size: 11px;
  color: #64748b;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.12s, color 0.12s;
}
.notif-clear-btn:hover { background: #f1f5f9; color: #0f172a; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-empty-msg {
  padding: 24px 16px;
  text-align: center;
  font-size: 12.5px;
  color: #94a3b8;
}

/* ── Notification items ────────────────────────────────────── */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid #f8fafc;
  transition: background 0.12s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item--clickable { cursor: pointer; }
.notif-item--clickable:hover { background: #f8fafc; }
.notif-item-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.notif-icon--running { background: #eef2ff; color: #4f46e5; }
.notif-icon--success { background: #f0fdf4; color: #16a34a; }
.notif-icon--error   { background: #fef2f2; color: #dc2626; }
.notif-icon--info    { background: #f0f9ff; color: #0284c7; }

/* Spinner inside notification icon */
.notif-spinner {
  display: block;
  width: 12px;
  height: 12px;
  border: 2px solid #c7d2fe;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: notif-spin 0.7s linear infinite;
}
@keyframes notif-spin { to { transform: rotate(360deg); } }

.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-item-msg {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.notif-item-time {
  font-size: 10.5px;
  color: #94a3b8;
  white-space: nowrap;
}
.notif-dismiss-btn {
  font-size: 14px;
  line-height: 1;
  color: #94a3b8;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 3px;
  transition: color 0.12s;
}
.notif-dismiss-btn:hover { color: #ef4444; }
.admin-header-powered {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
}
.admin-header-powered strong {
  color: #374151;
  font-weight: 700;
  letter-spacing: 1px;
}
.admin-header-env {
  font-size: 10px;
  font-weight: 500;
  color: #16a34a;
  background: #f0fdf4;
  padding: 3px 8px;
  border-radius: 9999px;
}
.admin-header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--admin-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

.admin-content {
  flex: 1;
  overflow-y: auto;
}

.admin-page {
  display: none;
}
.admin-page.active {
  display: block;
}

.page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 20px;
}
.page-header.page-header-row {
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.page-header.page-header-row > div:first-child {
  flex: 1;
  min-width: 0;
}
.page-header .page-title {
  width: 100%;
}
.page-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0;
}
.page-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
}

/* ---------- Admin Cards ---------- */
.admin-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}
.admin-card + .admin-card {
  margin-top: 16px;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #f3f4f6;
}
.admin-card-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9ca3af;
}
.admin-card-header-left h2 {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}
.admin-card-header h2 {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.admin-card-title-sm {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  padding: 16px 16px 12px;
}

.admin-card-footer {
  padding: 10px 20px;
  border-top: 1px solid #f3f4f6;
  background: #f9fafb;
  border-radius: 0 0 12px 12px;
  font-size: 11px;
  color: #6b7280;
}

.admin-link-btn {
  font-size: 11px;
  font-weight: 500;
  color: var(--admin-primary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s;
}
.admin-link-btn:hover {
  color: var(--admin-primary-dark);
}

/* ---------- Buttons ---------- */
.btn-admin-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: var(--admin-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-admin-primary:hover {
  background: var(--admin-primary-dark);
}
.btn-admin-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-admin-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-admin-ghost:hover {
  background: #f9fafb;
}

.btn-admin-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--admin-primary);
  background: none;
  border: 1px solid rgba(0,119,204,0.3);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-admin-outline:hover {
  background: rgba(0,119,204,0.05);
}

.btn-admin-sm {
  padding: 4px 10px;
  font-size: 10px;
}

/* ---------- Stats Grid ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px 16px;
  transition: box-shadow 0.15s;
}
.stat-card:hover {
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.stat-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.stat-card-icon svg {
  width: 15px;
  height: 15px;
}
.stat-card-value {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
}
.stat-card-label {
  font-size: 11px;
  color: #6b7280;
  margin-top: 1px;
}

/* Stat colors */
.stat-bg-primary { background: rgba(0,119,204,0.1); color: var(--admin-primary); }
.stat-bg-emerald { background: #ecfdf5; color: #059669; }
.stat-bg-amber { background: #fffbeb; color: #d97706; }
.stat-bg-sky { background: #f0f9ff; color: #0284c7; }
.stat-bg-violet { background: #f5f3ff; color: #7c3aed; }
.stat-bg-rose { background: #fff1f2; color: #e11d48; }

/* ---------- Dashboard Grid ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
.dash-main, .dash-side {
  min-width: 0;
}

/* Dashboard Sessions List */
.dash-sessions-list {
  /* no max-height, show all */
}
.dash-session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.dash-session-row:hover {
  background: #f9fafb;
}
.dash-session-row:last-child {
  border-bottom: none;
}
.dash-session-info {
  flex: 1;
  min-width: 0;
}
.dash-session-name {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-session-date {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}
.dash-session-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: 16px;
  flex-shrink: 0;
}
.dash-session-stat {
  text-align: center;
}
.dash-session-stat-val {
  font-size: 11px;
  font-weight: 600;
  color: #111827;
}
.dash-session-stat-label {
  font-size: 9px;
  color: #9ca3af;
}

/* Quick Actions */
.quick-actions {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.15s;
}
.quick-action-btn:hover {
  border-color: rgba(0,119,204,0.3);
  background: rgba(0,119,204,0.03);
}
.quick-action-btn:hover .qa-icon {
  background: rgba(0,119,204,0.1);
  color: var(--admin-primary);
}
.qa-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #6b7280;
  transition: all 0.15s;
}
.qa-text {
  flex: 1;
  min-width: 0;
}
.qa-label {
  font-size: 11px;
  font-weight: 500;
  color: #111827;
}
.qa-desc {
  font-size: 10px;
  color: #9ca3af;
}

/* Colored stat values in session rows */
.dash-stat-purple { color: #7c3aed; }
.dash-stat-blue { color: #0077cc; }
.dash-stat-amber { color: #d97706; }

.dash-session-arrow {
  color: #d1d5db;
  flex-shrink: 0;
  margin-left: 8px;
  transition: color 0.15s;
}
.dash-session-row:hover .dash-session-arrow {
  color: #0077cc;
}

/* Studio Sessions on Dashboard */
.dash-studio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.15s;
}
.dash-studio-row:last-child { border-bottom: none; }
.dash-studio-row:hover { background: #f9fafb; }
.dash-studio-info { flex: 1; min-width: 0; }
.dash-studio-name {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}
.dash-studio-org {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 1px;
}
.dash-studio-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Frameworks List on Dashboard */
.dash-fw-list {
  padding: 4px 16px 16px;
}
.dash-fw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid #f3f4f6;
}
.dash-fw-row:last-child { border-bottom: none; }
.dash-fw-name {
  font-size: 12px;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.dash-fw-count {
  font-size: 11px;
  font-weight: 500;
  color: #d97706;
  flex-shrink: 0;
}
.dash-fw-more {
  padding-top: 8px;
  font-size: 11px;
  color: #9ca3af;
}

/* ---------- Badges ---------- */
.badge {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.badge-emerald { background: #ecfdf5; color: #059669; }
.badge-amber { background: #fffbeb; color: #d97706; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-sky { background: #f0f9ff; color: #0284c7; }
.badge-red { background: #fef2f2; color: #dc2626; }
.badge-primary { background: rgba(0,119,204,0.1); color: var(--admin-primary); }
.badge-primary-solid { background: var(--admin-primary); color: #fff; }
.badge-round { border-radius: 9999px; }

/* ---------- Search Bar ---------- */
.admin-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  max-width: 360px;
  margin-bottom: 20px;
}
.admin-search-bar svg { color: #9ca3af; flex-shrink: 0; }
.admin-search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: #111827;
  background: transparent;
}
.admin-search-bar input::placeholder { color: #9ca3af; }

/* ---------- Sessions Table ---------- */
.sessions-table-header {
  display: grid;
  grid-template-columns: 1fr 80px 80px 80px 100px 32px;
  gap: 16px;
  padding: 10px 20px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.col-center { text-align: center; }
.col-action { text-align: center; }

.session-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px 80px 100px 32px;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.15s;
  align-items: center;
}
.session-row:hover {
  background: #f9fafb;
}
.session-row-name {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-row-query {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.session-row-stat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
}
.session-row-date {
  font-size: 11px;
  color: #6b7280;
  text-align: center;
}

/* ---------- Studio 3-col ---------- */
.studio-three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}
.studio-col-card {
  border-radius: 12px;
  overflow: hidden;
}
.studio-col-header {
  padding: 16px;
  color: #fff;
}
.studio-col-header.navy {
  background: var(--admin-navy);
}
.studio-col-header.emerald {
  background: #047857;
}
.studio-col-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}
.studio-col-desc {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
}
.studio-col-stat {
  margin-top: 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.studio-stat-num {
  font-size: 24px;
  font-weight: 700;
}
.studio-stat-label {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
}
.studio-col-body {
  padding: 12px;
  max-height: 500px;
  overflow-y: auto;
}
.studio-placeholder-text {
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  padding: 24px 8px;
}
.studio-placeholder-text a,
.inline-link {
  color: var(--admin-primary);
  text-decoration: none;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}
.studio-placeholder-text a:hover,
.inline-link:hover {
  text-decoration: underline;
}

/* Studio Search Bar */
.studio-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 8px;
}
.studio-search-bar svg { color: #9ca3af; flex-shrink: 0; }
.studio-search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 12px;
  color: #111827;
  font-family: inherit;
}
.studio-search-actions { display: flex; gap: 4px; flex-shrink: 0; }
.btn-studio-filter {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-studio-filter:hover { background: var(--admin-primary); color: #fff; border-color: var(--admin-primary); }

/* Studio Framework List */
.studio-fw-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  /* Critical: each framework accordion must keep its natural height; otherwise when
     total content exceeds max-height the flex algorithm shrinks cards and squishes
     headers into unreadable strips. Scrolling happens on this container instead. */
}
.studio-fw-group {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.studio-fw-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: #f9fafb;
  min-height: 36px;
  flex-shrink: 0;
}
.studio-fw-group-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #111827;
  flex: 1;
  min-width: 0;
}
.studio-fw-group-toggle span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-fw-group-toggle .chevron-icon { transition: transform 0.2s; flex-shrink: 0; }
.studio-fw-group.collapsed .studio-fw-group-toggle .chevron-icon { transform: rotate(0deg); }
.studio-fw-group:not(.collapsed) .studio-fw-group-toggle .chevron-icon { transform: rotate(90deg); }
.studio-fw-group.collapsed .studio-fw-group-items { display: none; }
.studio-fw-group-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.studio-fw-group-count { font-size: 10px; color: #9ca3af; white-space: nowrap; }
.btn-studio-group-select {
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-studio-group-select:hover { background: var(--admin-primary); color: #fff; border-color: var(--admin-primary); }

.studio-fw-group-items { border-top: 1px solid #e5e7eb; max-height: 50vh; overflow-y: auto; }
.studio-fw-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid #f3f4f6;
}
.studio-fw-item:last-child { border-bottom: none; }
.studio-fw-item:hover { background: #f0f7ff; }
.studio-fw-item.selected { background: #eff6ff; }
.studio-fw-item-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1.5px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.15s;
}
.studio-fw-item.selected .studio-fw-item-checkbox {
  background: var(--admin-primary);
  border-color: var(--admin-primary);
}
.studio-fw-item:not(.selected) .studio-fw-item-checkbox svg { display: none; }
.studio-fw-item-content { flex: 1; min-width: 0; }
.studio-fw-ref {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--admin-primary);
  background: rgba(0,119,204,0.08);
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 4px;
}
.studio-fw-desc { font-size: 11px; color: #374151; line-height: 1.4; }
.studio-fw-depth { color: #9ca3af; margin-right: 2px; }

.studio-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 16px;
  color: #9ca3af;
  font-size: 12px;
}
.studio-empty-msg {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: #9ca3af;
}
.studio-empty-msg a { color: var(--admin-primary); text-decoration: none; }

/* Studio Collections */
.btn-studio-new-coll {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 8px;
  transition: all 0.15s;
}
.btn-studio-new-coll:hover { border-color: var(--admin-primary); color: var(--admin-primary); background: #f0f7ff; }

.studio-coll-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.studio-coll-group {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.studio-coll-group.selected { border-color: var(--admin-primary); }
.studio-coll-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #f9fafb;
  min-height: 34px;
  flex-shrink: 0;
}
.studio-coll-cb { cursor: pointer; flex-shrink: 0; }
.studio-cb-mark {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1.5px solid #d1d5db;
  background: #fff;
  position: relative;
  transition: all 0.15s;
}
.studio-cb-mark.checked {
  background: var(--admin-primary);
  border-color: var(--admin-primary);
}
.studio-cb-mark.checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 4.5px;
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.studio-cb-mark.indeterminate {
  background: var(--admin-primary);
  border-color: var(--admin-primary);
}
.studio-cb-mark.indeterminate::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 3px;
  width: 8px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
}
.studio-coll-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.studio-coll-toggle .chevron-icon { transition: transform 0.2s; flex-shrink: 0; }
.studio-coll-group.collapsed .studio-coll-toggle .chevron-icon { transform: rotate(0deg); }
.studio-coll-group:not(.collapsed) .studio-coll-toggle .chevron-icon { transform: rotate(90deg); }
.studio-coll-group.collapsed .studio-coll-files { display: none; }
.studio-coll-name { font-size: 12px; font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-coll-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.studio-coll-badge {
  font-size: 10px;
  font-weight: 600;
  background: #e5e7eb;
  color: #374151;
  padding: 1px 6px;
  border-radius: 10px;
}
.btn-studio-coll-upload,
.btn-studio-coll-delete {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-studio-coll-upload:hover { border-color: var(--admin-primary); color: var(--admin-primary); }
.btn-studio-coll-delete:hover { border-color: #dc2626; color: #dc2626; }

.studio-coll-files { border-top: 1px solid #e5e7eb; padding: 4px 8px; }
.studio-file-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px;
  border-radius: 4px;
  font-size: 11px;
  transition: background 0.15s;
}
.studio-file-item:hover { background: #f0f7ff; }
.studio-file-item.file-selected { background: #eff6ff; }
.studio-file-item.file-failed { opacity: 0.5; }
.studio-file-cb { cursor: pointer; flex-shrink: 0; }
.studio-file-icon { color: #9ca3af; flex-shrink: 0; }
.studio-file-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #374151; }
.studio-file-state {
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.studio-file-state.active { color: #059669; }
.studio-file-state.pending { color: #d97706; }
.studio-file-state.failed { color: #dc2626; }

/* Studio Query Section */
.studio-query-section { margin-bottom: 12px; }
.studio-field-label { font-size: 12px; font-weight: 600; color: #111827; display: block; margin-bottom: 6px; }
.studio-query-section textarea {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  font-family: inherit;
  color: #111827;
  resize: vertical;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.studio-query-section textarea:focus { outline: none; border-color: var(--admin-primary); box-shadow: 0 0 0 2px rgba(0,119,204,0.1); }
.studio-hint { font-size: 11px; color: #9ca3af; margin-top: 4px; }
.studio-char-count { font-size: 10px; color: #9ca3af; text-align: right; margin-top: 2px; }

.studio-ctx-section { margin-top: 8px; }
.btn-studio-upload-ctx {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  margin-top: 6px;
  transition: all 0.15s;
}
.btn-studio-upload-ctx:hover { border-color: var(--admin-primary); color: var(--admin-primary); background: #f0f7ff; }

.studio-ctx-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.studio-ctx-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
  flex-shrink: 0;
}
.studio-ctx-item svg { color: #9ca3af; flex-shrink: 0; }
.studio-ctx-item-info { flex: 1; min-width: 0; }
.studio-ctx-item-name { font-size: 11px; color: #374151; font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-ctx-item-size { font-size: 10px; color: #9ca3af; }
.studio-ctx-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 2px;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}
.studio-ctx-item-remove:hover { color: #dc2626; }

/* Studio Summary */
.studio-summary {
  padding: 20px;
}
.studio-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.studio-summary-top h3 {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}
.studio-summary-top p {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
}
.studio-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.studio-summary-stat {
  text-align: center;
  padding: 12px 8px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}
.studio-summary-val {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}
.studio-summary-label {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
}

/* ---------- Controls Studio ---------- */

/* Step Indicator */
.cs-step-indicator {
  padding: 16px 20px;
  margin-bottom: 20px;
}
.cs-steps-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cs-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
  flex-shrink: 0;
}
.cs-step-item.clickable {
  cursor: pointer;
}
.cs-step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  transition: all 0.2s;
}
.cs-step-circle.completed {
  background: var(--admin-primary);
  color: #fff;
}
.cs-step-circle.current {
  background: var(--admin-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(0,119,204,0.2);
}
.cs-step-circle.future {
  background: #f3f4f6;
  color: #9ca3af;
}
.cs-step-label {
  font-size: 11px;
  font-weight: 500;
}
.cs-step-label.current { color: #111827; }
.cs-step-label.completed { color: var(--admin-primary); }
.cs-step-label.future { color: #9ca3af; }
.cs-step-line {
  flex: 1;
  height: 1px;
  margin: 0 12px;
}
.cs-step-line.completed { background: var(--admin-primary); }
.cs-step-line.future { background: #e5e7eb; }

/* Session List */
/* ── Controls Studio: Stats Grid ── */
.cs-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 768px) { .cs-stats-grid { grid-template-columns: repeat(2, 1fr); } }
.cs-stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
}
.cs-stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.cs-stat-icon-primary { background: rgba(0,119,204,0.1); color: #0077cc; }
.cs-stat-icon-emerald { background: #ecfdf5; color: #059669; }
.cs-stat-icon-sky { background: #f0f9ff; color: #0284c7; }
.cs-stat-icon-amber { background: #fffbeb; color: #d97706; }
.cs-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}
.cs-stat-label {
  font-size: 10px;
  color: #6b7280;
  margin-top: 2px;
}

/* ── Controls Studio: Session List Card ── */
.cs-list-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}
.cs-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
}
.cs-list-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}
.cs-list-subtitle {
  font-size: 10px;
  color: #9ca3af;
  margin: 2px 0 0;
}
.cs-empty-state {
  padding: 48px 24px;
  text-align: center;
}
.cs-empty-state svg { margin: 0 auto 12px; }
.cs-empty-state h3 { font-size: 14px; font-weight: 600; color: #374151; margin: 0 0 6px; }
.cs-empty-state p { font-size: 12px; color: #9ca3af; margin: 0; max-width: 360px; margin-inline: auto; }

.cs-list-rows { }

/* ── Controls Studio: Session Row ── */
.cs-session-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s;
  cursor: pointer;
}
.cs-session-row:last-child { border-bottom: none; }
.cs-session-row:hover {
  background: rgba(0,0,0,0.015);
}
.cs-session-row:hover .cs-session-actions { opacity: 1; }

.cs-session-main {
  flex: 1;
  min-width: 0;
}
.cs-session-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.cs-session-name {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badges */
.cs-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.cs-badge-emerald { background: #ecfdf5; color: #059669; }
.cs-badge-amber { background: #fffbeb; color: #d97706; }
.cs-badge-gray { background: #f3f4f6; color: #6b7280; }

.cs-session-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: #9ca3af;
}
.cs-meta-date {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.cs-meta-date svg { color: #d1d5db; }
.cs-meta-sep { color: #e5e7eb; }

/* Numbers columns */
.cs-session-numbers {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.cs-num-col { text-align: center; min-width: 42px; }
.cs-num-val {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
}
.cs-num-emerald { color: #059669; }
.cs-num-label {
  font-size: 9px;
  color: #9ca3af;
  margin-top: 1px;
}

/* Action buttons (visible on hover) */
.cs-session-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.cs-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #0077cc;
  border: 1px solid rgba(0,119,204,0.2);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.cs-action-btn:hover { background: rgba(0,119,204,0.05); }
.cs-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #fecaca;
  background: none;
  color: #dc2626;
  cursor: pointer;
  transition: background 0.15s;
}
.cs-delete-btn:hover { background: #fef2f2; }

.cs-row-chevron {
  color: #d1d5db;
  flex-shrink: 0;
  transition: color 0.15s;
}
.cs-session-row:hover .cs-row-chevron { color: #0077cc; }

/* Wizard Step Card */
.cs-wizard-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: visible;
}
.cs-wizard-header {
  padding: 20px;
  color: #fff;
}
.cs-wizard-header.navy { background: var(--admin-navy); }
.cs-wizard-header.emerald { background: #047857; }
.cs-wizard-header.sky { background: #0369a1; }
.cs-wizard-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.cs-wizard-header-desc {
  font-size: 12px;
  opacity: 0.7;
}
.cs-wizard-header-stat {
  margin-top: 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.cs-wizard-header-stat .big {
  font-size: 28px;
  font-weight: 700;
}
.cs-wizard-header-stat .label {
  font-size: 12px;
  opacity: 0.6;
}

.cs-wizard-body {
  padding: 16px 20px 20px;
}

.cs-wizard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid #f3f4f6;
}

/* Framework Row */
.cs-fw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  transition: all 0.15s;
  cursor: pointer;
  border: 1px solid transparent;
}
.cs-fw-row:hover {
  background: #f9fafb;
}
.cs-fw-row.selected {
  background: rgba(0,119,204,0.04);
  border-color: rgba(0,119,204,0.2);
}
.cs-fw-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cs-fw-left input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--admin-primary);
}
.cs-fw-name {
  font-size: 12px;
  color: #374151;
}
.cs-fw-name.selected { color: #111827; font-weight: 500; }
.cs-fw-count {
  font-size: 10px;
  color: #9ca3af;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
}

/* Collection Row */
.cs-col-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.cs-col-row.selected {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.cs-col-row:not(.selected) {
  background: #f9fafb;
}
.cs-col-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cs-col-left input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #059669;
}

/* Org Context Card */
.cs-ctx-card {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.cs-ctx-card:hover {
  border-color: #d1d5db;
}
.cs-ctx-card.selected {
  border-color: var(--admin-primary);
  background: rgba(0,119,204,0.03);
}
.cs-ctx-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.15s;
}
.cs-ctx-card.selected .cs-ctx-radio {
  background: var(--admin-primary);
  border-color: var(--admin-primary);
  color: #fff;
}
.cs-ctx-body {
  flex: 1;
  min-width: 0;
}
.cs-ctx-name {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
}
.cs-ctx-name-ar {
  font-size: 12px;
  color: #9ca3af;
  margin-left: 8px;
}
.cs-ctx-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

/* Generate Step */
.cs-gen-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.cs-gen-box {
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  border-radius: 12px;
  padding: 16px;
}
.cs-gen-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
}
.cs-gen-box-val {
  font-size: 22px;
  font-weight: 700;
  color: #111827;
}
.cs-gen-box-sub {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 4px;
}
.cs-gen-ready {
  text-align: center;
  padding: 32px 16px;
}
.cs-gen-ready-icon {
  width: 64px;
  height: 64px;
  background: rgba(0,119,204,0.1);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.cs-gen-progress {
  text-align: center;
  padding: 32px 16px;
}
.cs-progress-bar {
  width: 100%;
  max-width: 400px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 9999px;
  margin: 16px auto;
  overflow: hidden;
}
.cs-progress-bar-fill {
  height: 100%;
  background: var(--admin-primary);
  border-radius: 9999px;
  transition: width 0.2s;
}

/* Review Step - Control Row */
/* ── Review Step (Figma) ── */
.cs-review-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}
.cs-review-header {
  background: var(--admin-navy, #1e293b);
  padding: 20px;
}
.cs-review-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  margin-bottom: 4px;
}
.cs-review-header-title {
  font-size: 14px;
  font-weight: 600;
}
.cs-review-header-desc {
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
}
.cs-review-header-stats {
  margin-top: 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.cs-review-big {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}
.cs-review-of {
  font-size: 12px;
  color: #9ca3af;
}
.cs-review-divider {
  width: 1px;
  height: 18px;
  background: #4b5563;
  margin: 0 4px;
}
.cs-review-exported-badge {
  font-size: 12px;
  font-weight: 500;
  color: #6ee7b7;
}
.cs-review-new-badge {
  font-size: 12px;
  font-weight: 500;
  color: #7dd3fc;
}
.cs-review-body {
  padding: 16px;
}
.cs-review-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cs-review-toolbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cs-toolbar-btn {
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 500;
  color: var(--admin-primary);
  border: 1px solid rgba(0,119,204,0.3);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  transition: background 0.15s;
}
.cs-toolbar-btn:hover { background: rgba(0,119,204,0.05); }
.cs-toolbar-btn-ghost {
  color: #6b7280;
  border-color: #e5e7eb;
}
.cs-toolbar-btn-ghost:hover { background: #f9fafb; }
.cs-toolbar-add {
  color: var(--admin-primary);
  border-color: rgba(0,119,204,0.3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cs-toolbar-add:hover { background: rgba(0,119,204,0.05); }

/* Filter tabs */
.cs-filter-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 2px;
  border: 1px solid #e5e7eb;
  margin-left: 8px;
}
.cs-filter-icon {
  color: #9ca3af;
  margin-left: 6px;
  flex-shrink: 0;
}
.cs-filter-tab {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 500;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.15s;
  white-space: nowrap;
}
.cs-filter-tab:hover { color: #374151; }
.cs-filter-tab.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Already-exported pill */
.cs-exported-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  white-space: nowrap;
  flex-shrink: 0;
}
.cs-ctrl-item.cs-ctrl-exported {
  border-color: rgba(167,243,208,0.6);
  background: rgba(236,253,245,0.3);
}

/* Edit button per row */
.cs-ctrl-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: #d1d5db;
  transition: all 0.15s;
  flex-shrink: 0;
}
.cs-ctrl-edit-btn:hover {
  color: var(--admin-primary);
  background: rgba(0,119,204,0.05);
}

.cs-review-empty {
  text-align: center;
  padding: 32px;
  font-size: 12px;
  color: #9ca3af;
}

/* Control list */
.cs-ctrl-list {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 2px;
}
.cs-ctrl-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s, box-shadow 0.15s;
  overflow: hidden;
  flex-shrink: 0;
}
.cs-ctrl-item.cs-ctrl-selected {
  border-color: rgba(0,119,204,0.2);
  background: rgba(0,119,204,0.01);
}
.cs-ctrl-item.cs-ctrl-deselected {
  opacity: 0.45;
}
.cs-ctrl-item:hover { border-color: #93c5fd; }
.cs-ctrl-item.expanded .cs-ctrl-chevron { transform: rotate(90deg); }

.cs-ctrl-row-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
}
.cs-ctrl-check {
  flex-shrink: 0;
  cursor: pointer;
  margin-top: 2px;
}
.cs-ctrl-checkbox {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 4px;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.cs-ctrl-checkbox svg { display: none; }
.cs-ctrl-checkbox.checked {
  background: var(--admin-primary);
  border-color: var(--admin-primary);
}
.cs-ctrl-checkbox.checked svg { display: block; }

.cs-ctrl-content {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.cs-ctrl-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cs-ctrl-name {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
}
.cs-ctrl-desc-line {
  font-size: 10px;
  color: #6b7280;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Requirement groups (accordion) */
.cs-req-group {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fff;
  overflow: hidden;
  transition: box-shadow .15s;
  flex-shrink: 0;
}
.cs-req-group:hover {
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.cs-req-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
  border-bottom: 1px solid #e5e7eb;
  transition: background .15s;
  flex-shrink: 0;
}
.cs-req-group-header:hover {
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
}
.cs-req-group-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}
.cs-req-group-chevron {
  transition: transform .2s ease;
  color: #64748b;
}
.cs-req-group:not(.cs-req-group-collapsed) .cs-req-group-chevron {
  transform: rotate(90deg);
}
.cs-req-group-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.cs-req-group-refid {
  font-family: var(--font-mono, 'SFMono-Regular', Consolas, monospace);
  font-size: 12px;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.cs-req-group-name {
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.4;
}
.cs-req-group-meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cs-req-group-count {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
}
.cs-req-group-body {
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: max-height .3s ease, opacity .2s ease;
}
.cs-req-group-collapsed .cs-req-group-body {
  display: none;
}
.cs-req-group-collapsed .cs-req-group-header {
  border-bottom: none;
}

/* Requirement pills (visible on card) */
.cs-ctrl-req-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.cs-ctrl-req-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 500;
  font-family: var(--font-mono, 'SFMono-Regular', Consolas, monospace);
  padding: 2px 8px;
  border-radius: 4px;
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cs-ctrl-req-pill svg {
  flex-shrink: 0;
  color: #7dd3fc;
}

/* Tags (category/csf/priority) */
.cs-ctrl-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
  margin-top: 2px;
}
.cs-tag {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.cs-tag-blue { background: #eff6ff; color: #1d4ed8; }
.cs-tag-amber { background: #fffbeb; color: #b45309; }
.cs-tag-emerald { background: #ecfdf5; color: #047857; }
.cs-tag-sky { background: #f0f9ff; color: #0369a1; }
.cs-tag-teal { background: #f0fdfa; color: #0f766e; }
.cs-tag-orange { background: #fff7ed; color: #c2410c; }
.cs-tag-red { background: #fef2f2; color: #dc2626; }
.cs-tag-gray { background: #f3f4f6; color: #6b7280; }
.cs-tag-mono { background: #f3f4f6; color: #4b5563; font-family: var(--font-mono); }
.cs-tag-primary { background: rgba(0,119,204,0.1); color: var(--admin-primary); }

.cs-ctrl-chevron {
  color: #d1d5db;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s, color 0.15s;
  margin-top: 2px;
}
.cs-ctrl-item:hover .cs-ctrl-chevron { color: #6b7280; }

/* Expandable detail */
.cs-ctrl-expand {
  display: none;
  border-top: 1px solid #f3f4f6;
  padding: 12px 14px 14px;
}
.cs-ctrl-item.expanded .cs-ctrl-expand {
  display: block;
}
.cs-ctrl-detail {
  margin-top: 10px;
}
.cs-ctrl-detail-label {
  font-size: 10px;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 3px;
}
.cs-ctrl-detail p {
  font-size: 12px;
  color: #4b5563;
  line-height: 1.6;
  margin: 0;
}
.cs-ctrl-detail-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}


/* Inline Edit Form */
.cs-edit-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cs-edit-row {
  display: flex;
  gap: 12px;
}
.cs-edit-row-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.cs-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.cs-edit-field-full {
  flex: 1;
}
.cs-edit-field label {
  font-size: 10px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cs-edit-field input,
.cs-edit-field textarea,
.cs-edit-field select {
  padding: 7px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: #1e293b;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.cs-edit-field input:focus,
.cs-edit-field textarea:focus,
.cs-edit-field select:focus {
  outline: none;
  border-color: var(--admin-primary, #0077cc);
  box-shadow: 0 0 0 2px rgba(0,119,204,0.12);
}
.cs-edit-field textarea {
  resize: vertical;
  min-height: 48px;
}
.cs-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #f3f4f6;
}
.cs-edit-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 6px 14px;
}
.cs-edit-delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: #ef4444;
  padding: 6px 10px;
  border-radius: 6px;
  margin-left: auto;
  transition: background 0.15s;
}
.cs-edit-delete-btn:hover {
  background: rgba(239,68,68,0.08);
}

/* Review footer */
.cs-review-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid #f3f4f6;
}
.cs-footer-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  transition: background 0.15s;
}
.cs-footer-back:hover { background: #f9fafb; }
.cs-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cs-footer-count {
  font-size: 12px;
  color: #6b7280;
}
.cs-footer-merge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #b45309;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  transition: background 0.15s;
}
.cs-footer-merge:hover { background: #fffbeb; }

/* ── Export Step (Figma) ── */
.cs-export-header-done {
  background: #047857;
  padding: 20px;
}
.cs-export-body {
  padding: 24px;
  max-width: 420px;
  margin: 0 auto;
}
.cs-export-summary-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  text-align: center;
  margin: 0 0 16px;
}
.cs-export-summary-box {
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  border-radius: 12px;
  padding: 16px;
}
.cs-export-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #6b7280;
  padding: 5px 0;
}
.cs-export-summary-row span:last-child {
  font-weight: 500;
  color: #374151;
}
.cs-export-val-bold {
  font-weight: 700 !important;
  color: #111827 !important;
}
.cs-export-val-sky {
  font-weight: 500 !important;
  color: #0284c7 !important;
}
.cs-export-val-amber {
  font-weight: 500 !important;
  color: #d97706 !important;
}
.cs-export-mono {
  font-family: var(--font-mono) !important;
  font-size: 10px !important;
}
.cs-export-folder-section {
  margin-top: 16px;
  padding: 14px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
}
.cs-export-folder-label {
  font-size: 12px;
  font-weight: 600;
  color: #0369a1;
  display: block;
  margin-bottom: 4px;
}
.cs-export-folder-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
  color: #374151;
  outline: none;
  transition: border-color 0.15s;
}
.cs-export-folder-select:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 2px rgba(0,119,204,0.1);
}
.cs-export-merge-warning {
  margin-top: 16px;
  padding: 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
}
.cs-export-merge-warning p {
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
  margin: 0 0 10px;
}
.cs-merge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #b45309;
  background: #fef3c7;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.cs-merge-btn:hover { background: #fde68a; }
.cs-export-warning {
  margin-top: 16px;
  padding: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
}
.cs-export-cta {
  text-align: center;
  margin-top: 20px;
}
.cs-export-progress-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  margin-bottom: 12px;
}
.cs-export-progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.cs-export-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--admin-primary);
  border-radius: 999px;
  transition: width 0.2s;
}
.cs-export-progress-text {
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  margin-top: 8px;
}

/* Export Complete */
.cs-export-done-body {
  padding: 32px 24px;
  text-align: center;
}
.cs-export-done-icon {
  width: 64px;
  height: 64px;
  background: #ecfdf5;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.cs-export-done-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px;
}
.cs-export-done-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 320px;
  margin: 24px auto;
}
.cs-export-done-stat {
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid;
}
.cs-export-done-stat-emerald {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.cs-export-done-stat-emerald .cs-export-done-stat-val { color: #047857; }
.cs-export-done-stat-emerald .cs-export-done-stat-label { color: #059669; }
.cs-export-done-stat-gray {
  background: #f9fafb;
  border-color: #e5e7eb;
}
.cs-export-done-stat-gray .cs-export-done-stat-val { color: #9ca3af; }
.cs-export-done-stat-gray .cs-export-done-stat-label { color: #6b7280; }
.cs-export-done-stat-val {
  font-size: 24px;
  font-weight: 700;
}
.cs-export-done-stat-label {
  font-size: 10px;
  margin-top: 2px;
}
.cs-export-done-meta {
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  border-radius: 12px;
  padding: 16px;
  max-width: 360px;
  margin: 16px auto;
}
.cs-export-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 0;
}
.cs-export-meta-row span:first-child { color: #6b7280; }
.cs-export-meta-row span:last-child { color: #374151; font-weight: 500; }
.cs-export-done-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ---------- Org Contexts ---------- */
.org-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.org-ctx-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 8px;
}
.org-ctx-card:hover {
  border-color: rgba(0,119,204,0.3);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.org-ctx-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
}
.org-ctx-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.org-ctx-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.org-ctx-avatar svg {
  width: 16px;
  height: 16px;
}
.org-ctx-names {
  flex: 1;
  min-width: 0;
}
.org-ctx-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.org-ctx-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}
.org-ctx-name-ar {
  font-size: 12px;
  color: #9ca3af;
  direction: rtl;
}
.org-ctx-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.org-ctx-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.org-ctx-tag-gray {
  background: #f3f4f6;
  color: #374151;
}
.org-ctx-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 16px;
}
.org-ctx-fws {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.org-fw-pill {
  font-size: 10px;
  font-weight: 500;
  color: #0d9488;
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.org-fw-more {
  color: #6b7280;
  background: #f3f4f6;
  border-color: #e5e7eb;
}
.org-ctx-docs {
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
  flex-shrink: 0;
}
.org-ctx-action-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.org-ctx-action-btn:hover {
  background: #f3f4f6;
  color: #374151;
}
.org-ctx-chevron {
  color: #d1d5db;
  flex-shrink: 0;
  transition: transform 0.2s, color 0.15s;
}
.org-ctx-card:hover .org-ctx-chevron {
  color: #0077cc;
}
.org-ctx-card.expanded .org-ctx-chevron {
  transform: rotate(90deg);
  color: #0077cc;
}

/* Expandable details panel */
.org-ctx-expand {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 16px;
  border-top: 0px solid transparent;
}
.org-ctx-card.expanded .org-ctx-expand {
  max-height: 600px;
  padding: 14px 16px 16px;
  border-top: 1px solid #f3f4f6;
}
.org-ctx-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.org-ctx-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.org-ctx-detail-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.org-ctx-detail-value {
  font-size: 13px;
  color: #374151;
}
.org-ctx-detail-section {
  margin-bottom: 10px;
}
.org-ctx-detail-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.org-ctx-objectives {
  margin: 4px 0 0 16px;
  padding: 0;
  font-size: 13px;
  color: #374151;
  line-height: 1.6;
}
.org-ctx-notes-text {
  font-size: 13px;
  color: #6b7280;
  margin: 4px 0 0;
  line-height: 1.5;
}
.org-ctx-doc-name {
  font-size: 12px;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.org-ctx-doc-size {
  font-size: 10px;
  color: #9ca3af;
  flex-shrink: 0;
  margin-left: 8px;
}

/* ---------- Org Context Detail Page ---------- */
.org-detail-page { animation: fadeIn 0.2s ease; }
.org-detail-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
.org-detail-top .pi-back-btn { margin-top: 4px; }
.org-detail-top-info { flex: 1; }
.org-detail-breadcrumb { font-size: 11px; color: #9ca3af; margin-bottom: 4px; }
.org-detail-title { font-size: 20px; font-weight: 700; color: #111827; display: flex; align-items: baseline; gap: 10px; }
.org-detail-title-ar { font-size: 15px; font-weight: 400; color: #9ca3af; direction: rtl; }
.org-detail-top-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }

.org-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 768px) { .org-detail-grid { grid-template-columns: 1fr; } }

.org-detail-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.org-detail-grid .org-detail-card { margin-bottom: 0; }
.org-detail-card-title { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.3px; }

.org-detail-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.org-detail-field-label { font-size: 11px; font-weight: 500; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; }
.org-detail-field-value { font-size: 14px; color: #111827; font-weight: 500; }

.org-detail-maturity { text-align: center; padding: 12px 0; }
.org-detail-mat-bar { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.org-detail-mat-dot { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #9ca3af; background: #f3f4f6; border: 2px solid #e5e7eb; transition: all 0.2s; }
.org-detail-mat-dot.active { background: rgba(var(--admin-primary-rgb, 0,119,204), 0.1); color: rgba(var(--admin-primary-rgb, 0,119,204), 1); border-color: rgba(var(--admin-primary-rgb, 0,119,204), 0.4); }
.org-detail-mat-label { font-size: 13px; color: #6b7280; font-weight: 500; }

.org-detail-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.org-detail-section-body { font-size: 13px; color: #374151; }
.org-detail-notes { font-size: 13px; color: #6b7280; line-height: 1.6; white-space: pre-wrap; }

.org-detail-doc-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; color: #374151; }
.org-detail-doc-row:last-child { border-bottom: none; }
.org-detail-doc-row svg { color: #9ca3af; flex-shrink: 0; }

/* --- Org File Attachments --- */
.org-files-list { display: flex; flex-direction: column; gap: 0; }
.org-file-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid #f3f4f6; transition: background 0.15s; }
.org-file-row:last-child { border-bottom: none; }
.org-file-row:hover { background: #f9fafb; }
.org-file-info { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #374151; min-width: 0; }
.org-file-info svg { color: #9ca3af; flex-shrink: 0; }
.org-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.org-file-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* --- Org Chat FAB + Panel --- */
.org-chat-fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 1100;
  width: 54px; height: 54px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff;
  box-shadow: 0 4px 16px rgba(99,102,241,.4); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s, box-shadow .18s;
}
.org-chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(99,102,241,.5); }

.org-chat-panel {
  position: fixed; bottom: 96px; right: 28px; z-index: 1100;
  width: 420px; max-height: 620px; border-radius: 16px;
  background: #fff; border: 1px solid #e5e7eb;
  box-shadow: 0 12px 40px rgba(0,0,0,.15);
  display: flex; flex-direction: column; overflow: hidden;
  transition: all .25s ease;
}
.org-chat-panel.expanded {
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; max-height: 100%; border-radius: 0;
  z-index: 9999;
}

.org-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid #f3f4f6;
  background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff;
}
.org-chat-header-info { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.org-chat-header-actions { display: flex; gap: 4px; }
.org-chat-header-btn {
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.org-chat-header-btn:hover { background: rgba(255,255,255,.3); }

.org-chat-step {
  display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
}

.org-chat-stores {
  padding: 10px 14px; flex: 1; overflow-y: auto;
  background: #fafafe;
}

.org-chat-step1-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-top: 1px solid #f3f4f6; background: #fff;
}
.org-chat-selected-count { font-size: 12px; color: #6b7280; }
.org-chat-start-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 18px; border-radius: 10px; border: none;
  background: #6366f1; color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s, opacity .15s;
}
.org-chat-start-btn:hover:not(:disabled) { background: #4f46e5; }
.org-chat-start-btn:disabled { opacity: .45; cursor: not-allowed; }
.org-chat-stores-label { font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.org-chat-stores-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.org-chat-store-accordion {
  border: 1px solid #e5e7eb; border-radius: 8px; background: #fff;
  transition: all .15s; overflow: hidden;
  flex-shrink: 0;
}
.org-chat-store-accordion:hover { border-color: #a5b4fc; }
.org-chat-store-accordion.selected { border-color: #818cf8; background: #eef2ff; }

.org-chat-store-header {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  font-size: 13px; color: #374151; cursor: pointer; user-select: none;
  flex-shrink: 0;
}
.org-chat-store-header input[type="checkbox"] { accent-color: #6366f1; margin: 0; flex-shrink: 0; }
.org-chat-store-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.org-chat-store-badge { font-size: 10px; color: #6366f1; font-weight: 600; background: #e0e7ff; padding: 1px 6px; border-radius: 4px; flex-shrink: 0; }
.org-chat-store-chevron { color: #9ca3af; flex-shrink: 0; transition: transform .2s; }
.org-chat-store-accordion.open .org-chat-store-chevron { transform: rotate(180deg); }

.org-chat-store-files {
  border-top: 1px solid #f3f4f6; padding: 4px 8px 6px 32px;
  background: #fafafe;
}
.org-chat-files-loading { font-size: 11px; color: #9ca3af; display: flex; align-items: center; gap: 6px; padding: 6px 0; }
.org-chat-files-empty { font-size: 11px; color: #9ca3af; padding: 6px 0; }

.org-chat-file-row {
  display: flex; align-items: center; gap: 6px; padding: 3px 0;
  font-size: 12px; color: #4b5563;
}
.org-chat-file-row svg { color: #9ca3af; flex-shrink: 0; }
.org-chat-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.org-chat-file-status { font-size: 8px; flex-shrink: 0; }
.org-chat-file-status.active { color: #22c55e; }
.org-chat-file-status.processing { color: #f59e0b; }

.org-chat-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex;
  flex-direction: column; gap: 12px; min-height: 0;
}
.org-chat-welcome { text-align: center; padding: 32px 16px; color: #9ca3af; }
.org-chat-welcome-title { font-size: 16px; font-weight: 600; color: #374151; margin: 10px 0 4px; }
.org-chat-welcome-sub { font-size: 13px; line-height: 1.5; }

.org-chat-msg { display: flex; max-width: 88%; }
.org-chat-msg.user { align-self: flex-end; }
.org-chat-msg.ai { align-self: flex-start; flex-direction: column; }
.org-chat-msg-content {
  padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.55;
  word-break: break-word;
}
.org-chat-msg.user .org-chat-msg-content {
  background: #6366f1; color: #fff; border-bottom-right-radius: 4px;
}
.org-chat-msg.ai .org-chat-msg-content {
  background: #f3f4f6; color: #1f2937; border-bottom-left-radius: 4px;
}
.org-chat-msg-content code { background: rgba(0,0,0,.06); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.org-chat-msg-content pre { background: #1f2937; color: #e5e7eb; padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 12px; margin: 6px 0; }
.org-chat-msg-content pre code { background: none; padding: 0; color: inherit; }
.org-chat-msg-content ul { padding-left: 18px; margin: 4px 0; }
.org-chat-msg-content li { margin-bottom: 2px; }
.org-chat-msg-content strong { font-weight: 600; }

.org-chat-thinking { display: flex; align-items: center; gap: 6px; color: #9ca3af; font-style: italic; }
.org-chat-error { color: #ef4444 !important; background: #fef2f2 !important; border: 1px solid #fecaca; }

.org-chat-sources { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; padding: 0 4px; }
.org-chat-source-pill {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: #e0e7ff; color: #4338ca; cursor: default;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.org-chat-input-area {
  display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px;
  border-top: 1px solid #f3f4f6; background: #fff;
}
.org-chat-input {
  flex: 1; resize: none; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 10px 14px; font-size: 13px; font-family: inherit;
  max-height: 100px; min-height: 38px; outline: none;
  transition: border-color .15s;
}
.org-chat-input:focus { border-color: #818cf8; }
.org-chat-send-btn {
  width: 38px; height: 38px; border-radius: 12px; border: none;
  background: #6366f1; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s; flex-shrink: 0;
}
.org-chat-send-btn:hover { background: #4f46e5; }
.org-chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- File Collections ---------- */
.fc-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.fc-collection-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  transition: border-color 0.15s;
  margin-bottom: 12px;
}
.fc-collection-card:hover {
  border-color: rgba(0,119,204,0.3);
}
.fc-collection-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}
.fc-collection-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.fc-collection-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(0,119,204,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-primary);
}
.fc-collection-name {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
}
.fc-collection-id {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}
.fc-collection-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Merge Placeholder / Empty State ---------- */
.merge-placeholder,
.empty-state-box {
  padding: 48px 20px;
  text-align: center;
}
.merge-placeholder .empty-icon,
.empty-state-box .empty-icon {
  margin: 0 auto 12px;
}
.merge-placeholder h3,
.empty-state-box h3 {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
}
.merge-placeholder p,
.empty-state-box p {
  font-size: 12px;
  color: #9ca3af;
  max-width: 360px;
  margin: 0 auto;
}
.coming-soon-badge {
  display: inline-block;
  margin-top: 16px;
  font-size: 11px;
  font-weight: 500;
  color: #d97706;
  background: #fffbeb;
  padding: 4px 12px;
  border-radius: 9999px;
}

.redirect-note {
  font-size: 13px;
  color: #6b7280;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}
.redirect-note a {
  color: var(--admin-primary);
  font-weight: 500;
  text-decoration: none;
}
.redirect-note a:hover {
  text-decoration: underline;
}

/* ---------- Scrollbar ---------- */
.admin-sidebar::-webkit-scrollbar,
.admin-content::-webkit-scrollbar {
  width: 6px;
}
.admin-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.admin-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}
.admin-content::-webkit-scrollbar-track {
  background: #f3f4f6;
}
.admin-content::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

/* ---------- Utility ---------- */
.font-arabic {
  font-family: 'Cairo', sans-serif;
}
.text-right { text-align: right; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }

/* ---------- Admin Modal ---------- */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.admin-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.admin-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s;
}
.admin-modal-overlay.active .admin-modal {
  transform: translateY(0) scale(1);
}
.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f3f4f6;
}
.admin-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}
.admin-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s;
}
.admin-modal-close:hover {
  background: #f3f4f6;
  color: #374151;
}
.admin-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.admin-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid #f3f4f6;
}

/* ---------- Admin Form ---------- */
.admin-form-row {
  margin-bottom: 16px;
}
.admin-form-row:last-child {
  margin-bottom: 0;
}
.admin-form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}
.admin-form-label .required {
  color: #dc2626;
}
.admin-form-input,
.admin-form-select,
.admin-form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #111827;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.admin-form-input:focus,
.admin-form-select:focus,
.admin-form-textarea:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(0,119,204,0.1);
}
.admin-form-input::placeholder,
.admin-form-textarea::placeholder {
  color: #9ca3af;
}
.admin-form-select {
  appearance: auto;
}
.admin-form-textarea {
  resize: vertical;
  min-height: 60px;
}
.admin-form-hint {
  display: block;
  font-size: 10px;
  color: #9ca3af;
  margin-top: 4px;
}

/* ---------- Controls Studio: Progress / Generate ---------- */
.cs-gen-progress { text-align: center; }
.cs-gen-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}
.cs-gen-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--admin-primary), #60a5fa);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.cs-gen-progress-text {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 14px;
}
.cs-gen-progress-log {
  background: #0f172a;
  border-radius: 8px;
  padding: 12px 16px;
  max-height: 200px;
  overflow-y: auto;
  text-align: left;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 11px;
  line-height: 1.7;
}
.cs-progress-log-item { color: #94a3b8; }
.cs-progress-log-item.success { color: #34d399; }
.cs-progress-log-item.warn { color: #fbbf24; }
.cs-progress-log-item.error { color: #f87171; }

/* ---------- Controls Studio: Review ---------- */
/* ── Merge Optimizer ── */
.mo-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 20px;
  align-items: start;
}
.mo-col-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mo-col-center { min-width: 0; }
.mo-col-right { min-width: 0; }
.mo-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}
.mo-card-header {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
}
.mo-card-header-sky { background: rgba(224,242,254,0.5); }
.mo-card-header-gray { background: #f9fafb; }
.mo-card-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mo-card-header h2 {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}
.mo-card-header p {
  font-size: 10px;
  color: #6b7280;
  margin: 3px 0 0;
}
.mo-card-header svg { color: #0284c7; flex-shrink: 0; }
.mo-card-header-gray svg { color: #6b7280; }
.mo-card-body { padding: 16px; }
.mo-select {
  width: 100%;
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  outline: none;
  cursor: pointer;
}
.mo-select:focus { border-color: var(--admin-primary); }
.mo-count { font-size: 10px; color: #9ca3af; }

/* Session info */
.mo-session-detail {
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
}
.mo-session-detail-name { font-size: 12px; font-weight: 500; color: #111827; }
.mo-session-detail-org { font-size: 10px; color: #6b7280; margin-top: 2px; }
.mo-session-detail-meta { font-size: 10px; color: #6b7280; margin-top: 4px; }
.mo-session-fw-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.mo-sep { color: #d1d5db; margin: 0 2px; }

/* Analyze button */
.mo-analyze-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: #f59e0b;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.mo-analyze-btn:hover { background: #d97706; }
.mo-analyze-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* History */
.mo-history-list { }
.mo-history-row {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
}
.mo-history-row:last-child { border-bottom: none; }
.mo-history-name { font-size: 12px; font-weight: 500; color: #111827; }
.mo-history-stats { font-size: 10px; color: #6b7280; margin-top: 4px; }
.mo-history-accepted { color: #059669; }
.mo-history-rejected { color: #ef4444; }
.mo-history-date { font-size: 10px; color: #9ca3af; margin-top: 2px; }
.mo-history-empty { padding: 24px 16px; text-align: center; font-size: 10px; color: #9ca3af; }

/* Empty state */
.mo-empty-state {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
}
.mo-empty-icon {
  width: 56px;
  height: 56px;
  background: #f9fafb;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.mo-empty-state h3 { font-size: 13px; font-weight: 600; color: #6b7280; margin: 0 0 4px; }
.mo-empty-state p { font-size: 12px; color: #9ca3af; margin: 0; }

/* Analyzing */
.mo-analyzing-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 48px 24px;
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}
.mo-analyzing-icon {
  width: 64px;
  height: 64px;
  background: #fffbeb;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.mo-analyzing-card h3 { font-size: 13px; font-weight: 600; color: #111827; margin: 0 0 4px; }
.mo-analyzing-card p { font-size: 12px; color: #6b7280; margin: 0 0 20px; }
.mo-progress-bar { width: 100%; height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.mo-progress-fill { height: 100%; width: 0%; background: #f59e0b; border-radius: 999px; transition: width 0.15s; }
.mo-progress-text { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: #6b7280; margin-top: 12px; }
.mo-pulse { animation: moPulse 1.5s ease-in-out infinite; }
@keyframes moPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Search bar */
.mo-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
}
.mo-search-bar svg { color: #9ca3af; flex-shrink: 0; }
.mo-search-bar input {
  border: none;
  outline: none;
  background: none;
  font-size: 12px;
  flex: 1;
  color: #374151;
}

/* Existing controls list */
.mo-existing-list { max-height: 500px; overflow-y: auto; overflow-x: hidden; }
.mo-existing-row {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s;
  overflow: hidden;
}
.mo-existing-row:hover { background: rgba(249,250,251,0.5); }
.mo-existing-row:last-child { border-bottom: none; }
.mo-existing-merged { background: rgba(236,253,245,0.3); }
.mo-existing-name {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mo-merge-queued {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-weight: 500;
  margin-left: 6px;
}
.mo-existing-desc {
  font-size: 10px;
  color: #6b7280;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mo-existing-reqs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.mo-more { font-size: 10px; color: #9ca3af; }
.mo-existing-date { font-size: 10px; color: #9ca3af; margin-top: 4px; }

/* Suggestions */
.mo-suggestions-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.mo-suggestions-title { font-size: 12px; font-weight: 600; color: #111827; margin: 0; }
.mo-suggestions-subtitle { font-size: 10px; color: #6b7280; margin: 2px 0 0; }
.mo-suggestions-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.mo-apply-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: #059669;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.mo-apply-btn:hover { background: #047857; }

/* Suggestion card */
.mo-sug-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.mo-sug-card:hover { box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.mo-sug-accepted { border-color: #a7f3d0; background: rgba(236,253,245,0.3); }
.mo-sug-rejected { border-color: #fecaca; background: rgba(254,242,242,0.2); opacity: 0.6; }

.mo-sug-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.mo-sug-badges { display: flex; align-items: center; gap: 6px; }
.mo-conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}
.mo-conf-dot { width: 6px; height: 6px; border-radius: 50%; }
.mo-conf-high { background: #ecfdf5; color: #047857; }
.mo-conf-high .mo-conf-dot { background: #10b981; }
.mo-conf-medium { background: #fffbeb; color: #b45309; }
.mo-conf-medium .mo-conf-dot { background: #f59e0b; }
.mo-conf-low { background: #f3f4f6; color: #6b7280; }
.mo-conf-low .mo-conf-dot { background: #9ca3af; }

.mo-status-badge { font-size: 10px; font-weight: 500; padding: 2px 8px; border-radius: 999px; }
.mo-status-accepted { background: #ecfdf5; color: #047857; }
.mo-status-rejected { background: #fef2f2; color: #dc2626; }

.mo-sug-expand-btn { background: none; border: none; cursor: pointer; padding: 4px; color: #9ca3af; transition: color 0.15s; }
.mo-sug-expand-btn:hover { color: #374151; }
.mo-sug-card.expanded .mo-sug-chevron { transform: rotate(90deg); }
.mo-sug-chevron { transition: transform 0.2s; }

.mo-sug-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mo-sug-box { flex: 1; min-width: 0; padding: 10px; border-radius: 8px; border: 1px solid; }
.mo-sug-box-new { background: #f0f9ff; border-color: #bae6fd; }
.mo-sug-box-existing { background: #f9fafb; border-color: #e5e7eb; }
.mo-sug-box-label { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #6b7280; margin-bottom: 4px; }
.mo-sug-box-new .mo-sug-box-label { color: #0284c7; }
.mo-sug-box-name {
  font-size: 12px;
  font-weight: 500;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mo-sug-arrow { color: #d1d5db; flex-shrink: 0; }

.mo-sug-merged {
  padding: 10px;
  background: rgba(0,119,204,0.04);
  border: 1px solid rgba(0,119,204,0.1);
  border-radius: 8px;
}
.mo-sug-merged-desc {
  font-size: 10px;
  color: #6b7280;
  margin-top: 4px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.mo-sug-expand { max-height: 0; overflow: hidden; transition: max-height 0.3s ease, margin 0.3s ease; }
.mo-sug-card.expanded .mo-sug-expand { max-height: 400px; margin-top: 12px; }
.mo-sug-detail { margin-bottom: 10px; }
.mo-sug-detail:last-child { margin-bottom: 0; }
.mo-sug-detail-label { font-size: 10px; font-weight: 500; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 3px; }
.mo-sug-detail p { font-size: 12px; color: #4b5563; line-height: 1.6; margin: 0; }
.mo-sug-pills { display: flex; flex-wrap: wrap; gap: 4px; }

.mo-sug-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}
.mo-accept-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: #059669;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.mo-accept-btn:hover { background: #047857; }
.mo-reject-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #4b5563;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.mo-reject-btn:hover { background: #f9fafb; }

.mo-pending-warning {
  margin-top: 12px;
  padding: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12px;
  color: #92400e;
}

@media (max-width: 1100px) {
  .mo-grid { grid-template-columns: 1fr; }
  .mo-col-left, .mo-col-center, .mo-col-right { min-width: 0; }
}

/* Badge color helpers (kept) */
.badge-rose { background: #fff1f2; color: #e11d48; border: 1px solid #fecdd3; }
.badge-gray { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }

/* ---------- Controls Studio: Drop Zone ---------- */
.cs-drop-zone {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: #fafbfc;
  margin-top: 6px;
}
.cs-drop-zone:hover { border-color: var(--admin-primary); background: #f0f7ff; }
.cs-drop-zone.drag-over { border-color: var(--admin-primary); background: #e0ecfe; }
.cs-drop-text { font-size: 12px; color: #6b7280; margin-top: 6px; }
.cs-drop-hint { font-size: 10px; color: #9ca3af; margin-top: 2px; }
.cs-session-files {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-top: 8px;
}

/* ---------- Controls Studio: Org Context Radio Options ---------- */
.cs-org-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}
.cs-org-option:hover { border-color: #93c5fd; background: #f8fbff; }
.cs-org-option.selected { border-color: var(--admin-primary); background: #eff6ff; box-shadow: 0 0 0 1px var(--admin-primary); }
.cs-org-radio { margin-top: 3px; flex-shrink: 0; }
.cs-org-radio-dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
.cs-org-radio-dot.active { border-color: var(--admin-primary); }
.cs-org-radio-dot.active::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--admin-primary);
}
.cs-org-option-content { flex: 1; min-width: 0; }
.cs-org-option-name { font-size: 13px; font-weight: 600; color: #111827; line-height: 1.3; }
.cs-org-option-desc { font-size: 11px; color: #6b7280; margin-top: 3px; line-height: 1.3; }
.cs-org-option-desc .badge { vertical-align: middle; }

/* ---------- Org Context Form ---------- */
.admin-modal-lg { max-width: 680px; }
.admin-modal.admin-modal-lg.pup-result-modal-shell { max-width: 820px; }
.admin-modal.admin-modal-lg.pup-result-modal-shell.pup-result-modal-shell--expanded {
  max-width: min(96vw, 1280px);
  width: min(96vw, 1280px);
  max-height: 94vh;
}
.pup-result-modal-header .admin-modal-title {
  flex: 1;
  min-width: 0;
  padding-right: 12px;
}
.pup-result-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.admin-modal-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.admin-modal-icon-btn:hover {
  background: #f3f4f6;
  color: #374151;
}
.pup-result-modal-expand-btn.is-expanded .pup-result-expand-icon {
  display: none;
}
.pup-result-modal-expand-btn.is-expanded .pup-result-collapse-icon.hidden {
  display: flex !important;
}
.pup-result-modal-body {
  padding-top: 12px !important;
  max-height: 75vh;
}
.admin-modal.admin-modal-lg.pup-result-modal-shell.pup-result-modal-shell--expanded .pup-result-modal-body {
  max-height: calc(94vh - 200px);
}
.admin-modal-footer.pup-result-modal-footer {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.pup-result-modal-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.pup-result-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}
.pup-result-badge-stage {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.pup-result-meta { font-size: 12px; color: #6b7280; }
.pup-result-panel {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #f9fafb;
}
.pup-result-panel h4 {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pup-result-relevance-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}
.pup-result-pill {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.pup-result-pill-yes { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.pup-result-pill-no { background: #fffbeb; color: #b45309; border: 1px solid #fcd34d; }
.pup-result-confidence { font-size: 13px; color: #4b5563; }
.pup-result-prose {
  margin: 0;
  font-size: 13px;
  line-height: 1.58;
  color: #111827;
  white-space: pre-wrap;
}
.pup-result-list { margin: 8px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.5; color: #374151; }
.pup-result-note {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f3f4f6;
  font-size: 12px;
  line-height: 1.55;
  color: #4b5563;
  border-left: 3px solid #9ca3af;
}
.pup-result-point-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.pup-result-point-card:last-child { margin-bottom: 0; }
.pup-result-point-head { font-size: 11px; font-weight: 600; color: #4f46e5; margin-bottom: 6px; }
.pup-result-point-meta { font-size: 11px; color: #6b7280; margin-bottom: 8px; line-height: 1.35; }
.pup-result-match-box {
  border-top: 1px dashed #e5e7eb;
  padding-top: 10px;
  margin-top: 10px;
  font-size: 12px;
}
.pup-result-match-policy { font-weight: 600; color: #1f2937; margin-bottom: 4px; }
.pup-result-sim { font-size: 11px; color: #6b7280; margin-bottom: 6px; }
.pup-result-excerpt {
  font-size: 11px;
  color: #4b5563;
  background: #f9fafb;
  padding: 8px;
  border-radius: 6px;
  margin-top: 4px;
  white-space: pre-wrap;
}
.pup-result-impact-card {
  border-radius: 0 10px 10px 0;
  padding: 12px 14px;
  margin-top: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #6366f1;
}
.pup-result-impact-card.pup-sev-critical { border-left-color: #dc2626; }
.pup-result-impact-card.pup-sev-high { border-left-color: #ea580c; }
.pup-result-impact-card.pup-sev-medium { border-left-color: #ca8a04; }
.pup-result-impact-card.pup-sev-low { border-left-color: #16a34a; }
.pup-result-impact-card.pup-sev-none { border-left-color: #94a3b8; }
.pup-result-impact-head { font-size: 12px; font-weight: 600; color: #111827; margin-bottom: 8px; }
.pup-result-dl {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #374151;
}
.pup-result-dl dt {
  margin-top: 8px;
  font-weight: 600;
  color: #111827;
  font-size: 11px;
}
.pup-result-dl dd { margin: 2px 0 0 0; }
.pup-result-amends { margin-top: 8px; padding-left: 14px; }
.pup-result-amends li { margin-bottom: 8px; }
.pup-result-raw-details { margin-top: 18px; }
.pup-result-raw-details summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--admin-primary);
  font-weight: 500;
}
.pup-result-raw-details pre {
  margin: 10px 0 0;
  padding: 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.45;
  overflow: auto;
  max-height: 260px;
}

/* ---------- Policy update pipeline (modern layout) ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#page-policy-update-pipeline.pup-page .pup-page-container {
  max-width: 1120px;
}
#page-policy-update-pipeline .pup-page-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 28px;
}
#page-policy-update-pipeline .pup-page-title {
  letter-spacing: -0.02em;
}
#page-policy-update-pipeline .pup-page-header-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.pup-history-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  padding: 6px 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.pup-history-btn:hover { background: #e0e7ff; border-color: #a5b4fc; }

/* ── Pipeline History page ─────────────────────────────────── */
.ph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding-top: 4px;
}
.ph-card {
  position: relative;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  box-shadow: 0 1px 4px rgba(15,23,42,0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ph-card:hover {
  border-color: #a5b4fc;
  box-shadow: 0 4px 16px rgba(99,102,241,0.1);
  transform: translateY(-1px);
}
.ph-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ph-stage-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid;
}
.ph-card-date {
  font-size: 11.5px;
  color: #94a3b8;
  flex-shrink: 0;
}
.ph-card-snippet {
  font-size: 13px;
  color: #334155;
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ph-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}
.ph-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: #64748b;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ph-card-arrow {
  position: absolute;
  right: 18px;
  bottom: 18px;
  color: #cbd5e1;
  transition: color 0.15s, transform 0.15s;
}
.ph-card:hover .ph-card-arrow { color: #6366f1; transform: translateX(2px); }

#page-policy-update-pipeline .pup-stage-rail {
  flex-shrink: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
#page-policy-update-pipeline .pup-stage-rail-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 10px;
}
#page-policy-update-pipeline .pup-stage-rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
}
#page-policy-update-pipeline .pup-stage-rail-list > li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#page-policy-update-pipeline .pup-stage-rail-chev {
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  user-select: none;
  padding: 0 2px;
}
#page-policy-update-pipeline .pup-stage-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#page-policy-update-pipeline .pup-stage-dot--f1 { background: #e0e7ff; color: #3730a3; }
#page-policy-update-pipeline .pup-stage-dot--f2 { background: #dbeafe; color: #1d4ed8; }
#page-policy-update-pipeline .pup-stage-dot--f3 { background: #cffafe; color: #0e7490; }
#page-policy-update-pipeline .pup-stage-dot--f4 { background: #fce7f3; color: #a21caf; }
#page-policy-update-pipeline .pup-stage-name {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  max-width: 72px;
  line-height: 1.2;
}

@media (min-width: 900px) {
  #page-policy-update-pipeline .pup-page-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
  }
  #page-policy-update-pipeline .pup-stage-rail {
    max-width: 420px;
  }
  #page-policy-update-pipeline .pup-stage-name {
    max-width: none;
  }
}

#page-policy-update-pipeline .pup-stepper-card--modern {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 22px 22px 18px;
  background: #fff;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 10px 28px -10px rgba(15, 23, 42, 0.1);
}

#page-policy-update-pipeline .pup-step-caption {
  margin: 12px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.01em;
}

#page-policy-update-pipeline .pup-step-grid--split {
  display: grid;
  gap: 16px;
  align-items: start;
}
@media (min-width: 960px) {
  #page-policy-update-pipeline .pup-step-grid--split {
    grid-template-columns: minmax(280px, 360px) 1fr;
  }
}

#page-policy-update-pipeline .pup-step-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#page-policy-update-pipeline .pup-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 18px 20px;
}
#page-policy-update-pipeline .pup-panel--emphasis {
  background: #fff;
  border-color: #c7d2fe;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.06);
}
#page-policy-update-pipeline .pup-panel--f4 {
  background: linear-gradient(180deg, #faf5ff 0%, #fdf4ff 100%);
  border-color: #e9d5ff;
}
#page-policy-update-pipeline .pup-panel--single {
  background: #fff;
}

#page-policy-update-pipeline .pup-panel-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
#page-policy-update-pipeline .pup-panel-lead {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
  max-width: 42rem;
}
#page-policy-update-pipeline .pup-tag-muted {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #e0e7ff;
  color: #4338ca;
}
#page-policy-update-pipeline .pup-tag-optional {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #ede9fe;
  color: #6d28d9;
}
#page-policy-update-pipeline .pup-code-hint {
  margin: -6px 0 10px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.45;
}
#page-policy-update-pipeline .pup-code-hint code {
  font-size: 10px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  color: #334155;
}

#page-policy-update-pipeline .pup-field-stack .ds-import-row {
  margin-bottom: 0;
}
#page-policy-update-pipeline .pup-field-stack .ds-import-row + .ds-import-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}
#page-policy-update-pipeline .pup-field-flush .ds-label {
  margin-bottom: 0;
}
#page-policy-update-pipeline .pup-field-hint {
  margin-top: 8px !important;
  margin-bottom: 0 !important;
}
#page-policy-update-pipeline .pup-select.ds-select {
  max-width: 100%;
}

#page-policy-update-pipeline .pup-textarea-comfort {
  min-height: 220px;
}

#page-policy-update-pipeline .pup-inline-log {
  margin-top: 16px;
  max-height: 480px;
}

#page-policy-update-pipeline .pup-btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#page-policy-update-pipeline .pup-btn-next[hidden],
#page-policy-update-pipeline .pup-btn-run[hidden] {
  display: none !important;
}
#page-policy-update-pipeline .pup-btn-next:not([hidden]),
#page-policy-update-pipeline .pup-btn-run:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#page-policy-update-pipeline .pup-btn-run svg {
  opacity: 0.95;
}

/* Policy pipeline — full-screen loading overlay */
#page-policy-update-pipeline .pup-pipeline-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 560;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
}
#page-policy-update-pipeline .pup-pipeline-loading-overlay:not([hidden]) {
  display: flex;
}
body.pup-pipeline-overlay-open {
  overflow: hidden;
}
#page-policy-update-pipeline .pup-pipeline-loading-panel {
  width: 100%;
  max-width: 420px;
  padding: 28px 28px 24px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  text-align: center;
  border: 1px solid #e2e8f0;
}
#page-policy-update-pipeline .pup-pipeline-loading-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--admin-primary, #2563eb);
  border-radius: 50%;
  animation: pup-pipeline-spin 0.7s linear infinite;
}
@keyframes pup-pipeline-spin {
  to { transform: rotate(360deg); }
}
#page-policy-update-pipeline .pup-pipeline-loading-title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}
#page-policy-update-pipeline .pup-pipeline-loading-stages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 4px;
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}
#page-policy-update-pipeline .pup-pipeline-stage {
  padding: 4px 8px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
}
#page-policy-update-pipeline .pup-pipeline-stage--on {
  background: #e0e7ff;
  color: #3730a3;
}
#page-policy-update-pipeline .pup-pipeline-stage-sep {
  color: #cbd5e1;
  font-weight: 500;
}
#page-policy-update-pipeline .pup-pipeline-loading-hint {
  margin: 0 0 20px;
  font-size: 12px;
  line-height: 1.5;
  color: #64748b;
}
#page-policy-update-pipeline .pup-pipeline-cancel-btn {
  min-width: 120px;
}

#page-policy-update-pipeline .pup-stepper-card--modern[aria-busy="true"] .pup-stepper-top,
#page-policy-update-pipeline .pup-stepper-card--modern[aria-busy="true"] .pup-stepper-panels {
  opacity: 0.72;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#page-policy-update-pipeline .pup-f4-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
#page-policy-update-pipeline .pup-f4-toolbar-btn {
  font-size: 12px;
}
#page-policy-update-pipeline .pup-grc-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #6b7280;
}
#page-policy-update-pipeline .pup-grc-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid #d1d5db;
  border-top-color: var(--admin-primary, #2563eb);
  border-radius: 50%;
  animation: pup-pipeline-spin 0.7s linear infinite;
  flex-shrink: 0;
}
#page-policy-update-pipeline .pup-policies-textarea-loading {
  opacity: 0.45;
  pointer-events: none;
}

#page-policy-update-pipeline .pup-f4-sev-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 720px) {
  #page-policy-update-pipeline .pup-f4-sev-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
  }
  #page-policy-update-pipeline .pup-f4-sev-field--span2 {
    grid-column: 1 / -1;
  }
}
#page-policy-update-pipeline .pup-f4-sev-field {
  position: relative;
  padding-left: 12px;
  border-radius: 0 10px 10px 0;
}
#page-policy-update-pipeline .pup-f4-sev-field::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 999px;
  background: #cbd5e1;
}
#page-policy-update-pipeline .pup-f4-sev-field--critical::before { background: #dc2626; }
#page-policy-update-pipeline .pup-f4-sev-field--high::before { background: #ea580c; }
#page-policy-update-pipeline .pup-f4-sev-field--medium::before { background: #ca8a04; }
#page-policy-update-pipeline .pup-f4-sev-field--low::before { background: #16a34a; }
#page-policy-update-pipeline .pup-f4-sev-field--none::before { background: #64748b; }

#page-policy-update-pipeline .pup-f4-sev-field .pup-f4-sev-sublabel {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#page-policy-update-pipeline .pup-f4-sev-field textarea {
  min-height: 56px;
  border-radius: 10px;
  border-color: #e2e8f0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#page-policy-update-pipeline .pup-f4-sev-field textarea:focus {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  outline: none;
}

/* ── Policy extraction modal ───────────────────────────────── */
.pup-extract-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.pup-extract-modal-overlay[hidden] { display: none; }
.pup-extract-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15,23,42,0.18);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pup-extract-modal-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid #f1f5f9;
}
.pup-extract-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}
.pup-extract-modal-meta {
  font-size: 12px;
  color: #6b7280;
}
.pup-extract-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pup-extract-policy-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
}
.pup-extract-article-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 5px;
  padding: 1px 7px;
  margin-bottom: 5px;
}
.pup-extract-policy-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 4px;
}
.pup-extract-policy-content {
  font-size: 12px;
  color: #475569;
  line-height: 1.55;
  margin: 0;
  white-space: pre-wrap;
}
.pup-extract-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 20px;
  border-top: 1px solid #f1f5f9;
}
/* Extraction in-progress mini overlay */
/* ── Extraction loading overlay (modern) ───────────────────── */
.pup-extract-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.pup-extract-loading-overlay[hidden] { display: none; }

.pup-extract-loading-panel {
  background: #fff;
  border-radius: 20px;
  padding: 36px 44px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(99,102,241,0.08);
  min-width: 300px;
  max-width: 380px;
  width: 90vw;
}

/* Gradient ring spinner */
.pup-extract-spinner-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: 22px;
}
.pup-extract-spinner-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #6366f1 0%, #818cf8 30%, #c7d2fe 60%, transparent 75%);
  animation: pup-extract-spin 1.1s linear infinite;
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
}
.pup-extract-spinner-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6366f1;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px 2px rgba(99,102,241,0.35);
  animation: pup-extract-dot-pulse 1.1s ease-in-out infinite;
}
@keyframes pup-extract-spin {
  to { transform: rotate(360deg); }
}
@keyframes pup-extract-dot-pulse {
  0%, 100% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  50%       { opacity: 0.6; transform: translate(-50%,-50%) scale(0.7); }
}

/* Title + subtitle */
.pup-extract-loading-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.pup-extract-loading-label {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 20px;
  text-align: center;
  min-height: 18px;
  transition: opacity 0.3s ease;
}

/* Animated stage pills */
.pup-extract-stages {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pup-extract-stage-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #94a3b8;
  transition: background 0.35s ease, color 0.35s ease;
  white-space: nowrap;
}
.pup-extract-stage-pill.is-active {
  background: #eef2ff;
  color: #4f46e5;
}
.pup-extract-stage-pill.is-done {
  background: #f0fdf4;
  color: #16a34a;
}
.pup-extract-stage-sep {
  width: 18px;
  height: 1px;
  background: #e2e8f0;
  flex-shrink: 0;
}
.pup-upload-extract-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Policy update pipeline stepper */
.pup-stepper-card { padding-bottom: 8px; }
.pup-stepper-top { margin-bottom: 20px; }
.pup-stepper-labels {
  display: flex;
  justify-content: space-between;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 10px;
}
.pup-step-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #f8fafc;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.pup-step-label:hover {
  background: #f1f5f9;
}
.pup-step-label-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: #e2e8f0;
  color: #475569;
  transition: background 0.15s ease, color 0.15s ease;
}
.pup-step-label-text {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  line-height: 1.25;
}
.pup-step-label.is-done {
  border-color: #6ee7b7;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  box-shadow: 0 1px 2px rgba(16, 185, 129, 0.12);
}
.pup-step-label.is-done .pup-step-label-num {
  background: #059669;
  color: #fff;
}
.pup-step-label.is-done .pup-step-label-text { color: #064e3b; }

.pup-step-label.is-active {
  border-color: #93c5fd;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: 0 2px 8px -2px rgba(37, 99, 235, 0.2);
}
.pup-step-label.is-active .pup-step-label-num {
  background: var(--admin-primary);
  color: #fff;
}
.pup-step-label.is-active .pup-step-label-text { color: #1e3a8a; }

.pup-stepper-progress-rail {
  height: 5px;
  background: #e2e8f0;
  border-radius: 999px;
  margin-top: 16px;
  overflow: hidden;
}
.pup-stepper-progress-fill {
  height: 100%;
  width: 33.333%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--admin-primary), #38bdf8);
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.pup-stepper-panels { min-height: 260px; }
.pup-step-panel:focus-visible { outline: 2px solid rgba(99, 102, 241, 0.45); outline-offset: 3px; }
.pup-step-intro { margin-bottom: 18px; }
.pup-step-heading {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.pup-step-intro-note { margin: 0 !important; line-height: 1.5; max-width: 48rem; }
.pup-step-tall-textarea { min-height: 220px; border-radius: 12px; }
#page-policy-update-pipeline .pup-panel textarea.admin-form-textarea {
  border-radius: 12px;
  border-color: #e2e8f0;
}
#page-policy-update-pipeline .pup-panel textarea.admin-form-textarea:focus {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  outline: none;
}
.admin-form-textarea-mono {
  font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
}
.pup-stepper-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
  background: linear-gradient(180deg, transparent, #fafafa 0%);
}
.pup-stepper-actions-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}
@media (max-width: 640px) {
  .pup-stepper-labels { flex-direction: column; }
  .pup-step-label { width: 100%; }
  .pup-stepper-actions .pup-stepper-actions-right { margin-left: 0; width: 100%; justify-content: flex-end; }
}
.pup-preset-bundle-hint {
  margin-top: 10px !important;
  margin-bottom: 0 !important;
  max-width: none;
  line-height: 1.45;
}

.org-form-section { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #f0f0f0; }
.org-form-section:last-child { border-bottom: none; margin-bottom: 0; }
.org-form-section-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--admin-primary);
  margin-bottom: 12px; padding-bottom: 4px;
}
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .admin-form-grid { grid-template-columns: 1fr; } }

/* Maturity slider */
.maturity-slider-wrap { margin-top: 4px; }
.maturity-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px; border-radius: 4px;
  background: linear-gradient(to right, #ef4444 0%, #f59e0b 25%, #eab308 50%, #22c55e 75%, #0ea5e9 100%);
  outline: none; cursor: pointer;
}
.maturity-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--admin-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15); cursor: pointer;
}
.maturity-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--admin-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15); cursor: pointer;
}
.maturity-labels {
  display: flex; justify-content: space-between; margin-top: 6px;
}
.maturity-labels span {
  font-size: 10px; color: #9ca3af; transition: color 0.2s, font-weight 0.2s;
  cursor: default; text-align: center; flex: 1;
}
.maturity-labels span.active { color: var(--admin-primary); font-weight: 600; }

/* Mandate chips */
.mandate-options {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
}
.mandate-chip-option {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: #374151; cursor: pointer;
  padding: 4px 8px; border-radius: 6px; border: 1px solid #e5e7eb;
  background: #fff; transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.mandate-chip-option:hover { background: #f9fafb; border-color: #d1d5db; }
.mandate-chip-option input { accent-color: var(--admin-primary); width: 13px; height: 13px; }

/* Strategic objectives multiselect dropdown */
.multiselect-dropdown {
  position: relative;
}
.multiselect-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  min-height: 38px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.multiselect-trigger:hover {
  border-color: #93c5fd;
}
.multiselect-dropdown.open .multiselect-trigger {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.multiselect-placeholder {
  font-size: 12px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.multiselect-placeholder.has-selection {
  color: #111827;
  font-weight: 500;
}
.multiselect-arrow {
  flex-shrink: 0;
  color: #9ca3af;
  transition: transform 0.2s;
}
.multiselect-dropdown.open .multiselect-arrow {
  transform: rotate(180deg);
}
.multiselect-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}
.multiselect-dropdown.open .multiselect-menu {
  display: block;
}
.multiselect-search {
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px;
  outline: none;
  background: #f9fafb;
  border-radius: 6px 6px 0 0;
  box-sizing: border-box;
}
.multiselect-search::placeholder { color: #9ca3af; }
.multiselect-search:focus { background: #fff; border-bottom-color: #3b82f6; }
.multiselect-menu label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 12px;
  color: #374151;
  transition: background 0.12s;
}
.multiselect-menu label:hover {
  background: #f3f4f6;
}
.multiselect-menu input[type="checkbox"] {
  margin-top: 2px;
  accent-color: #3b82f6;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
}
.multiselect-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.multiselect-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 8px;
  border-radius: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 11px;
  color: #1e40af;
  font-weight: 500;
}
.multiselect-chip-remove {
  background: none;
  border: none;
  color: #93c5fd;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 1px;
  transition: color 0.15s;
}
.multiselect-chip-remove:hover {
  color: #ef4444;
}

/* Org context card details (legacy – kept for expand future) */

/* Controls Studio: blocked state */
.cs-gen-blocked {
  text-align: center; padding: 40px 20px;
}
.cs-gen-blocked-icon { margin-bottom: 12px; }

/* Badge: violet */
.badge-violet { background: #ede9fe; color: #7c3aed; }

/* Control card guidance & source */
.cs-ctrl-guidance {
  font-size: 10px; color: #4b5563; margin-top: 4px;
  background: #f9fafb; padding: 4px 6px; border-radius: 4px;
  border-left: 2px solid #3b82f6;
}
.cs-ctrl-source-q {
  font-size: 10px; color: #6b21a8; margin-top: 4px;
  background: #faf5ff; padding: 4px 6px; border-radius: 4px;
  border-left: 2px solid #8b5cf6;
}

/* Question-to-Control section */

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .studio-three-col {
    grid-template-columns: 1fr;
  }
  .cs-gen-summary {
    grid-template-columns: 1fr;
  }
  .org-ctx-expand-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .admin-sidebar {
    width: 60px;
  }
  .sidebar-brand-text,
  .sidebar-item span,
  .sidebar-section-toggle span,
  .sidebar-footer {
    display: none;
  }
  .sidebar-item {
    padding-left: 18px;
    justify-content: center;
  }
  .admin-main {
    margin-left: 60px;
  }
  .cs-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .fc-stats-grid,
  .org-stats-grid {
    grid-template-columns: 1fr;
  }
  .sessions-table-header,
  .session-row {
    grid-template-columns: 1fr 60px 60px 60px 80px 24px;
    gap: 8px;
    font-size: 10px;
  }
}

/* ---------- Admin Prompts ---------- */

.ap-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.ap-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}
.ap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.ap-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  transition: box-shadow .15s, border-color .15s;
}
.ap-card:hover {
  border-color: var(--admin-primary);
  box-shadow: 0 2px 8px rgba(0,119,204,.08);
}
.ap-card-local {
  border-left: 3px solid #10b981;
}
.ap-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.ap-card-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ap-card-name {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}
.ap-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.ap-card-preview {
  position: relative;
  margin-bottom: 10px;
}
.ap-card-preview pre {
  font-size: 11px;
  line-height: 1.5;
  color: #6b7280;
  background: #f9fafb;
  padding: 10px;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 100px;
  overflow: hidden;
  margin: 0;
  font-family: 'Cairo', sans-serif;
}
.ap-card-preview pre::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 32px;
  background: linear-gradient(transparent, #f9fafb);
  border-radius: 0 0 6px 6px;
  pointer-events: none;
}
.ap-card-footer {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.ap-card-date {
  font-size: 10px;
  color: #9ca3af;
}
.ap-card-note {
  margin-top: 8px;
  padding: 6px 10px;
  background: #fef3c7;
  border-radius: 6px;
  font-size: 11px;
  color: #92400e;
  line-height: 1.4;
}

/* prompt modal textarea */
.admin-prompt-textarea {
  min-height: 320px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
}

/* badge helpers used by prompts */
.badge-round { border-radius: 20px; }
.badge-emerald { background: #d1fae5; color: #065f46; }
.badge-gray { background: #f3f4f6; color: #6b7280; }

@media (max-width: 600px) {
  .ap-grid { grid-template-columns: 1fr; }
}

/* ============================
   Chat Page (within admin layout)
   ============================ */

/* Chat wrapper fills remaining space */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: calc(100vh - 49px); /* minus header height */
  overflow: hidden;
  background: #f9fafb;
}

/* ── Header extras for chat ── */
.chat-header-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #6b7280;
  text-decoration: none;
  transition: all 0.15s;
}
.chat-header-back:hover {
  background: #f3f4f6;
  color: var(--admin-primary);
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-header-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}
.chat-header-session-id {
  font-size: 10px;
  font-family: 'Courier New', monospace;
  color: #9ca3af;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
}
.chat-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--admin-primary);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.chat-header-btn:hover {
  border-color: var(--admin-primary);
  background: #f0f7ff;
}

/* ── Context Bar ── */
.chat-ctx-bar {
  display: flex;
  gap: 10px;
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.chat-ctx-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  background: #f9fafb;
  border: 1px solid #f3f4f6;
  border-radius: 10px;
  transition: all 0.15s;
}
.chat-ctx-card:hover {
  border-color: #e5e7eb;
  background: #fff;
}
.chat-ctx-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-ctx-icon-blue {
  background: #dbeafe;
  color: #2563eb;
}
.chat-ctx-icon-emerald {
  background: #d1fae5;
  color: #059669;
}
.chat-ctx-icon-amber {
  background: #fef3c7;
  color: #d97706;
}
.chat-ctx-info {
  min-width: 0;
  flex: 1;
}
.chat-ctx-label {
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-ctx-chevron {
  color: #9ca3af;
  transition: transform 0.2s, color 0.15s;
}
.chat-ctx-card:hover .chat-ctx-chevron {
  color: var(--admin-primary);
}
.chat-ctx-value {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.4;
  max-height: 3.5em;
  overflow: hidden;
  margin-top: 2px;
}
.chat-ctx-value .ctx-inline-req {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #4b5563;
  font-size: 11px;
}
.chat-ctx-value .ctx-inline-req b {
  color: var(--admin-primary);
  font-weight: 600;
  margin-right: 0.15em;
}
.chat-ctx-value .ctx-inline-coll {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #4b5563;
  font-size: 11px;
}

/* ── Expandable context panels ── */
.chat-ctx-panel {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 20px;
  max-height: 180px;
  overflow-y: auto;
  animation: chatPanelSlide 0.2s ease;
}
@keyframes chatPanelSlide {
  from { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
  to { max-height: 180px; opacity: 1; }
}
.chat-ctx-panel-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-ctx-panel .ctx-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--admin-primary);
  padding: 6px 0 3px;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 2px;
}
.chat-ctx-panel .ctx-detail-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: #4b5563;
  padding: 3px 0 3px 8px;
  line-height: 1.35;
}
.chat-ctx-panel .ctx-ref-id {
  font-weight: 600;
  color: var(--admin-primary);
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 11px;
}
.chat-ctx-panel .ctx-desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-ctx-panel .ctx-empty {
  font-size: 12px;
  color: #9ca3af;
  font-style: italic;
  padding: 6px 0;
}

/* ── Messages Area ── */
.chat-messages-area {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chat-wrapper .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}
.chat-wrapper .chat-messages::-webkit-scrollbar { width: 5px; }
.chat-wrapper .chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-wrapper .chat-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* Messages */
.chat-wrapper .chat-msg {
  display: flex;
  max-width: 100%;
}
.chat-wrapper .chat-msg-user {
  justify-content: flex-end;
}
.chat-wrapper .chat-msg-ai {
  justify-content: flex-start;
}

/* Bubbles */
.chat-wrapper .chat-bubble {
  max-width: 740px;
  border-radius: 12px;
  padding: 12px 16px;
  line-height: 1.6;
  font-size: 13px;
}
.chat-wrapper .chat-bubble-user {
  background: var(--admin-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 119, 204, 0.2);
}
.chat-wrapper .chat-bubble-ai {
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* AI bubble avatar indicator */
.chat-wrapper .chat-msg-ai .chat-bubble-ai {
  position: relative;
}
.chat-wrapper .chat-msg-ai .chat-bubble-ai::before {
  content: '';
  position: absolute;
  top: 14px;
  left: -6px;
  width: 3px;
  height: 16px;
  background: var(--admin-primary);
  border-radius: 2px;
}

.chat-wrapper .chat-bubble-text {
  word-wrap: break-word;
}

/* Markdown in chat */
.chat-wrapper .chat-bubble-text .md-h1,
.chat-wrapper .chat-bubble-text .md-h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 12px 0 6px;
  color: #111827;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 4px;
}
.chat-wrapper .chat-bubble-text .md-h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 10px 0 4px;
  color: #111827;
}
.chat-wrapper .chat-bubble-text .md-h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 8px 0 3px;
  color: #374151;
}
.chat-wrapper .chat-bubble-text .md-h1:first-child,
.chat-wrapper .chat-bubble-text .md-h2:first-child,
.chat-wrapper .chat-bubble-text .md-h3:first-child,
.chat-wrapper .chat-bubble-text .md-h4:first-child {
  margin-top: 0;
}
.chat-wrapper .chat-bubble-text .md-ul {
  margin: 6px 0;
  padding-left: 18px;
  list-style-type: disc;
}
.chat-wrapper .chat-bubble-text .md-ul-item {
  margin-bottom: 3px;
  line-height: 1.5;
}
.chat-wrapper .chat-bubble-text .md-ol {
  margin: 6px 0;
  padding-left: 20px;
  list-style-type: decimal;
}
.chat-wrapper .chat-bubble-text .md-ol-item {
  margin-bottom: 3px;
  line-height: 1.5;
}
.chat-wrapper .chat-bubble-text li strong {
  color: #111827;
}
.chat-wrapper .chat-bubble-text .md-inline-code {
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'Courier New', monospace;
}
.chat-wrapper .chat-bubble-user .chat-bubble-text .md-inline-code {
  background: rgba(255, 255, 255, 0.2);
}
.chat-wrapper .chat-bubble-text .md-code-block {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
}
.chat-wrapper .chat-bubble-text .md-code-block code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  font-family: inherit;
}
.chat-wrapper .chat-bubble-text .md-hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 10px 0;
}
.chat-wrapper .chat-bubble-text code {
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.875em;
  font-family: 'Courier New', monospace;
}
.chat-wrapper .chat-bubble-user .chat-bubble-text code {
  background: rgba(255, 255, 255, 0.2);
}

/* Bubble footer */
.chat-wrapper .chat-bubble-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  gap: 8px;
}
.chat-wrapper .chat-bubble-time {
  font-size: 10px;
  opacity: 0.5;
  white-space: nowrap;
}
.chat-wrapper .chat-bubble-user .chat-bubble-time {
  text-align: right;
  margin-top: 4px;
}

/* Copy button */
.chat-wrapper .btn-copy-response {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #9ca3af;
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  opacity: 0;
  pointer-events: none;
}
.chat-wrapper .chat-bubble-ai:hover .btn-copy-response {
  opacity: 1;
  pointer-events: auto;
}
.chat-wrapper .btn-copy-response:hover {
  color: var(--admin-primary);
  border-color: #e5e7eb;
  background: #f9fafb;
}
.chat-wrapper .btn-copy-response.copied {
  color: #059669;
  opacity: 1;
  pointer-events: auto;
}

/* Typing indicator */
.chat-wrapper .chat-bubble.typing {
  padding: 12px 18px;
}
.chat-wrapper .typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}
.chat-wrapper .typing-dots span {
  width: 7px;
  height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  animation: chatTyping 1.4s ease-in-out infinite;
}
.chat-wrapper .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-wrapper .typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ── Input Area ── */
.chat-input-area {
  flex-shrink: 0;
  padding: 12px 24px 8px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
}
.chat-wrapper .chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 800px;
  margin: 0 auto;
}
.chat-wrapper .chat-input {
  flex: 1;
  min-height: 40px;
  max-height: 140px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  color: #1f2937;
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  outline: none;
  resize: none;
  line-height: 1.5;
  transition: all 0.15s;
}
.chat-wrapper .chat-input::placeholder {
  color: #9ca3af;
}
.chat-wrapper .chat-input:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(0, 119, 204, 0.1);
  background: #fff;
}
.chat-wrapper .chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: var(--admin-primary);
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.chat-wrapper .chat-send-btn:hover:not(:disabled) {
  background: var(--admin-primary-dark);
}
.chat-wrapper .chat-send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.chat-wrapper .chat-input-hint {
  text-align: center;
  font-size: 10px;
  color: #9ca3af;
  margin-top: 4px;
  padding-bottom: 2px;
}

/* ── Chat responsive ── */
@media (max-width: 768px) {
  .chat-ctx-bar {
    padding: 8px 12px;
    gap: 6px;
    overflow-x: auto;
  }
  .chat-ctx-card {
    min-width: 130px;
    padding: 8px 10px;
  }
  .chat-ctx-panel {
    padding: 6px 12px;
  }
  .chat-wrapper .chat-messages {
    padding: 12px 14px;
  }
  .chat-input-area {
    padding: 8px 12px 6px;
  }
  .chat-wrapper .chat-bubble {
    max-width: 88%;
  }
}

/* ========================================
   POLICY INGESTION
   ======================================== */

/* Collections List */
.pi-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.pi-header-left { display: flex; flex-direction: column; }
.pi-header-title { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.pi-header-title svg { color: var(--admin-primary); }
.pi-header-title h1 { font-size: 18px; font-weight: 700; color: #111827; margin: 0; }
.pi-header-subtitle { font-size: 12px; color: #6b7280; margin: 0; }

.pi-table-card { background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; overflow: hidden; }
.pi-table { width: 100%; border-collapse: collapse; }
.pi-table thead tr { background: #f9fafb; border-bottom: 1px solid #f3f4f6; }
.pi-table th { text-align: left; padding: 12px 20px; font-size: 10px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; }
.pi-table th.center { text-align: center; }
.pi-table th.right { text-align: right; }
.pi-table tbody tr { border-bottom: 1px solid #f3f4f6; transition: background 0.15s; }
.pi-table tbody tr:last-child { border-bottom: none; }
.pi-table tbody tr:hover { background: rgba(249,250,251,0.5); }
.pi-table td { padding: 16px 20px; vertical-align: middle; }
.pi-table td.center { text-align: center; }
.pi-table td.right { text-align: right; }

.pi-coll-name { display: flex; align-items: center; gap: 12px; }
.pi-coll-icon { width: 36px; height: 36px; border-radius: 8px; background: rgba(var(--admin-primary-rgb, 0,119,204), 0.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--admin-primary); }
.pi-coll-info { min-width: 0; }
.pi-coll-title { font-size: 13px; font-weight: 500; color: #111827; }
.pi-coll-desc { font-size: 10px; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.pi-files-count { font-size: 12px; font-weight: 500; color: #374151; }
.pi-date { font-size: 12px; color: #6b7280; }

.pi-status { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; padding: 2px 8px; border-radius: 9999px; font-weight: 500; }
.pi-status-ready { background: #e0f2fe; color: #0369a1; }
.pi-status-empty { background: #f3f4f6; color: #6b7280; }
.pi-status-generating { background: #fef3c7; color: #b45309; }
.pi-status-generated { background: #d1fae5; color: #047857; }

.pi-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.pi-btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; font-size: 10px; font-weight: 500; border-radius: 8px; border: 1px solid; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.pi-btn-view { color: #4b5563; border-color: #e5e7eb; background: #fff; }
.pi-btn-view:hover { background: #f9fafb; }
.pi-btn-generate { color: var(--admin-primary); border-color: rgba(var(--admin-primary-rgb, 0,119,204), 0.3); background: #fff; }
.pi-btn-generate:hover { background: rgba(var(--admin-primary-rgb, 0,119,204), 0.05); }
.pi-btn-library { color: #047857; border-color: #bbf7d0; background: #fff; }
.pi-btn-library:hover { background: #ecfdf5; }
.pi-btn-delete { color: #9ca3af; border-color: transparent; background: none; padding: 4px 6px; }
.pi-btn-delete:hover { color: #dc2626; background: #fef2f2; border-color: #fecaca; }

/* Empty state */
.pi-empty { background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; padding: 48px; text-align: center; }
.pi-empty-icon { width: 64px; height: 64px; background: #f9fafb; border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.pi-empty-icon svg { color: #d1d5db; }
.pi-empty h3 { font-size: 13px; font-weight: 600; color: #6b7280; margin: 0 0 4px; }
.pi-empty p { font-size: 11px; color: #9ca3af; margin: 0 0 16px; }

/* Collection Detail */
.pi-detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.pi-back-btn { padding: 6px; color: #9ca3af; border: none; background: none; border-radius: 8px; cursor: pointer; transition: all 0.15s; }
.pi-back-btn:hover { color: #4b5563; background: #f3f4f6; }
.pi-delete-collection-btn { padding: 8px; color: #9ca3af; border: 1px solid transparent; background: none; border-radius: 8px; cursor: pointer; transition: all 0.15s; }
.pi-delete-collection-btn:hover { color: #dc2626; background: #fef2f2; border-color: #fecaca; }
.pi-detail-breadcrumb { font-size: 10px; color: #9ca3af; margin-bottom: 2px; }
.pi-detail-title { font-size: 18px; font-weight: 700; color: #111827; margin: 0; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.pi-detail-title:hover { color: var(--admin-primary); }
.pi-detail-title .pi-edit-icon { opacity: 0; transition: opacity 0.15s; color: #d1d5db; }
.pi-detail-title:hover .pi-edit-icon { opacity: 1; }
.pi-detail-title-input { font-size: 18px; font-weight: 700; color: #111827; border: none; border-bottom: 2px solid var(--admin-primary); outline: none; background: transparent; width: 100%; max-width: 400px; padding: 2px 0; }

.pi-detail-card { background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; padding: 20px; }
.pi-detail-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.pi-detail-desc { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #6b7280; cursor: pointer; }
.pi-detail-desc:hover { color: var(--admin-primary); }
.pi-detail-desc .pi-edit-icon { opacity: 0; transition: opacity 0.15s; }
.pi-detail-desc:hover .pi-edit-icon { opacity: 1; }
.pi-detail-desc-input { font-size: 12px; color: #6b7280; border: none; border-bottom: 1px solid var(--admin-primary); outline: none; background: transparent; width: 100%; max-width: 300px; padding: 2px 0; }
.pi-detail-file-count { font-size: 10px; color: #9ca3af; margin-top: 4px; }
.pi-detail-actions { display: flex; align-items: center; gap: 8px; }

.pi-select-all { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid #f3f4f6; }
.pi-select-all label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 10px; color: #6b7280; font-weight: 500; }
.pi-select-all input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--admin-primary); }
.pi-selected-count { font-size: 10px; color: var(--admin-primary); font-weight: 500; }

/* File cards grid */
.pi-files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.pi-files-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.pi-files-page-range { font-size: 12px; color: #6b7280; }
.pi-files-pagination-btns { display: flex; gap: 8px; }
.pi-files-page-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pi-included-all-hint {
  font-size: 12px;
  color: #6b7280;
  padding: 10px 12px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}
.pi-file-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; border: 1px solid #e5e7eb; transition: all 0.15s; }
.pi-file-card.selected { border-color: rgba(var(--admin-primary-rgb, 0,119,204), 0.3); background: rgba(var(--admin-primary-rgb, 0,119,204), 0.02); box-shadow: 0 0 0 1px rgba(var(--admin-primary-rgb, 0,119,204), 0.1); }
.pi-file-card:hover { border-color: #d1d5db; }
.pi-file-card input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--admin-primary); flex-shrink: 0; }
.pi-file-icon { width: 40px; height: 40px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pi-file-icon-pdf { background: #fef2f2; color: #ef4444; }
.pi-file-icon-docx { background: #eff6ff; color: #3b82f6; }
.pi-file-icon-pptx { background: #fff7ed; color: #f97316; }
.pi-file-icon-txt { background: #f9fafb; color: #6b7280; }
.pi-file-icon-png, .pi-file-icon-jpg { background: #ecfdf5; color: #10b981; }
.pi-file-info { flex: 1; min-width: 0; }
.pi-file-name { font-size: 12px; font-weight: 500; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-file-meta { font-size: 10px; color: #9ca3af; margin-top: 2px; }
.pi-gemini-synced { color: #10b981; font-weight: 500; }
.pi-gemini-pending { color: #f59e0b; font-weight: 500; }
.pi-file-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.pi-file-action-btn { padding: 6px; color: #d1d5db; border: none; background: none; border-radius: 4px; cursor: pointer; transition: color 0.15s; }
.pi-file-action-btn:hover { color: #6b7280; }
.pi-file-action-btn.view { color: #9ca3af; }
.pi-file-action-btn.view:hover { color: #2563eb; }
.pi-file-action-btn.delete:hover { color: #ef4444; }
.pi-file-selected-check { width: 20px; height: 20px; border-radius: 50%; background: var(--admin-primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* File Viewer Modal */
.pi-file-viewer-overlay {
  position: fixed; inset: 0; z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  animation: pi-fade-in 0.2s ease;
}
@keyframes pi-fade-in { from { opacity: 0; } to { opacity: 1; } }
.pi-file-viewer {
  background: #fff; border-radius: 12px; overflow: hidden;
  width: 90vw; height: 90vh; max-width: 1200px;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  animation: pi-scale-in 0.2s ease;
}
@keyframes pi-scale-in { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.pi-file-viewer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid #e5e7eb;
  background: #f9fafb; flex-shrink: 0;
}
.pi-file-viewer-title { font-size: 13px; font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; margin-right: 12px; }
.pi-file-viewer-actions { display: flex; align-items: center; gap: 4px; }
.pi-file-viewer-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 8px; border: 1px solid #e5e7eb; border-radius: 6px;
  background: #fff; color: #6b7280; cursor: pointer; transition: all 0.15s;
  text-decoration: none; font-size: 12px;
}
.pi-file-viewer-btn:hover { color: #111827; border-color: #d1d5db; background: #f3f4f6; }
.pi-file-viewer-btn.close { border-color: transparent; }
.pi-file-viewer-btn.close:hover { color: #dc2626; background: #fef2f2; }
.pi-file-viewer-body { flex: 1; overflow: hidden; background: #f3f4f6; }
.pi-file-viewer-frame { width: 100%; height: 100%; border: none; }
.pi-file-viewer-image { max-width: 100%; max-height: 100%; object-fit: contain; display: block; margin: auto; padding: 20px; }

/* Upload drop zone */
.pi-detail-upload-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.pi-dropzone-links {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
}
.pi-dropzone-links-sep {
  color: #d1d5db;
  user-select: none;
}
.pi-dropzone-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  margin: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: rgba(var(--admin-primary-rgb, 0,119,204), 1);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pi-dropzone-btn:hover {
  color: rgba(var(--admin-primary-rgb, 0,119,204), 0.85);
}

.pi-dropzone.pi-dropzone-active {
  border-color: rgba(var(--admin-primary-rgb, 0,119,204), 0.45);
  background: rgba(var(--admin-primary-rgb, 0,119,204), 0.06);
}
.pi-dropzone {
  margin-top: 20px;
  border: 2px dashed #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.pi-dropzone:hover { border-color: rgba(var(--admin-primary-rgb, 0,119,204), 0.3); background: rgba(var(--admin-primary-rgb, 0,119,204), 0.02); }
.pi-dropzone svg { color: #d1d5db; margin-bottom: 8px; }
.pi-dropzone p { font-size: 12px; color: #6b7280; margin: 0; }
.pi-dropzone .pi-dropzone-hint { font-size: 10px; color: #9ca3af; margin-top: 4px; }

/* Always present on collection detail — lives above tabs so uploads work on any tab */
#pi-upload-progress-container:not(:empty) {
  margin-bottom: 14px;
}

#pi-upload-progress-container.pi-upload-batch-mode:not(:empty) {
  max-height: min(55vh, 420px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 8px;
  margin-bottom: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fafafa;
  align-items: stretch;
}

/* Flex column + fixed max-height would shrink children to fit; keep each row full natural height */
#pi-upload-progress-container.pi-upload-batch-mode > * {
  flex-shrink: 0;
}
.pi-upload-batch-summary {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px 12px;
  margin: -4px -4px 4px;
  background: linear-gradient(180deg, #fafafa 70%, rgba(250, 250, 250, 0.92) 100%);
  border-bottom: 1px solid #e5e7eb;
  border-radius: 8px 8px 0 0;
}
.pi-upload-batch-line1 { font-size: 12px; font-weight: 600; color: #1f2937; }
.pi-upload-batch-line2 {
  font-size: 11px;
  font-weight: 500;
  color: rgba(var(--admin-primary-rgb, 0,119,204), 1);
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pi-upload-batch-line1.pi-upload-batch-done { color: #16a34a; }
.pi-upload-progress { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; max-height: 120px; overflow: hidden; animation: pi-upload-fadein 0.25s ease; }
#pi-upload-progress-container.pi-upload-batch-mode .pi-upload-progress { max-height: none; }
.pi-upload-progress.pi-upload-queued { opacity: 0.78; }
.pi-upload-progress.pi-upload-queued .pi-upload-progress-status { color: #94a3b8; }
.pi-upload-progress.pi-upload-active {
  box-shadow: 0 0 0 2px rgba(var(--admin-primary-rgb, 0,119,204), 0.25);
  border-color: rgba(var(--admin-primary-rgb, 0,119,204), 0.4);
  background: #fff;
  opacity: 1;
}
#pi-upload-progress-container { display: flex; flex-direction: column; gap: 10px; }
@keyframes pi-upload-fadein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.pi-upload-progress-info { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.pi-upload-progress-name {
  font-size: 12px;
  font-weight: 500;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.pi-upload-progress-trailing {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.pi-upload-progress-pct { font-size: 11px; font-weight: 600; color: rgba(var(--admin-primary-rgb, 0,119,204), 1); }
.pi-upload-progress-index-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pi-upload-index-badge-queue {
  color: #64748b;
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.pi-upload-index-badge-reading {
  color: #0369a1;
  background: #e0f2fe;
  border-color: #bae6fd;
}
.pi-upload-index-badge-uploading {
  color: rgba(var(--admin-primary-rgb, 0,119,204), 1);
  background: rgba(var(--admin-primary-rgb, 0,119,204), 0.08);
  border-color: rgba(var(--admin-primary-rgb, 0,119,204), 0.22);
}
.pi-upload-index-badge-indexing {
  color: #b45309;
  background: #fffbeb;
  border-color: #fcd34d;
}
.pi-upload-index-badge-ready {
  color: #15803d;
  background: #dcfce7;
  border-color: #86efac;
}
.pi-upload-index-badge-pending {
  color: #b45309;
  background: #fef3c7;
  border-color: #fcd34d;
}
.pi-upload-index-badge-error {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fecaca;
}
.pi-upload-progress-bar { width: 100%; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.pi-upload-progress-fill { height: 100%; background: linear-gradient(90deg, rgba(var(--admin-primary-rgb, 0,119,204), 0.7), rgba(var(--admin-primary-rgb, 0,119,204), 1)); border-radius: 3px; transition: width 0.3s ease; }
.pi-upload-progress-status { font-size: 10px; color: #9ca3af; margin-top: 5px; }
.pi-upload-progress.pi-upload-success { border-color: #bbf7d0; background: #f0fdf4; }
.pi-upload-progress.pi-upload-success.pi-upload-index-warning {
  border-color: #fcd34d;
  background: #fffbeb;
}
.pi-upload-progress.pi-upload-success.pi-upload-index-warning .pi-upload-progress-fill { background: #f59e0b; }
.pi-upload-progress.pi-upload-success.pi-upload-index-warning .pi-upload-progress-pct { color: #d97706; }
.pi-upload-progress.pi-upload-success.pi-upload-index-warning .pi-upload-progress-status { color: #92400e; }
.pi-upload-progress.pi-upload-success .pi-upload-progress-fill { background: #22c55e; }
.pi-upload-progress.pi-upload-success .pi-upload-progress-pct { color: #16a34a; }
.pi-upload-progress.pi-upload-success .pi-upload-progress-status { color: #16a34a; }
.pi-upload-progress.pi-upload-error { border-color: #fecaca; background: #fef2f2; }
.pi-upload-progress.pi-upload-error .pi-upload-progress-fill { background: #ef4444; }
.pi-upload-progress.pi-upload-error .pi-upload-progress-pct { color: #dc2626; }
.pi-upload-progress.pi-upload-error .pi-upload-progress-status { color: #dc2626; font-weight: 500; }

/* Files empty state */
.pi-files-empty { padding: 32px; text-align: center; }
.pi-files-empty-icon { width: 48px; height: 48px; background: #f9fafb; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.pi-files-empty-icon svg { color: #d1d5db; }
.pi-files-empty p { font-size: 12px; color: #9ca3af; margin: 0; }

/* Tabs inside collection detail */
.pi-tabs { display: flex; gap: 0; border-bottom: 1px solid #e5e7eb; margin-bottom: 16px; }
.pi-tab { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border: none; background: none; cursor: pointer; font-size: 12px; font-weight: 500; color: #6b7280; border-bottom: 2px solid transparent; transition: all 0.15s; }
.pi-tab:hover { color: #374151; }
.pi-tab.active { color: rgba(var(--admin-primary-rgb, 0,119,204), 1); border-bottom-color: rgba(var(--admin-primary-rgb, 0,119,204), 1); }
.pi-tab svg { opacity: 0.6; }
.pi-tab.active svg { opacity: 1; color: rgba(var(--admin-primary-rgb, 0,119,204), 1); }
.pi-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 10px; font-weight: 600; background: #f3f4f6; color: #6b7280; }
.pi-tab.active .pi-tab-count { background: rgba(var(--admin-primary-rgb, 0,119,204), 0.1); color: rgba(var(--admin-primary-rgb, 0,119,204), 1); }
.pi-tab-content { min-height: 100px; }

/* History table */
.pi-hist-header-row { display: grid; grid-template-columns: 130px 90px 110px 120px 90px 80px 60px 1fr; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #e5e7eb; }
.pi-hist-hcell { font-size: 10px; font-weight: 600; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; }
.pi-hist-body { max-height: 400px; overflow-y: auto; }
.pi-hist-row { display: grid; grid-template-columns: 130px 90px 110px 120px 90px 80px 60px 1fr; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #f3f4f6; align-items: center; transition: background 0.1s; }
.pi-hist-row:hover { background: #fafbfc; }
.pi-hist-row:last-child { border-bottom: none; }
.pi-hist-cell { font-size: 11px; color: #374151; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-hist-date-main { font-size: 11px; font-weight: 500; color: #1f2937; }
.pi-hist-date-time { font-size: 10px; color: #9ca3af; }
.pi-hist-items { font-size: 11px; color: #6b7280; }
.pi-hist-time-cell { font-size: 11px; color: #6b7280; }
.pi-hist-files-cell { font-size: 11px; color: #6b7280; }
.pi-hist-urn-text { font-size: 10px; font-family: 'SF Mono', 'Fira Code', monospace; color: #6b7280; cursor: help; }
.pi-hist-error { display: flex; align-items: center; }
.pi-hist-row-clickable { cursor: pointer; transition: background 0.15s; }
.pi-hist-row-clickable:hover { background: #f8fafc; }
.pi-hist-view-btn { display:inline-flex; align-items:center; justify-content:center; padding:4px 8px; border:1px solid #e5e7eb; border-radius:6px; background:#fff; color:#6b7280; cursor:pointer; transition:all 0.15s; }
.pi-hist-view-btn:hover { color:#0077cc; border-color:#0077cc; background:#eff6ff; }

/* History Detail View */
.pi-hist-detail-section { margin-bottom: 24px; }
.pi-hist-detail-section:last-child { margin-bottom: 0; }
.pi-hist-detail-section-header { display:flex; align-items:center; gap:8px; font-size:13px; font-weight:600; color:#111827; margin-bottom:12px; padding-bottom:8px; border-bottom:1px solid #f3f4f6; }
.pi-hist-detail-section-header .pi-tab-count { font-size:10px; }
.pi-hist-detail-nodes-list { display:flex; flex-direction:column; align-items:stretch; gap:2px; max-height:500px; overflow-y:auto; }
.pi-hist-detail-node { padding:8px 12px; border-radius:6px; transition:background 0.1s; flex-shrink:0; }
.pi-hist-detail-node:hover { background:#f9fafb; }
.pi-hist-detail-node-header { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.pi-hist-detail-node-actions { margin-left:auto; display:flex; align-items:center; gap:2px; flex-shrink:0; }
.pi-hist-detail-control-header { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.pi-hist-detail-node-header .pi-policy-edit-btn,
.pi-hist-detail-node-header .pi-policy-delete-btn,
.pi-hist-detail-control-header .pi-policy-edit-btn,
.pi-hist-detail-control-header .pi-policy-delete-btn { opacity: 0; transition: opacity 0.15s; }
.pi-hist-detail-node:hover .pi-hist-detail-node-header .pi-policy-edit-btn,
.pi-hist-detail-node:hover .pi-hist-detail-node-header .pi-policy-delete-btn,
.pi-hist-detail-control:hover .pi-hist-detail-control-header .pi-policy-edit-btn,
.pi-hist-detail-control:hover .pi-hist-detail-control-header .pi-policy-delete-btn { opacity: 1; }
.pi-hist-detail-node-ref { font-size:10px; font-family:'SF Mono','Fira Code',monospace; color:#6366f1; background:#eff6ff; padding:2px 6px; border-radius:4px; font-weight:600; white-space:nowrap; }
.pi-hist-detail-node-name { font-size:12px; font-weight:500; color:#1f2937; }
.pi-hist-detail-node-desc { font-size:11px; color:#6b7280; margin-top:4px; line-height:1.5; }
.pi-hist-detail-badge { display:inline-flex; font-size:10px; padding:2px 6px; border-radius:4px; font-weight:500; white-space:nowrap; }
.pi-hist-detail-badge-assess { background:#f0fdf4; color:#16a34a; border:1px solid #bbf7d0; }
.pi-hist-detail-controls-list { display:flex; flex-direction:column; align-items:stretch; gap:4px; max-height:500px; overflow-y:auto; }
.pi-hist-detail-control { padding:10px 14px; border:1px solid #f3f4f6; border-radius:8px; transition:all 0.15s; flex-shrink:0; }
.pi-hist-detail-control:hover { border-color:#e5e7eb; background:#fafafa; }
.pi-hist-detail-control-code { font-size:10px; font-family:'SF Mono','Fira Code',monospace; color:#0077cc; background:#eff6ff; padding:2px 6px; border-radius:4px; font-weight:600; }
.pi-hist-detail-control-name { font-size:12px; font-weight:500; color:#1f2937; }
.pi-hist-detail-control-desc { font-size:11px; color:#6b7280; margin-top:6px; line-height:1.5; }
.pi-hist-dist-item { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.pi-hist-dist-label { font-size:11px; color:#374151; width:70px; text-align:right; flex-shrink:0; }
.pi-hist-dist-bar { flex:1; height:8px; background:#f3f4f6; border-radius:4px; overflow:hidden; }
.pi-hist-dist-fill { height:100%; border-radius:4px; transition:width 0.3s; }
.pi-hist-dist-val { font-size:11px; font-weight:600; color:#374151; width:24px; text-align:right; }
.pi-hist-cfg-item { display:inline-flex; align-items:center; gap:4px; padding:4px 10px; background:#f9fafb; border-radius:6px; font-size:11px; }
.pi-hist-cfg-key { color:#9ca3af; font-weight:400; }
.pi-hist-cfg-val { color:#374151; font-weight:500; }

/* History type badges */
.pi-hist-type-badge { display: inline-flex; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.pi-hist-type-framework { background: #eff6ff; color: #2563eb; }
.pi-hist-type-controls { background: #f0fdf4; color: #16a34a; }
.pi-hist-type-both { background: #faf5ff; color: #7c3aed; }

/* History status badges */
.pi-hist-status-badge { display: inline-flex; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.pi-hist-status-generated { background: #fefce8; color: #ca8a04; }
.pi-hist-status-approved { background: #f0fdf4; color: #16a34a; }
.pi-hist-status-warning { background: #fff7ed; color: #ea580c; }
.pi-hist-status-failed { background: #fef2f2; color: #dc2626; }

/* Spin animation for loading */
@keyframes pi-spin-anim { to { transform: rotate(360deg); } }
.pi-spin { animation: pi-spin-anim 1s linear infinite; }

/* Generation Config Modal */
.pi-modal-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); }
.pi-modal { background: #fff; border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,0.15); width: 100%; max-width: 520px; max-height: 85vh; overflow-y: auto; margin: 16px; }
.pi-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid #f3f4f6; }
.pi-modal-header h2 { font-size: 13px; font-weight: 600; color: #111827; margin: 0; }
.pi-modal-header p { font-size: 10px; color: #9ca3af; margin: 2px 0 0; }
.pi-modal-close { padding: 6px; color: #9ca3af; border: none; background: none; border-radius: 8px; cursor: pointer; }
.pi-modal-close:hover { color: #4b5563; }
.pi-modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }
.pi-modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid #f3f4f6; }
.pi-form-label { font-size: 12px; font-weight: 500; color: #374151; display: block; margin-bottom: 6px; }
.pi-form-label span { color: #9ca3af; font-weight: 400; }
.pi-form-hint { font-size: 10px; color: #9ca3af; margin-top: 4px; }
.pi-form-input, .pi-form-select { width: 100%; padding: 8px 12px; font-size: 12px; border: 1px solid #e5e7eb; border-radius: 8px; outline: none; color: #111827; box-sizing: border-box; }
.pi-form-input:focus, .pi-form-select:focus { border-color: var(--admin-primary); box-shadow: 0 0 0 2px rgba(var(--admin-primary-rgb, 0,119,204), 0.1); }
.pi-form-select { background: #fff; cursor: pointer; }

.pi-detail-radio-group { display: flex; flex-direction: column; gap: 8px; }
.pi-radio-option { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 8px; border: 1px solid #e5e7eb; cursor: pointer; transition: all 0.15s; }
.pi-radio-option.active { border-color: rgba(var(--admin-primary-rgb, 0,119,204), 0.3); background: rgba(var(--admin-primary-rgb, 0,119,204), 0.03); }
.pi-radio-option:hover { border-color: #d1d5db; }
.pi-radio-option input[type=radio] { margin-top: 2px; accent-color: var(--admin-primary); }
.pi-radio-option .pi-radio-title { font-size: 12px; font-weight: 500; color: #111827; }
.pi-radio-option .pi-radio-desc { font-size: 10px; color: #6b7280; margin-top: 2px; }


.pi-included-files {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  max-height: 112px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px;
}
.pi-included-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: #f9fafb;
  border-radius: 4px;
  flex-shrink: 0;
}
.pi-included-file span { font-size: 12px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-included-file button { padding: 2px; color: #9ca3af; border: none; background: none; cursor: pointer; flex-shrink: 0; margin-left: 8px; }
.pi-included-file button:hover { color: #ef4444; }

/* Generation Progress */
.pi-progress-card { background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; padding: 32px; }
.pi-progress-inner { max-width: 400px; margin: 0 auto; }
.pi-progress-icon { width: 80px; height: 80px; background: rgba(var(--admin-primary-rgb, 0,119,204), 0.1); border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.pi-progress-icon svg { color: var(--admin-primary); animation: piPulse 2s ease-in-out infinite; }
@keyframes piPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.pi-progress-title { text-align: center; font-size: 13px; font-weight: 600; color: #111827; margin: 0 0 4px; }
.pi-progress-desc { text-align: center; font-size: 10px; color: #9ca3af; margin: 0 0 24px; }

.pi-steps { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.pi-step { display: flex; align-items: center; gap: 12px; }
.pi-step-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.3s; }
.pi-step-icon.done { background: #d1fae5; }
.pi-step-icon.active { background: rgba(var(--admin-primary-rgb, 0,119,204), 0.1); }
.pi-step-icon.pending { background: #f3f4f6; }
.pi-step-icon.done svg { color: #047857; }
.pi-step-icon.active svg { color: var(--admin-primary); }
.pi-step-icon.pending svg { color: #9ca3af; }
.pi-step-label { font-size: 12px; }
.pi-step-label.done { color: #047857; font-weight: 500; }
.pi-step-label.active { color: #111827; font-weight: 500; }
.pi-step-label.pending { color: #9ca3af; }

.pi-progress-bar { width: 100%; height: 8px; background: #e5e7eb; border-radius: 9999px; margin-bottom: 8px; overflow: hidden; }
.pi-progress-fill { height: 100%; background: var(--admin-primary); border-radius: 9999px; transition: width 0.3s; }
.pi-progress-stats { display: flex; align-items: center; justify-content: space-between; font-size: 10px; color: #9ca3af; }

@keyframes piSpin { to { transform: rotate(360deg); } }
.pi-spinner { animation: piSpin 1s linear infinite; }

/* Policy Review */
.pi-review-header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.pi-review-header h1 { font-size: 18px; font-weight: 700; color: #111827; margin: 0; }
.pi-review-header svg { color: var(--admin-primary); }
.pi-review-subtitle { font-size: 12px; color: #6b7280; margin: -12px 0 16px; }

.pi-review-stats { background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; padding: 20px; margin-bottom: 16px; }
.pi-review-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; }
.pi-review-stat-label { font-size: 10px; color: #9ca3af; margin-bottom: 2px; }
.pi-review-stat-value { font-size: 12px; font-weight: 500; color: #111827; }
.pi-confidence { display: flex; align-items: center; gap: 8px; }
.pi-confidence-badge { font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.pi-confidence-high { color: #047857; background: #d1fae5; }
.pi-confidence-mid { color: #b45309; background: #fef3c7; }
.pi-confidence-low { color: #dc2626; background: #fee2e2; }
.pi-confidence-bar { flex: 1; max-width: 60px; height: 6px; background: #e5e7eb; border-radius: 9999px; overflow: hidden; }
.pi-confidence-bar-fill { height: 100%; border-radius: 9999px; }

/* Policy list panel */
.pi-policy-panel { background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; overflow: hidden; margin-bottom: 16px; }
.pi-policy-panel-header { background: var(--admin-navy, #1e293b); padding: 16px 20px; }
.pi-policy-panel-header h3 { color: #fff; font-size: 13px; font-weight: 600; margin: 0 0 2px; display: flex; align-items: center; gap: 8px; }
.pi-policy-panel-header p { color: #94a3b8; font-size: 10px; margin: 0; }
.pi-policy-list { max-height: 450px; overflow-y: auto; }

.pi-policy-item { border-bottom: 1px solid #f3f4f6; }
.pi-policy-item:last-child { border-bottom: none; }
.pi-policy-item-header { display: flex; align-items: center; gap: 12px; padding: 12px 20px; cursor: pointer; transition: background 0.15s; }
.pi-policy-item-header:hover { background: rgba(249,250,251,0.5); }
.pi-policy-toggle { width: 24px; height: 24px; border-radius: 4px; background: rgba(var(--admin-primary-rgb, 0,119,204), 0.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--admin-primary); }
.pi-policy-code { font-size: 10px; font-family: monospace; color: #9ca3af; background: #f3f4f6; padding: 2px 6px; border-radius: 4px; }
.pi-policy-name { font-size: 12px; font-weight: 500; color: #111827; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-policy-tags { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.pi-policy-tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 500; }
.pi-tag-policy { background: #eff6ff; color: #1d4ed8; }
.pi-tag-process { background: #fef3c7; color: #b45309; }
.pi-tag-technical { background: #d1fae5; color: #047857; }
.pi-tag-physical { background: #f3f4f6; color: #374151; }
.pi-tag-govern { background: #f3f4f6; color: #374151; }
.pi-tag-protect { background: #ccfbf1; color: #0f766e; }
.pi-tag-detect { background: #fff7ed; color: #c2410c; }
.pi-tag-respond { background: #fee2e2; color: #dc2626; }
.pi-tag-recover { background: #d1fae5; color: #047857; }
.pi-tag-identify { background: #e0f2fe; color: #0369a1; }
.pi-policy-edit-btn, .pi-policy-delete-btn { padding: 4px; color: #d1d5db; border: none; background: none; border-radius: 4px; cursor: pointer; opacity: 0; transition: all 0.15s; }
.pi-policy-item-header:hover .pi-policy-edit-btn,
.pi-policy-item-header:hover .pi-policy-delete-btn { opacity: 1; }
.pi-policy-edit-btn:hover { color: var(--admin-primary); }
.pi-policy-delete-btn:hover { color: #ef4444; }

.pi-policy-detail { padding: 0 20px 16px 56px; display: none; }
.pi-policy-detail.open { display: block; }
.pi-policy-detail-section { margin-bottom: 12px; }
.pi-policy-detail-label { font-size: 10px; font-weight: 500; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.pi-policy-detail-text { font-size: 12px; color: #4b5563; line-height: 1.5; }
.pi-policy-detail-source { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #4b5563; }
.pi-policy-detail-source svg { color: #9ca3af; }
.pi-policy-detail-source .pages { font-size: 10px; color: #9ca3af; }
.pi-policy-reqs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pi-policy-req-pill { font-size: 10px; background: #f3f4f6; color: #4b5563; padding: 2px 6px; border-radius: 4px; font-family: monospace; }

.pi-add-policy-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; font-size: 12px; color: var(--admin-primary); font-weight: 500; background: none; border: none; cursor: pointer; transition: background 0.15s; }
.pi-add-policy-btn:hover { background: rgba(var(--admin-primary-rgb, 0,119,204), 0.05); }

/* Inline edit form */
.pi-edit-form { padding: 4px 0 8px; }
.pi-edit-row { margin-bottom: 10px; }
.pi-edit-row label { display: block; font-size: 10px; font-weight: 500; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.pi-edit-row .pi-form-input, .pi-edit-row .pi-form-select { width: 100%; font-size: 12px; }
.pi-edit-row textarea.pi-form-input { resize: vertical; min-height: 50px; }
.pi-edit-row-inline { display: flex; gap: 12px; }
.pi-edit-row-inline .pi-edit-row { flex: 1; }
.pi-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #f3f4f6; }

/* Review footer */
.pi-review-footer { display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; padding: 16px 20px; }
.pi-btn-discard { color: #dc2626; border-color: #fecaca; background: #fff; }
.pi-btn-discard:hover { background: #fef2f2; }
.pi-btn-regenerate { color: #4b5563; border-color: #e5e7eb; background: #fff; }
.pi-btn-regenerate:hover { background: #f9fafb; }
.pi-btn-approve { color: #fff; background: #059669; border-color: #059669; }
.pi-btn-approve:hover { background: #047857; }
.pi-btn-approve:disabled { opacity: 0.7; cursor: not-allowed; }
.pi-btn-preview-yaml {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
}
.pi-btn-preview-yaml:hover:not(:disabled) { background: #dbeafe; }
.pi-btn-preview-yaml:disabled { opacity: 0.65; cursor: wait; }

.pi-yaml-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}
.pi-yaml-preview-dialog {
  width: min(920px, 100%);
  max-height: min(86vh, 900px);
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pi-yaml-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  flex-shrink: 0;
}
.pi-yaml-preview-title { font-size: 14px; font-weight: 600; color: #111827; }
.pi-yaml-preview-subtitle { font-size: 11px; color: #6b7280; margin-top: 4px; max-width: 560px; line-height: 1.45; }
.pi-yaml-preview-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pi-btn-preview-yaml-copy {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  color: #374151;
}
.pi-btn-preview-yaml-copy:hover { background: #f9fafb; }
.pi-yaml-preview-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 6px;
}
.pi-yaml-preview-close:hover { background: #f3f4f6; color: #374151; }
.pi-yaml-preview-pre {
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  flex: 1;
  font-size: 11px;
  line-height: 1.45;
  font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace;
  color: #1f2937;
  background: #fafafa;
  border-top: none;
}

/* Success screen */
.pi-success-card { background: #fff; border-radius: 12px; border: 1px solid #e5e7eb; overflow: hidden; }
.pi-success-banner { background: #047857; padding: 20px; }
.pi-success-banner h3 { color: #fff; font-size: 13px; font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.pi-success-banner p { color: #6ee7b7; font-size: 12px; margin: 0; }
.pi-success-body { padding: 24px; }
.pi-success-icon { width: 64px; height: 64px; background: #d1fae5; border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.pi-success-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; max-width: 480px; margin-left: auto; margin-right: auto; }
.pi-success-stat { border-radius: 12px; padding: 16px; text-align: center; border: 1px solid; }
.pi-success-stat-val { font-size: 24px; font-weight: 700; }
.pi-success-stat-label { font-size: 10px; margin-top: 2px; }
.pi-success-stat-green { background: #d1fae5; border-color: #a7f3d0; }
.pi-success-stat-green .pi-success-stat-val { color: #047857; }
.pi-success-stat-green .pi-success-stat-label { color: #059669; }
.pi-success-stat-blue { background: #e0f2fe; border-color: #bae6fd; }
.pi-success-stat-blue .pi-success-stat-val { color: #0369a1; }
.pi-success-stat-blue .pi-success-stat-label { color: #0284c7; }
.pi-success-stat-gray { background: #f9fafb; border-color: #f3f4f6; }
.pi-success-stat-gray .pi-success-stat-val { color: #4b5563; }
.pi-success-stat-gray .pi-success-stat-label { color: #6b7280; }

.pi-success-details { background: #f9fafb; border-radius: 12px; padding: 16px; border: 1px solid #f3f4f6; margin-bottom: 24px; max-width: 480px; margin-left: auto; margin-right: auto; }
.pi-success-detail-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; padding: 4px 0; }
.pi-success-detail-row .label { color: #6b7280; }
.pi-success-detail-row .value { color: #111827; font-weight: 500; }

.pi-success-info { background: #e0f2fe; border-radius: 12px; padding: 16px; border: 1px solid #bae6fd; margin-bottom: 24px; max-width: 480px; margin-left: auto; margin-right: auto; }
.pi-success-info p { font-size: 12px; color: #0c4a6e; line-height: 1.5; margin: 0; }

.pi-success-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-bottom: 16px; }
.pi-success-back { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 12px; color: #9ca3af; background: none; border: none; cursor: pointer; padding: 8px; }
.pi-success-back:hover { color: #4b5563; }

/* Policy edit form in review */
.pi-edit-form { background: #f9fafb; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.pi-edit-form label { font-size: 10px; font-weight: 500; color: #6b7280; display: block; margin-bottom: 4px; }
.pi-edit-form input, .pi-edit-form textarea, .pi-edit-form select { width: 100%; padding: 6px 10px; font-size: 12px; border: 1px solid #e5e7eb; border-radius: 8px; outline: none; box-sizing: border-box; }
.pi-edit-form input:focus, .pi-edit-form textarea:focus, .pi-edit-form select:focus { border-color: var(--admin-primary); }
.pi-edit-form textarea { resize: none; }
.pi-edit-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pi-edit-form-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 768px) {
  .pi-review-stats-grid { grid-template-columns: repeat(3, 1fr); }
  .pi-files-grid { grid-template-columns: 1fr; }
  .pi-success-stats { grid-template-columns: 1fr; }
}

/* ── Confirm Dialog ─────────────────── */
.confirm-dialog-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 0.2s;
}
.confirm-dialog-overlay.active { display: flex; opacity: 1; }
.confirm-dialog {
  background: #fff; border-radius: 16px; padding: 28px 32px 24px;
  max-width: 420px; width: 90%; text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.15);
  transform: scale(0.95); transition: transform 0.2s;
}
.confirm-dialog-overlay.active .confirm-dialog { transform: scale(1); }
.confirm-dialog-icon { margin: 0 auto 16px; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.confirm-dialog-icon.danger { background: #fef2f2; color: #dc2626; }
.confirm-dialog-icon.warning { background: #fffbeb; color: #d97706; }
.confirm-dialog-icon.info { background: #eff6ff; color: #2563eb; }
.confirm-dialog-title { font-size: 15px; font-weight: 600; color: #111827; margin: 0 0 8px; }
.confirm-dialog-message { font-size: 13px; color: #6b7280; margin: 0 0 24px; line-height: 1.6; }
.confirm-dialog-actions { display: flex; gap: 8px; justify-content: center; }
.confirm-dialog-btn {
  padding: 8px 20px; font-size: 13px; font-weight: 500;
  border-radius: 8px; border: 1px solid #e5e7eb; cursor: pointer;
  transition: all 0.15s; font-family: inherit;
}
.confirm-dialog-cancel { background: #fff; color: #374151; }
.confirm-dialog-cancel:hover { background: #f9fafb; border-color: #d1d5db; }
.confirm-dialog-confirm { background: #dc2626; color: #fff; border-color: #dc2626; }
.confirm-dialog-confirm:hover { background: #b91c1c; border-color: #b91c1c; }
.confirm-dialog-confirm.primary { background: var(--admin-primary); border-color: var(--admin-primary); }
.confirm-dialog-confirm.primary:hover { background: #005fa3; border-color: #005fa3; }

/* ---- Chain Resolution: Summary Strip ---- */
.chain-strip {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9); border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 12px 18px; margin-bottom: 14px;
}
.chain-strip-item { display: flex; align-items: baseline; gap: 4px; }
.chain-strip-num { font-size: 20px; font-weight: 800; color: #6366f1; line-height: 1; }
.chain-strip-txt { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.4px; }
.chain-strip-sep { color: #cbd5e1; font-size: 12px; display: flex; align-items: center; }
.chain-strip-warn .chain-strip-num { color: #ef4444; }
.chain-strip-warn .chain-strip-txt { color: #ef4444; }

/* ---- Chain Resolution: Network Graph ---- */
.chain-net-container {
  width: 100%; height: 500px; border: 1px solid #e2e8f0; border-radius: 12px;
  background: #fafbfc; overflow: hidden;
}
.chain-legend {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.chain-legend-item {
  display: flex; align-items: center; gap: 5px; font-size: 11px; color: #64748b; font-weight: 500;
}
.chain-legend-dot {
  width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
}
.chain-toolbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 8px; margin-bottom: 8px; padding: 0 2px;
}
.chain-toolbar-btns { display: flex; gap: 6px; }
.chain-tb-btn {
  font-size: 11px; font-weight: 600; color: #6366f1; background: #eef2ff; border: 1px solid #c7d2fe;
  border-radius: 6px; padding: 4px 10px; cursor: pointer; transition: background 0.15s;
}
.chain-tb-btn:hover { background: #ddd6fe; }

/* Fullscreen overlay */
.chain-fullscreen {
  position: fixed !important; top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: 9999; background: #fff; padding: 16px 20px;
  display: flex; flex-direction: column; box-sizing: border-box;
}
.chain-fullscreen .chain-net-container {
  flex: 1; height: auto !important; border-radius: 8px;
}

/* ---- Chain Loading ---- */
.chain-loading {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 0; color: #6366f1; font-size: 13px; font-weight: 500;
}
.chain-loading .spinner {
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Chain Search ---- */
.chain-toolbar-right {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.chain-search-wrap {
  position: relative; display: flex; align-items: center;
}
.chain-search-icon {
  position: absolute; left: 8px; color: #94a3b8; pointer-events: none; z-index: 1;
}
.chain-search-input {
  width: 200px; padding: 5px 10px 5px 28px; border: 1px solid #e2e8f0; border-radius: 6px;
  font-size: 12px; color: #334155; background: #fff; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.chain-search-input:focus { border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,0.12); }
.chain-search-input::placeholder { color: #94a3b8; }
.chain-search-results {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  max-height: 260px; overflow-y: auto; margin-top: 4px;
}
.chain-sr-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer;
  font-size: 12px; color: #334155; transition: background 0.1s; outline: none;
}
.chain-sr-item:hover, .chain-sr-item:focus { background: #f1f5f9; }
.chain-sr-icon { font-size: 13px; flex-shrink: 0; }
.chain-sr-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chain-sr-type {
  font-size: 9px; font-weight: 600; text-transform: uppercase; color: #94a3b8;
  background: #f1f5f9; padding: 1px 6px; border-radius: 4px; flex-shrink: 0;
}
.chain-sr-empty { padding: 12px; text-align: center; color: #94a3b8; font-size: 12px; }

/* ---- Chain Node Info Panel ---- */
.chain-node-info {
  display: none; position: absolute; top: 8px; right: 8px; z-index: 20;
  width: 280px; max-height: 340px; background: #fff; border: 1px solid #e2e8f0;
  border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.10); overflow: hidden;
}
.cni-header {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px;
  background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
.cni-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.cni-titles { flex: 1; min-width: 0; }
.cni-type { display: block; font-size: 9px; font-weight: 700; text-transform: uppercase; color: #94a3b8; letter-spacing: 0.5px; }
.cni-name { display: block; font-size: 12px; font-weight: 600; color: #1e293b; word-break: break-word; line-height: 1.3; margin-top: 2px; }
.cni-close {
  background: none; border: none; font-size: 14px; color: #94a3b8; cursor: pointer;
  padding: 0; line-height: 1; flex-shrink: 0;
}
.cni-close:hover { color: #ef4444; }
.cni-body { padding: 8px 12px; max-height: 240px; overflow-y: auto; }
.cni-section { margin-bottom: 8px; }
.cni-sec-lbl { display: block; font-size: 10px; font-weight: 700; color: #94a3b8; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.cni-conn {
  display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 5px;
  font-size: 11px; color: #475569; cursor: pointer; transition: background 0.1s; outline: none;
}
.cni-conn:hover, .cni-conn:focus { background: #eef2ff; color: #4338ca; }
.cni-empty { color: #94a3b8; font-size: 11px; }

/* ---- Chain Tabs ---- */
.chain-tabs {
  display: flex; gap: 2px; margin-bottom: 10px;
  border-bottom: 2px solid #e5e7eb; padding-bottom: 0;
}
.chain-tab {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: #94a3b8; background: none; border: none;
  padding: 8px 16px; cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.15s;
}
.chain-tab:hover { color: #6366f1; }
.chain-tab.active { color: #6366f1; border-bottom-color: #6366f1; }
.chain-tab svg { opacity: 0.7; }
.chain-tab.active svg { opacity: 1; }
.chain-panel { }

/* ---- Chain Accordion Tree ---- */
.ct-filter-bar {
  display: flex; align-items: center; gap: 6px; padding: 6px 0 10px;
  border-bottom: 1px solid #f1f5f9; margin-bottom: 8px;
}
.ct-filter-label { font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; }
.ct-filter-btn {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border: 1px solid #e2e8f0;
  border-radius: 6px; background: #fff; color: #64748b; cursor: pointer; transition: all 0.12s;
}
.ct-filter-btn:hover { border-color: #c7d2fe; color: #6366f1; }
.ct-filter-btn.active { background: #6366f1; color: #fff; border-color: #6366f1; }
.ct-coverage-banner {
  display: flex; gap: 12px; padding: 8px 12px; margin: 2px 0 6px;
  background: #f8fafc; border-radius: 6px; border: 1px solid #f1f5f9;
}
.ct-cov-stat { font-size: 11px; color: #64748b; display: flex; align-items: center; gap: 4px; }
.ct-cov-stat span { font-weight: 700; font-size: 13px; }
.ct-cov-ok span { color: #059669; }
.ct-cov-gap span { color: #f97316; }
.ct-cov-risk span { color: #eab308; }
.ct-cov-ctrl span { color: #2563eb; }
.chain-tree { margin-top: 4px; }
.ct-node { border-left: 2px solid transparent; }
.ct-children { display: none; padding-left: 20px; }
.ct-node.open > .ct-children { display: block; }
.ct-chev { flex-shrink: 0; transition: transform 0.15s ease; color: #94a3b8; }
.ct-node.open > .ct-header > .ct-chev { transform: rotate(90deg); }
.ct-icon { font-size: 14px; flex-shrink: 0; }
.ct-lbl { font-size: 13px; font-weight: 500; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-badges { display: flex; gap: 4px; margin-left: auto; flex-shrink: 0; }
.ct-b { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 8px; white-space: nowrap; line-height: 1.4; }
.ct-b-fw   { background: #ede9fe; color: #7c3aed; }
.ct-b-req  { background: #dbeafe; color: #2563eb; }
.ct-b-risk { background: #fef3c7; color: #b45309; }
.ct-b-ctrl { background: #d1fae5; color: #059669; }
.ct-b-dim  { background: #f1f5f9; color: #94a3b8; }
.ct-b-sm   { font-size: 9px; padding: 1px 5px; border-radius: 6px; }
.ct-obj { border-left-color: #6366f1; margin-bottom: 6px; border-radius: 0 10px 10px 0; }
.ct-obj-hdr {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  cursor: pointer; border-radius: 0 10px 10px 0;
  background: linear-gradient(90deg, rgba(99,102,241,.06), transparent); transition: background 0.15s;
}
.ct-obj-hdr:hover { background: linear-gradient(90deg, rgba(99,102,241,.12), transparent); }
.ct-fw { border-left-color: #8b5cf6; margin: 2px 0; border-radius: 0 8px 8px 0; }
.ct-fw-hdr {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  cursor: pointer; border-radius: 0 8px 8px 0;
  background: linear-gradient(90deg, rgba(139,92,246,.04), transparent); transition: background 0.15s;
}
.ct-fw-hdr:hover { background: linear-gradient(90deg, rgba(139,92,246,.10), transparent); }
.ct-progress {
  display: flex; align-items: center; gap: 4px;
  width: 80px; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: visible; position: relative; flex-shrink: 0; margin-left: 6px;
}
.ct-progress-bar { height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); border-radius: 3px; transition: width 0.4s; min-width: 0; }
.ct-progress-txt { font-size: 9px; font-weight: 700; color: #64748b; position: absolute; right: -28px; white-space: nowrap; }
.ct-req { margin: 1px 0; border-left-color: #e5e7eb; }
.ct-req.ct-covered { border-left-color: #22c55e; }
.ct-req.ct-gap { border-left-color: #f97316; }
.ct-req-hdr {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px;
  cursor: pointer; border-radius: 6px; transition: background 0.12s;
}
.ct-req-hdr:hover { background: #f8fafc; }
.ct-req-ref {
  font-size: 10px; font-weight: 700; color: #6366f1; background: #eef2ff;
  padding: 1px 6px; border-radius: 4px; white-space: nowrap; flex-shrink: 0;
}
.ct-req-name { font-size: 12px; color: #475569; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-dot { width: 6px; height: 6px; border-radius: 50%; background: #d1d5db; flex-shrink: 0; margin: 0 2px; }
.ct-gap-tag {
  font-size: 9px; font-weight: 600; color: #f97316; background: #fff7ed;
  padding: 1px 6px; border-radius: 4px; margin-left: auto; white-space: nowrap; flex-shrink: 0;
}
.ct-leaves { padding-left: 24px; padding-bottom: 4px; }
.ct-leaf { display: flex; align-items: center; gap: 6px; padding: 3px 8px; font-size: 12px; color: #475569; border-radius: 5px; }
.ct-leaf:hover { background: #f1f5f9; }
.ct-leaf-ic { font-size: 12px; flex-shrink: 0; }
.ct-leaf-risk { color: #92400e; }
.ct-st { font-size: 9px; font-weight: 600; padding: 1px 6px; border-radius: 4px; margin-left: auto; white-space: nowrap; text-transform: uppercase; }
.ct-st-active { background: #d1fae5; color: #059669; }
.ct-st-prog { background: #dbeafe; color: #2563eb; }
.ct-st-todo { background: #f1f5f9; color: #94a3b8; }

/* ---- Objective ↔ Framework Mapping Grid ---- */
.obj-fw-mapping-grid { margin-top: 4px; }
.obj-fw-map-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.obj-fw-map-table th { background: #f3f4f6; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; padding: 8px 10px; text-align: left; font-size: 10px; border-bottom: 1px solid #e5e7eb; }
.obj-fw-map-table td { padding: 7px 10px; border-bottom: 1px solid #f3f4f6; color: #374151; }
.obj-fw-map-table tr:hover td { background: #f9fafb; }
.obj-fw-map-table input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: #6366f1; }

/* ═══════════════════════════════════════════════════════════════
   WORKBENCH
   ═══════════════════════════════════════════════════════════════ */

.wb-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: #94a3b8; gap: 12px; }
.wb-loading .spinner { width: 32px; height: 32px; border: 3px solid #e2e8f0; border-top-color: #6366f1; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.wb-empty { text-align: center; padding: 48px 20px; color: #94a3b8; font-size: 14px; }

/* Frameworks grid — LTR layout for mixed EN/AR framework metadata */
.wb-frameworks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-top: 8px; direction: ltr; }
.wb-framework-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; cursor: pointer;
  transition: all 0.2s ease; position: relative; overflow: hidden;
  direction: ltr;
  unicode-bidi: isolate;
}
.wb-framework-card:hover { border-color: #6366f1; box-shadow: 0 4px 16px rgba(99,102,241,0.1); transform: translateY(-2px); }
.wb-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-direction: row; }
.wb-card-tab {
  display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px; background: #eef2ff; color: #6366f1;
}
.wb-card-title { font-size: 16px; font-weight: 700; color: #1e293b; margin: 0 0 4px; line-height: 1.4; direction: ltr; text-align: left; }
.wb-card-ref { font-size: 12px; color: #94a3b8; margin: 0 0 8px; font-family: monospace; direction: ltr; text-align: left; }
.wb-card-desc { font-size: 13px; color: #64748b; margin: 0 0 14px; line-height: 1.5; direction: ltr; text-align: left; }
.wb-card-stats { display: flex; gap: 12px; border-top: 1px solid #f1f5f9; padding-top: 12px; flex-direction: row; justify-content: flex-start; }
.wb-stat { font-size: 12px; color: #64748b; }
.wb-stat strong { color: #1e293b; font-weight: 700; }

/* Detail view */
.wb-detail-header { margin-bottom: 20px; direction: ltr; text-align: left; unicode-bidi: isolate; }
.wb-back-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 1px solid #e5e7eb;
  border-radius: 8px; background: #fff; color: #374151; font-size: 13px; font-weight: 500;
  cursor: pointer; margin-bottom: 14px; transition: all 0.15s;
}
.wb-back-btn:hover { border-color: #6366f1; color: #6366f1; }
.wb-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; direction: ltr; justify-content: flex-start; }
#wb-detail .page-title,
#wb-detail .page-subtitle { direction: ltr; text-align: left; }
.wb-meta-chip {
  display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 500;
  background: #f1f5f9; color: #475569;
}

/* Search bar */
.wb-search-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid #e5e7eb;
  border-radius: 10px; background: #fff; margin-bottom: 16px;
}
.wb-search-bar svg { flex-shrink: 0; color: #94a3b8; }
.wb-search-bar .admin-form-input { border: none; outline: none; padding: 4px 0; font-size: 14px; flex: 1; }

/* Tree */
.wb-tree-container { padding-bottom: 40px; }
.wb-node { margin-bottom: 6px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; }
.wb-depth-1 { border-color: #c7d2fe; background: #fafbff; }
.wb-depth-2 { border-color: #ddd6fe; background: #faf5ff; }
.wb-depth-3 { border-color: #e0e7ff; background: #f8fafc; }
.wb-depth-4 { border-color: #e2e8f0; background: #fff; }
.wb-node-header {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 9px; cursor: pointer;
  transition: background 0.15s;
}
.wb-node-header:hover { background: rgba(99,102,241,0.04); }
.wb-node-toggle {
  display: flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border: none; background: transparent; cursor: pointer; border-radius: 4px; transition: all 0.15s;
  padding: 0; flex-shrink: 0;
}
.wb-node-toggle svg { transition: transform 0.2s; transform: rotate(90deg); }
.wb-node-toggle.collapsed svg { transform: rotate(0deg); }
.wb-node-toggle:hover { background: #e2e8f0; }
.wb-node-bullet { width: 6px; height: 6px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; margin: 0 8px; }
.wb-node-ref { font-family: monospace; font-size: 12px; font-weight: 700; color: #6366f1; white-space: nowrap; }
.wb-node-name { font-size: 14px; color: #1e293b; flex: 1; direction: rtl; text-align: right; }
.wb-node-description { font-size: 13px; color: #64748b; padding: 0 12px 8px 44px; line-height: 1.5; direction: rtl; text-align: right; }

/* Depth indentation — nested inside parent borders */
.wb-depth-1 > .wb-node-header .wb-node-name { font-size: 16px; font-weight: 700; }
.wb-depth-2 > .wb-node-header .wb-node-name { font-size: 15px; font-weight: 600; }

/* Badges */
.wb-badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.3px; white-space: nowrap;
}
.wb-badge-assessable { background: #ecfdf5; color: #059669; }
.wb-badge-questions { background: #eef2ff; color: #6366f1; }
.wb-badge-type { background: #f1f5f9; color: #64748b; text-transform: uppercase; }
.wb-badge-ai { background: #ede9fe; color: #7c3aed; }
.wb-badge-manual { background: #f0fdf4; color: #16a34a; }
.wb-badge-subtype { text-transform: capitalize; }
.wb-badge-subtype-note { background: #f1f5f9; color: #475569; }
.wb-badge-subtype-auditor_comment { background: #fef3c7; color: #92400e; }
.wb-badge-subtype-internal_guidance { background: #dbeafe; color: #1e40af; }
.wb-badge-subtype-historical_finding { background: #fce7f3; color: #9d174d; }
.wb-badge-subtype-other { background: #f5f3ff; color: #6d28d9; }

/* Node children */
.wb-node-children { overflow: hidden; max-height: 50000px; transition: max-height 0.3s ease; padding: 0 8px 8px; }
.wb-node-children.collapsed { max-height: 0; overflow: hidden; padding-bottom: 0; }

/* Assessable node content: questions + evidence */
.wb-node-content {
  margin: 4px 12px 10px 12px; padding: 14px 16px; border-radius: 10px;
  background: #f8f9fc; border: 1px solid #eef0f4;
}
.wb-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: #6366f1; margin: 0 0 10px; display: flex; align-items: center; gap: 6px;
}
.wb-section-label::before {
  content: ''; display: inline-block; width: 3px; height: 14px; border-radius: 2px; background: #6366f1;
}

/* Questions */
.wb-questions-list { display: flex; flex-direction: column; gap: 8px; }
.wb-question { padding: 10px 12px; border-radius: 8px; background: #fff; border: 1px solid #e5e7eb; }
.wb-question-header { display: flex; align-items: flex-start; gap: 10px; }
.wb-question-num {
  display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 22px;
  border-radius: 6px; background: #eef2ff; color: #6366f1; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.wb-question-text { font-size: 13px; color: #1e293b; direction: rtl; text-align: right; line-height: 1.6; flex: 1; }
.wb-choices { display: flex; gap: 6px; margin-top: 8px; padding-left: 38px; }
.wb-choice {
  padding: 2px 10px; border-radius: 14px; font-size: 11px; font-weight: 600;
}
.wb-choice-yes { background: #ecfdf5; color: #059669; }
.wb-choice-no { background: #fef2f2; color: #ef4444; }
.wb-choice-partial { background: #fffbeb; color: #d97706; }

/* Evidence */
.wb-evidence-section { margin-top: 14px; }
.wb-evidence-text { font-size: 13px; color: #374151; direction: rtl; text-align: right; line-height: 1.7; }
.wb-evidence-item { padding: 6px 0; border-bottom: 1px solid #f1f5f9; }
.wb-evidence-item:last-child { border-bottom: none; }
.wb-evidence-item strong { color: #1e293b; }

/* Open-req button on tree nodes */
.wb-open-req-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 6px;
  border: 1px solid #c7d2fe; background: #eef2ff; color: #6366f1; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; white-space: nowrap; margin-left: 4px;
}
.wb-open-req-btn:hover { background: #6366f1; color: #fff; border-color: #6366f1; }
.wb-open-req-btn svg { width: 10px; height: 10px; }

/* ── Requirement Detail Panel ── */

.wb-req-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.wb-req-save-group { display: flex; align-items: center; gap: 10px; }
.wb-req-dirty-badge {
  display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: #fef3c7; color: #d97706;
}
.wb-req-identity { margin-bottom: 24px; padding: 16px 20px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 12px; }
.wb-req-ref {
  display: inline-block; font-family: monospace; font-size: 13px; font-weight: 700; color: #6366f1;
  background: #eef2ff; padding: 2px 10px; border-radius: 6px; margin-bottom: 8px;
}
.wb-breadcrumb-trail { font-family: inherit; font-size: 12px; font-weight: 500; color: #64748b; }
.wb-breadcrumb-trail .wb-breadcrumb-sep { color: #cbd5e1; margin: 0 4px; }
.wb-req-name { font-size: 18px; font-weight: 700; color: #1e293b; margin: 0 0 6px; direction: rtl; text-align: right; line-height: 1.5; }
.wb-req-desc { font-size: 14px; color: #64748b; margin: 0; direction: rtl; text-align: right; line-height: 1.6; }

.wb-req-sections { display: flex; flex-direction: column; gap: 20px; }
.wb-req-section {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px 20px;
}
.wb-req-section-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 1px solid #f1f5f9;
}
.wb-req-section-title {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700;
  color: #1e293b; margin: 0;
}
.wb-req-section-title svg { color: #6366f1; }
.wb-section-actions { display: flex; gap: 6px; align-items: center; }
.wb-req-add-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 7px;
  border: 1px dashed #c7d2fe; background: #fafaff; color: #6366f1; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.wb-req-add-btn:hover { background: #eef2ff; border-style: solid; }
.wb-req-regen-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 7px;
  border: 1px solid #fbbf24; background: #fffbeb; color: #92400e; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.wb-req-regen-btn:hover { background: #fef3c7; border-color: #f59e0b; }
.wb-req-regen-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.wb-req-regen-btn svg { color: #d97706; }

.wb-req-items { display: flex; flex-direction: column; gap: 8px; }
.wb-req-empty { text-align: center; padding: 24px 16px; color: #94a3b8; font-size: 13px; font-style: italic; }

.wb-req-item {
  border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; background: #fafbfc;
  transition: border-color 0.15s;
}
.wb-req-item:hover { border-color: #c7d2fe; }
.wb-req-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.wb-req-item-num {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px;
  border-radius: 6px; background: #eef2ff; color: #6366f1; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.wb-req-item-type { font-size: 11px; color: #94a3b8; font-family: monospace; }
.wb-req-item-ev-title { font-size: 13px; font-weight: 600; color: #1e293b; flex: 1; direction: rtl; text-align: right; }
.wb-req-item-note-date { font-size: 11px; color: #94a3b8; }
.wb-req-item-actions { display: flex; gap: 4px; margin-left: auto; }
.wb-req-edit-btn, .wb-req-delete-btn {
  display: flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; cursor: pointer; transition: all 0.15s;
  padding: 0; color: #64748b;
}
.wb-req-edit-btn:hover { border-color: #6366f1; color: #6366f1; background: #eef2ff; }
.wb-req-delete-btn:hover { border-color: #ef4444; color: #ef4444; background: #fef2f2; }
.wb-req-item-body { font-size: 13px; color: #374151; line-height: 1.6; direction: rtl; text-align: right; }
.wb-req-item-choices { display: flex; gap: 6px; margin-top: 8px; }

/* Scope toggle (AI include / exclude — high visibility) */
.wb-scope-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 2px solid #10b981; border-radius: 8px;
  background: linear-gradient(165deg, #ecfdf5 0%, #a7f3d0 100%);
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  padding: 0; color: #047857; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}
.wb-scope-toggle svg { width: 18px; height: 18px; flex-shrink: 0; }
.wb-scope-toggle:hover {
  border-color: #059669;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transform: translateY(-1px);
}
.wb-scope-toggle:active { transform: translateY(0); }
.wb-scope-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.45), 0 2px 6px rgba(5, 150, 105, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}
.wb-scope-toggle.wb-scope-off {
  background: linear-gradient(165deg, #fef2f2 0%, #fecaca 100%);
  color: #b91c1c; border-color: #f87171;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}
.wb-scope-toggle.wb-scope-off:hover {
  border-color: #ef4444;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.wb-scope-toggle.wb-scope-off:focus-visible {
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.55), 0 2px 6px rgba(239, 68, 68, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

/* Excluded item styling */
.wb-req-item-excluded { opacity: 0.5; border-style: dashed; }
.wb-req-item-excluded .wb-req-item-body { text-decoration: line-through; text-decoration-color: #cbd5e1; }

/* ── Item metadata ── */
.wb-item-meta {
  font-size: 10.5px; color: #94a3b8; white-space: nowrap;
}

/* ── Bilingual layout ── */
.wb-bilingual { display: flex; flex-direction: column; gap: 4px; }
.wb-lang-ar { font-size: 13px; color: #1e293b; line-height: 1.65; direction: rtl; text-align: right; }
.wb-lang-en-wrap { display: flex; align-items: flex-start; gap: 6px; }
.wb-lang-en-wrap.wb-collapsed .wb-lang-en { display: none; }
.wb-lang-toggle {
  flex-shrink: 0; padding: 1px 6px; border-radius: 4px; border: 1px solid #e2e8f0;
  background: #f8fafc; color: #64748b; font-size: 10px; font-weight: 700; cursor: pointer;
  transition: all 0.15s;
}
.wb-lang-toggle:hover { background: #eef2ff; border-color: #c7d2fe; color: #6366f1; }
.wb-lang-en { font-size: 12.5px; color: #64748b; line-height: 1.6; direction: ltr; text-align: left; }

/* ── Editor rows ── */
.wb-editor-row { margin-bottom: 10px; }
.wb-editor-label {
  display: block; font-size: 11.5px; font-weight: 600; color: #475569;
  margin-bottom: 4px; letter-spacing: 0.2px;
}
.wb-required { color: #ef4444; }
.wb-optional { color: #94a3b8; font-weight: 400; }
.wb-inline-select {
  padding: 6px 10px; border: 1px solid #e5e7eb; border-radius: 7px; font-size: 13px;
  color: #1e293b; background: #fff; cursor: pointer;
}
.wb-inline-select:focus { border-color: #6366f1; outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.wb-subtype-label-input { margin-left: 8px; }
.wb-ar-input { direction: rtl; text-align: right; font-family: inherit; }

/* ── AI Generation Panel ── */
.wb-gen-panel {
  background: #fff; border: 1px solid #e0e7ff; border-radius: 12px; margin-bottom: 20px;
  overflow: hidden;
}
.wb-gen-header {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 18px;
  cursor: pointer; transition: background 0.15s;
}
.wb-gen-header:hover { background: #fafaff; }
.wb-gen-header-left { display: flex; align-items: center; gap: 10px; color: #6366f1; }
.wb-gen-title { font-size: 14px; font-weight: 700; color: #1e293b; margin: 0; }
.wb-gen-subtitle { font-size: 12px; color: #94a3b8; margin: 0; }
.wb-gen-toggle-btn {
  display: flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; cursor: pointer;
  color: #64748b; transition: all 0.15s; padding: 0;
}
.wb-gen-toggle-btn:hover { border-color: #6366f1; color: #6366f1; }
.wb-gen-chevron { transition: transform 0.2s; }
.wb-gen-chevron-open { transform: rotate(180deg); }
.wb-gen-body { padding: 0 18px 18px; border-top: 1px solid #f1f5f9; }
.wb-gen-field { margin-top: 14px; }
.wb-gen-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.wb-gen-optional { font-weight: 400; color: #94a3b8; }
.wb-gen-textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 13px;
  line-height: 1.6; resize: vertical; min-height: 60px; background: #fafbfc; color: #1e293b;
  font-family: inherit; transition: border-color 0.15s;
}
.wb-gen-textarea:focus { border-color: #6366f1; outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.wb-gen-char-count { display: block; text-align: right; font-size: 11px; color: #94a3b8; margin-top: 4px; }
.wb-gen-options { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.wb-gen-checkbox-label {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: #374151; cursor: pointer;
}
.wb-gen-checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: #6366f1; cursor: pointer; }
.wb-gen-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.wb-gen-run-btn { display: inline-flex; align-items: center; gap: 6px; }
.spinner-sm { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
.wb-gen-status { font-size: 12px; color: #94a3b8; }
.wb-gen-status-ok { color: #059669; }
.wb-gen-status-err { color: #ef4444; }

/* ── Inline Editor ── */
.wb-inline-editor {
  margin-top: 10px; padding: 12px; border: 2px solid #c7d2fe; border-radius: 10px;
  background: #fafaff; animation: wbSlideIn 0.15s ease;
}
@keyframes wbSlideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.wb-inline-title {
  width: 100%; padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 7px;
  font-size: 13px; margin-bottom: 8px; background: #fff; color: #1e293b;
}
.wb-inline-title:focus { border-color: #6366f1; outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.wb-inline-textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 7px;
  font-size: 13px; line-height: 1.6; resize: vertical; min-height: 60px; background: #fff;
  color: #1e293b; direction: rtl; text-align: right; font-family: inherit;
}
.wb-inline-textarea:focus { border-color: #6366f1; outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.wb-input-error { border-color: #ef4444 !important; }
.wb-inline-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ── Replace Confirmation Modal ── */
.wb-confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  animation: wbFadeIn 0.15s ease;
}
@keyframes wbFadeIn { from { opacity: 0; } to { opacity: 1; } }
.wb-confirm-modal {
  background: #fff; border-radius: 14px; padding: 28px 32px; max-width: 460px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2); animation: wbSlideUp 0.2s ease;
}
@keyframes wbSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.wb-confirm-icon { text-align: center; margin-bottom: 12px; }
.wb-confirm-title { font-size: 17px; font-weight: 700; color: #1e293b; margin: 0 0 10px; text-align: center; }
.wb-confirm-body { font-size: 13.5px; color: #475569; line-height: 1.65; }
.wb-confirm-body p { margin: 0 0 10px; }
.wb-confirm-warnings {
  margin: 10px 0 0; padding: 0 0 0 18px; list-style: disc;
}
.wb-confirm-warnings li { margin-bottom: 5px; font-size: 13px; color: #64748b; }
.wb-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn-admin-danger {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px;
  background: #dc2626; color: #fff; border: none; border-radius: 8px; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-admin-danger:hover { background: #b91c1c; }

/* ── Job Indicator ── */
.wb-jobs-indicator {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 4px 8px;
  background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 8px; cursor: default;
}
.wb-jobs-icon { flex-shrink: 0; }
.wb-jobs-spinner { width: 14px; height: 14px; border-width: 2px; border-color: rgba(99,102,241,0.25); border-top-color: #6366f1; }
.wb-jobs-info { display: flex; flex-direction: column; min-width: 0; }
.wb-jobs-label { font-size: 11.5px; font-weight: 600; color: #4338ca; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-jobs-detail { font-size: 10.5px; color: #6366f1; }
.wb-gen-status-bg { color: #6366f1; font-weight: 600; }

/* ── View Toggle Toolbar ── */
.wb-view-toolbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.wb-view-toggle {
  display: flex; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #f8fafc;
}
.wb-view-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px;
  font-size: 12.5px; font-weight: 500; color: #64748b; background: transparent;
  border: none; cursor: pointer; transition: all 0.15s;
}
.wb-view-btn:hover { background: #f1f5f9; color: #334155; }
.wb-view-btn.active {
  background: #6366f1; color: #fff; box-shadow: 0 1px 3px rgba(99,102,241,0.3);
}
.wb-view-btn + .wb-view-btn { border-left: 1px solid #e2e8f0; }
.wb-view-btn.active + .wb-view-btn,
.wb-view-btn + .wb-view-btn.active { border-left-color: transparent; }

/* ── Status Summary Cards ── */
.wb-status-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px;
}
.wb-summary-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 18px 12px; border-radius: 12px; border: 1px solid #e2e8f0; background: #fff;
}
.wb-summary-num { font-size: 28px; font-weight: 700; line-height: 1; }
.wb-summary-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.wb-summary-full { border-color: #bbf7d0; background: #f0fdf4; }
.wb-summary-full .wb-summary-num { color: #16a34a; }
.wb-summary-full .wb-summary-label { color: #15803d; }
.wb-summary-partial { border-color: #fde68a; background: #fffbeb; }
.wb-summary-partial .wb-summary-num { color: #d97706; }
.wb-summary-partial .wb-summary-label { color: #b45309; }
.wb-summary-empty { border-color: #fecaca; background: #fef2f2; }
.wb-summary-empty .wb-summary-num { color: #dc2626; }
.wb-summary-empty .wb-summary-label { color: #b91c1c; }
.wb-summary-total { border-color: #c7d2fe; background: #eef2ff; }
.wb-summary-total .wb-summary-num { color: #4f46e5; }
.wb-summary-total .wb-summary-label { color: #4338ca; }

/* ── Status Filters ── */
.wb-status-filters {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.wb-status-select {
  padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 7px; font-size: 12.5px;
  color: #334155; background: #fff; cursor: pointer;
}
.wb-status-select:focus { border-color: #6366f1; outline: none; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

/* ── Bulk Actions ── */
.wb-bulk-actions {
  display: flex; align-items: center; gap: 10px; margin-left: auto;
}
.wb-bulk-count {
  font-size: 12px; font-weight: 600; color: #6366f1; background: #eef2ff;
  padding: 4px 10px; border-radius: 6px;
}
.wb-bulk-gen-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }

/* ── Progress Bar ── */
.wb-status-progress { margin-bottom: 14px; display: flex; align-items: center; gap: 12px; }
.wb-progress-bar {
  flex: 1; height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden;
}
.wb-progress-fill {
  height: 100%; background: linear-gradient(90deg, #6366f1, #818cf8); border-radius: 4px;
  transition: width 0.3s ease; width: 0%;
}
.wb-progress-text { font-size: 12px; color: #64748b; white-space: nowrap; min-width: 140px; }

/* ── Bulk Steering ── */
.wb-bulk-steering {
  margin-bottom: 14px; padding: 14px 16px; border: 1px solid #e0e7ff; border-radius: 10px;
  background: #fafaff;
}

/* ── Bulk Results ── */
.wb-bulk-results {
  margin-bottom: 16px; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden;
  max-height: 260px; overflow-y: auto; background: #fff;
}
.wb-results-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  color: #64748b; padding: 10px 14px; margin: 0; background: #f8fafc;
  border-bottom: 1px solid #e2e8f0; position: sticky; top: 0;
}
.wb-result-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 14px;
  font-size: 12.5px; border-bottom: 1px solid #f1f5f9;
}
.wb-result-row:last-child { border-bottom: none; }
.wb-result-ok { color: #16a34a; }
.wb-result-fail { color: #dc2626; }
.wb-result-ref { font-weight: 600; font-family: monospace; min-width: 80px; }
.wb-result-detail { color: #64748b; }
.wb-result-error { color: #dc2626; font-size: 11.5px; }

/* ── Status Table ── */
.wb-status-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden;
  font-size: 13px; background: #fff;
}
.wb-status-table thead th {
  background: #f8fafc; color: #64748b; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.4px; padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0; text-align: left;
}
.wb-status-table tbody td {
  padding: 10px 12px; border-bottom: 1px solid #f1f5f9; color: #334155;
}
.wb-status-table tbody tr:last-child td { border-bottom: none; }
.wb-status-table tbody tr:hover { background: #f8fafc; }
.wb-st-check { width: 32px; text-align: center; }
.wb-st-check input[type="checkbox"] { cursor: pointer; }
.wb-st-ref { width: 90px; font-weight: 600; font-family: monospace; font-size: 12px; color: #6366f1; }
.wb-st-name { min-width: 200px; }
.wb-st-name-text { display: block; }
.wb-st-parent-label {
  display: inline-block; font-size: 10.5px; color: #94a3b8; background: #f1f5f9;
  padding: 1px 6px; border-radius: 4px; margin-top: 3px;
}
.wb-st-q, .wb-st-e, .wb-st-n { width: 70px; text-align: center; font-weight: 500; }
.wb-st-status { width: 80px; }
.wb-st-action { width: 40px; text-align: center; }
.wb-st-edit-btn {
  background: none; border: none; cursor: pointer; color: #64748b; padding: 4px;
  border-radius: 5px; transition: all 0.15s;
}
.wb-st-edit-btn:hover { background: #eef2ff; color: #6366f1; }
.wb-st-empty { text-align: center; padding: 30px 12px !important; color: #94a3b8; }

/* ── Status Chips ── */
.wb-status-chip {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
}
.wb-status-full { background: #dcfce7; color: #16a34a; }
.wb-status-partial { background: #fef9c3; color: #b45309; }
.wb-status-empty { background: #fee2e2; color: #dc2626; }

/* Responsive */
@media (max-width: 768px) {
  .wb-frameworks-grid { grid-template-columns: 1fr; }
  .wb-node-children { padding: 0 4px 4px; }
  .wb-node-content { margin: 4px 8px 8px; }
  .wb-req-topbar { flex-direction: column; align-items: stretch; }
  .wb-req-save-group { justify-content: flex-end; }
  .wb-status-summary { grid-template-columns: repeat(2, 1fr); }
  .wb-status-filters { flex-direction: column; align-items: stretch; }
  .wb-bulk-actions { margin-left: 0; }
  .wb-view-toolbar { flex-direction: column; align-items: stretch; }
}

/* ═══════════════════════════════════════════════════════════════
   AUDIT LOG
   ═══════════════════════════════════════════════════════════════ */

.al-search-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 20px;
}
.al-search-bar svg { color: #94a3b8; flex-shrink: 0; }
.al-search-input {
  flex: 1; border: none; background: transparent; font-size: 14px; color: #1e293b;
  outline: none; padding: 4px 0;
}

.al-loading {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  padding: 40px 20px; color: #64748b; font-size: 14px;
}
.al-error {
  padding: 20px; text-align: center; color: #ef4444; font-size: 13px;
  background: #fef2f2; border-radius: 8px;
}
.al-empty {
  padding: 40px 20px; text-align: center; color: #94a3b8; font-size: 14px; font-style: italic;
}

/* CA Grid */
.al-ca-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px;
}
.al-ca-card {
  border: 1px solid #e2e8f0; border-radius: 12px; padding: 18px 20px; background: #fff;
  cursor: pointer; transition: all 0.15s;
}
.al-ca-card:hover { border-color: #818cf8; box-shadow: 0 2px 12px rgba(99,102,241,0.08); transform: translateY(-1px); }
.al-ca-card-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.al-ca-card-title { font-size: 15px; font-weight: 700; color: #1e293b; flex: 1; line-height: 1.3; margin: 0; }
.al-ca-card-meta { display: flex; flex-wrap: wrap; gap: 10px; }
.al-ca-meta-item {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #64748b;
}
.al-ca-meta-item svg { color: #94a3b8; }

.al-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.al-badge-locked { background: #fef3c7; color: #92400e; }

/* RA Header */
.al-ra-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}
.al-back-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid #e2e8f0; background: #fff; color: #475569; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.al-back-btn:hover { border-color: #818cf8; color: #4f46e5; }
.al-ra-header-info { flex: 1; }
.al-ra-title { font-size: 18px; font-weight: 700; color: #1e293b; margin: 0; }
.al-ra-subtitle { font-size: 13px; color: #64748b; }

/* RA Toolbar */
.al-ra-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px;
}
.al-ra-filters { display: flex; gap: 8px; }
.al-filter-select {
  padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 7px; background: #fff;
  font-size: 12px; color: #475569; cursor: pointer;
}
.al-ra-search-wrap {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid #e2e8f0;
  border-radius: 7px; background: #f8fafc; flex: 1; min-width: 200px;
}
.al-ra-search-wrap svg { color: #94a3b8; flex-shrink: 0; }
.al-ra-search-wrap .al-search-input { font-size: 13px; }
.al-ra-stats {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: #64748b;
}
.al-stat-total { font-weight: 700; color: #1e293b; }
.al-stat-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--chip-color) 12%, transparent); color: var(--chip-color);
  font-weight: 600; font-size: 11px;
}

/* RA Table */
.al-ra-table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 12px; }
.al-ra-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.al-ra-table thead { background: #f8fafc; }
.al-ra-table th {
  padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700;
  color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid #e2e8f0;
}
.al-ra-table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; }
.al-ra-row { cursor: pointer; transition: background 0.1s; }
.al-ra-row:hover { background: #f8fafc; }
.al-th-ref { width: 90px; }
.al-th-name { min-width: 200px; }
.al-th-status { width: 100px; }
.al-th-result { width: 130px; }
.al-th-evidence, .al-th-controls { width: 70px; text-align: center; }
.al-th-date { width: 90px; }
.al-td-ref { white-space: nowrap; }
.al-td-name { color: #1e293b; font-weight: 500; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-td-count { text-align: center; color: #64748b; }
.al-td-date { color: #94a3b8; font-size: 12px; white-space: nowrap; }

.al-ref-badge {
  display: inline-block; padding: 2px 8px; border-radius: 5px; background: #eef2ff;
  color: #4f46e5; font-size: 12px; font-weight: 700; font-family: 'SF Mono', monospace;
}
.al-status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 700;
  background: color-mix(in srgb, var(--badge-color) 14%, transparent); color: var(--badge-color);
}
.al-result-badge {
  display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: color-mix(in srgb, var(--badge-color) 14%, transparent); color: var(--badge-color);
}

/* RA Detail */
.al-detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.al-detail-card {
  border: 1px solid #e2e8f0; border-radius: 12px; padding: 18px 20px; background: #fff;
}
.al-detail-card-wide { grid-column: 1 / -1; }
.al-detail-card-title {
  font-size: 14px; font-weight: 700; color: #1e293b; margin: 0 0 14px 0;
  padding-bottom: 10px; border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; gap: 8px;
}
.al-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: #eef2ff; color: #4f46e5; font-size: 11px; font-weight: 700;
}
.al-detail-field { margin-bottom: 10px; }
.al-detail-field label {
  display: block; font-size: 11px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 3px;
}
.al-detail-field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.al-detail-desc {
  font-size: 13px; color: #475569; line-height: 1.6; margin: 0;
  white-space: pre-wrap; word-break: break-word;
}
.al-mono { font-family: 'SF Mono', 'Menlo', monospace; font-size: 12px; color: #64748b; word-break: break-all; }
.al-muted { color: #94a3b8; }
.al-ext-result { text-transform: capitalize; color: #475569; font-size: 13px; }

.al-answers-list { display: flex; flex-direction: column; gap: 8px; }
.al-answer-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 8px 12px;
  background: #f8fafc; border-radius: 8px;
}
.al-answer-q { flex: 1; font-size: 13px; color: #1e293b; }
.al-answer-a {
  padding: 2px 10px; border-radius: 6px; background: #eef2ff; color: #4f46e5;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}

.al-linked-list { display: flex; flex-direction: column; gap: 6px; }
.al-linked-item {
  padding: 8px 12px; background: #f8fafc; border-radius: 8px; font-size: 13px; color: #475569;
  border: 1px solid #f1f5f9;
}

/* Audit Log Timeline */
.al-audit-log-card { max-height: none; }
.al-timeline { display: flex; flex-direction: column; gap: 0; position: relative; }

.al-timeline-entry {
  display: flex; gap: 14px; position: relative; padding-bottom: 20px;
}
.al-timeline-entry:last-child { padding-bottom: 0; }
.al-timeline-entry::before {
  content: ''; position: absolute; left: 15px; top: 32px; bottom: 0;
  width: 2px; background: #e2e8f0;
}
.al-timeline-entry:last-child::before { display: none; }

.al-timeline-dot {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--dot-color) 14%, #fff);
  border: 2px solid var(--dot-color); color: var(--dot-color);
  z-index: 1;
}
.al-timeline-body { flex: 1; min-width: 0; }
.al-timeline-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap;
}
.al-log-actor {
  font-size: 13px; font-weight: 700; color: #1e293b;
}
.al-log-actor-ai {
  color: #7c3aed;
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  padding: 1px 8px; border-radius: 5px;
}
.al-log-action-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 5px;
  background: color-mix(in srgb, var(--badge-color) 14%, transparent); color: var(--badge-color);
}
.al-log-time { font-size: 12px; color: #94a3b8; margin-left: auto; }

.al-log-changes {
  display: flex; flex-direction: column; gap: 4px;
  background: #f8fafc; border: 1px solid #f1f5f9; border-radius: 8px; padding: 10px 12px;
}
.al-log-change-row {
  display: flex; align-items: flex-start; gap: 8px; font-size: 13px;
}
.al-log-field {
  font-weight: 600; color: #475569; text-transform: capitalize; min-width: 100px;
  flex-shrink: 0; font-size: 12px;
}
.al-log-old {
  color: #94a3b8; max-width: 250px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; text-decoration: line-through; font-size: 12px;
}
.al-log-arrow { color: #cbd5e1; flex-shrink: 0; margin-top: 2px; }
.al-log-new {
  color: #1e293b; font-weight: 500; max-width: 250px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-size: 12px;
}

.al-log-ai-meta {
  margin-top: 6px; padding: 8px 12px; background: #f5f3ff; border: 1px solid #ede9fe;
  border-radius: 8px; display: flex; flex-direction: column; gap: 4px;
}
.al-log-ai-desc { font-size: 13px; color: #5b21b6; }
.al-log-ai-fields { font-size: 11px; color: #7c3aed; font-family: 'SF Mono', monospace; }
.al-log-folder { font-size: 12px; color: #64748b; margin-top: 4px; }

@media (max-width: 768px) {
  .al-detail-grid { grid-template-columns: 1fr; }
  .al-ra-toolbar { flex-direction: column; align-items: stretch; }
  .al-ra-filters { flex-wrap: wrap; }
  .al-ca-grid { grid-template-columns: 1fr; }
  .al-log-change-row { flex-wrap: wrap; }
  .al-log-old, .al-log-new { max-width: 100%; }
}

/* ─── Data Studio (Excel import) ───────────────────────────── */
#page-data-studio .page-container {
  max-width: min(1540px, 100%);
  padding: 28px clamp(16px, 2.75vw, 40px) 48px;
  margin: 0 auto;
}
#page-data-studio .page-header {
  margin-bottom: 26px;
}
#page-data-studio .page-title {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}
#page-data-studio .page-subtitle {
  max-width: 56rem;
  line-height: 1.5;
}

/* Merged surface: hub tabs + pane read as one workspace */
.ds-shell {
  background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 52%, #eef2f6 100%);
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: clamp(16px, 2vw, 26px) clamp(16px, 2.4vw, 32px) clamp(20px, 2.6vw, 32px);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 10px 32px -16px rgba(15, 23, 42, 0.1);
}

.ds-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 1.75vw, 20px);
  margin: 0 0 22px;
  padding: 4px 2px 24px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}
@media (max-width: 900px) {
  .ds-hub-grid {
    grid-template-columns: 1fr;
  }
  #page-data-studio .page-container {
    padding-top: 20px;
    padding-bottom: 36px;
  }
  .ds-shell {
    padding: 14px 14px 20px;
    border-radius: 14px;
  }
  .ds-hub-card:hover {
    transform: none;
  }
  #page-data-studio .admin-card > *:not(.admin-card-header):last-child {
    padding-bottom: 20px;
  }
}
.ds-hub-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  margin: 0;
  padding: 18px 20px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s, transform 0.12s;
}
.ds-hub-card:hover {
  border-color: rgba(var(--admin-primary-rgb, 0, 119, 204), 0.38);
  box-shadow: 0 4px 18px -8px rgba(15, 23, 42, 0.14);
  transform: translateY(-1px);
}
.ds-hub-card:focus-visible {
  outline: 2px solid rgba(var(--admin-primary-rgb, 0, 119, 204), 0.55);
  outline-offset: 2px;
}
.ds-hub-card.is-active {
  border-color: rgba(var(--admin-primary-rgb, 0, 119, 204), 0.5);
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(var(--admin-primary-rgb, 0, 119, 204), 0.12),
    0 6px 20px -10px rgba(var(--admin-primary-rgb, 0, 119, 204), 0.28);
}
.ds-hub-card .ds-hub-card-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ds-hub-card-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.ds-hub-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.01em;
}
.ds-hub-card-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
}
.ds-pane:not(.ds-pane-active) {
  display: none;
}
.ds-pane.ds-pane-active {
  display: block;
}
.ds-pane-placeholder {
  margin-bottom: 0;
}

#page-data-studio .ds-pane > .admin-card {
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}
#page-data-studio .admin-card > .admin-card-header {
  padding: 16px clamp(18px, 2.2vw, 26px);
  border-bottom: 1px solid #eef2f6;
}
#page-data-studio .admin-card-header-left h2 {
  font-size: 14px;
  font-weight: 600;
}
#page-data-studio .admin-card > *:not(.admin-card-header) {
  padding-left: clamp(18px, 2.2vw, 28px);
  padding-right: clamp(18px, 2.2vw, 28px);
  box-sizing: border-box;
}
#page-data-studio .admin-card > *:not(.admin-card-header):last-child {
  padding-bottom: clamp(20px, 2.4vw, 28px);
}
#page-data-studio .admin-card > .admin-card-header ~ .ds-intro:first-of-type {
  margin-top: 6px;
}
#page-data-studio .ds-intro {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.55;
  color: #5b6577;
}
#page-data-studio .ds-intro + .ds-intro {
  margin-top: -6px;
  margin-bottom: 14px;
}
#page-data-studio .ds-status {
  margin-top: 12px;
}
#page-data-studio .ds-dropzone {
  margin-top: 6px;
  padding: 0;
  border-width: 0;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
}
#page-data-studio .ds-dropzone .ds-dropzone-inner {
  padding: 28px 24px;
}
#page-data-studio .ds-preview {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #eef2f6;
}
#page-data-studio .ds-preview-scroll {
  max-height: min(520px, 58vh);
  border-radius: 12px;
}
#page-data-studio .ds-import-panel {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid #eef2f6;
}
#page-data-studio .ds-import-row {
  max-width: none;
  margin-bottom: 14px;
}
#page-data-studio .ds-import-panel .ds-import-row:not([style*='flex']) {
  max-width: min(880px, 100%);
}
#page-data-studio .ds-import-title {
  margin-bottom: 16px;
}
#page-data-studio .ds-import-log {
  max-height: min(320px, 40vh);
}
#page-data-studio .ds-risk-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid #eef2f6;
}
#page-data-studio .ds-risk-section:first-of-type {
  margin-top: 8px;
  padding-top: 0;
  border-top: none;
}
#page-data-studio .ds-risk-section--flush {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
#page-data-studio .ds-risk-actions {
  margin-bottom: 14px;
}
#page-data-studio .ds-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
  margin-bottom: 4px;
}
#page-data-studio .ds-risk-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  flex: 1;
  min-width: 0;
}
#page-data-studio .ds-risk-inline .ds-select {
  flex: 1;
  min-width: 140px;
}
#page-data-studio .ds-import-row-inline-flex {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}
#page-data-studio .ds-import-row-inline-flex .ds-label {
  flex: 0 0 min(220px, 100%);
  margin: 10px 0 0;
}
#page-data-studio .ds-import-row-inline-flex .ds-risk-inline {
  flex: 1;
  min-width: min(480px, 100%);
}
#page-data-studio .ds-input-mono {
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
  font-size: 12px;
}
/* Data Studio risk wizard — classes drs-* avoid colliding with Policy pipeline .pup-step-panel (global query) */
#page-data-studio .ds-rs-stepper.pup-stepper-card {
  margin-top: 8px;
  padding-bottom: 0;
  border: 1px solid #e8eef5;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}
#page-data-studio .ds-rs-stepper .pup-stepper-top {
  margin-bottom: 0;
  padding: 14px 0 14px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(to bottom, #fafbfc, #fff);
}
#page-data-studio .ds-rs-stepper .pup-stepper-panels {
  padding: 18px 0 16px;
  background: #fff;
}
#page-data-studio .ds-rs-stepper > .pup-stepper-actions {
  margin-top: 0;
  padding: 14px 0 18px;
  border-top: 1px solid #eef2f6;
  background: #fafbfd;
}
#page-data-studio .drs-step-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #f9fafb;
  transition: background 0.15s ease, border-color 0.15s ease;
}
#page-data-studio .drs-step-label-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  background: #e5e7eb;
  color: #4b5563;
}
#page-data-studio .drs-step-label-text {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  line-height: 1.25;
}
#page-data-studio .drs-step-label.is-done {
  border-color: #a7f3d0;
  background: #ecfdf5;
}
#page-data-studio .drs-step-label.is-done .drs-step-label-num {
  background: #10b981;
  color: #fff;
}
#page-data-studio .drs-step-label.is-active {
  border-color: #93c5fd;
  background: #eff6ff;
}
#page-data-studio .drs-step-label.is-active .drs-step-label-num {
  background: var(--admin-primary);
  color: #fff;
}
#page-data-studio .drs-step-panel {
  min-height: 128px;
  padding: 2px 0 4px;
}
#page-data-studio .drs-step-panel:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}
#page-data-studio .drs-step-panel .ds-import-title--flush {
  margin-top: 0;
}
#page-data-studio .drs-step-panel .ds-import-note--dense {
  margin-top: 4px;
  margin-bottom: 0;
}
#page-data-studio .drs-step-panel .ds-import-note--after-control {
  margin-top: 6px;
}
#page-data-studio .drs-step-panel .ds-intro--risk-link {
  margin: 0;
  max-width: 720px;
}
#page-data-studio .drs-step-panel .ds-intro--risk-scenarios {
  margin-top: 12px;
  margin-bottom: 8px;
}
#page-data-studio .drs-step-panel .ds-status:empty {
  display: none;
}
#page-data-studio .drs-step-panel .ds-risk-split {
  margin-top: 4px;
  padding-top: 18px;
  border-top: 1px solid #eef2f6;
}
#page-data-studio .drs-step-panel .ds-risk-split .ds-import-title {
  margin-top: 0;
  margin-bottom: 8px;
}
#page-data-studio .drs-step-panel .ds-risk-split .ds-import-note:last-of-type {
  margin-bottom: 0;
}
#page-data-studio .drs-step-panel .ds-rs-actions-top {
  margin-top: 10px;
}
#page-data-studio .drs-step-panel .ds-rs-import-actions {
  margin-top: 8px;
}
#page-data-studio .drs-step-panel .ds-rs-import-log {
  margin-top: 12px;
}
#page-data-studio .drs-step-panel .ds-rs-single-scenario-row {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #eef2f6;
}
#page-data-studio #ds-pane-risk-scenarios .pup-stepper-actions #drs-step-status.ds-status:empty {
  display: none;
}
.ds-intro {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 12px;
  line-height: 1.45;
}
.ds-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
/* Data Studio upload affordances — dropzones & compact file row */
.ds-upload-field {
  position: relative;
  margin-top: 4px;
  max-width: min(880px, 100%);
}
.ds-upload-field .ds-upload-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
  pointer-events: none;
}
.ds-upload-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  cursor: pointer;
  background: linear-gradient(180deg, #f9fafc 0%, #fff 55%);
  border: 1px solid #dfe6ef;
  border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 3px rgba(15, 23, 42, 0.05);
}
.ds-upload-browse {
  position: relative;
  flex-shrink: 0;
  margin: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 9px 18px;
  border-radius: 9px;
  border: none;
  color: #fff;
  background: linear-gradient(180deg, var(--admin-primary-light) 0%, var(--admin-primary) 100%);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition:
    transform 0.12s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
.ds-upload-browse:hover {
  background: linear-gradient(180deg, #1a9eec 0%, var(--admin-primary-dark) 100%);
}
.ds-upload-browse:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.ds-upload-browse:focus-visible {
  outline: 2px solid rgba(0, 119, 204, 0.45);
  outline-offset: 2px;
}
.ds-upload-filename {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: #1e293b;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ds-upload-filename.is-empty {
  color: #94a3b8;
  font-weight: 400;
  font-style: italic;
}
.ds-dropzone {
  margin-top: 6px;
  border: none;
  border-radius: 16px;
  padding: 3px;
  cursor: pointer;
  text-align: center;
  background: linear-gradient(135deg, rgba(0, 119, 204, 0.12), rgba(99, 102, 241, 0.1));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition:
    transform 0.15s ease,
    box-shadow 0.18s ease;
}
.ds-dropzone-inner {
  padding: 30px 24px;
  border-radius: 13px;
  border: 1px dashed rgba(148, 163, 184, 0.9);
  background: linear-gradient(180deg, rgba(249, 250, 252, 0.98), #fff);
  transition:
    border-color 0.15s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}
.ds-dropzone:hover .ds-dropzone-inner {
  border-color: rgba(0, 119, 204, 0.45);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.55), #fff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 0 0 1px rgba(0, 119, 204, 0.06),
    0 8px 24px rgba(15, 23, 42, 0.05);
}
.ds-dropzone.ds-dropzone-active .ds-dropzone-inner {
  border-style: solid;
  border-color: rgba(0, 119, 204, 0.55);
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.5), rgba(239, 246, 255, 0.4));
}
.ds-dropzone:focus-visible .ds-dropzone-inner {
  outline: 2px solid rgba(0, 119, 204, 0.45);
  outline-offset: 2px;
}
.ds-dropzone-visual {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(0, 119, 204, 0.1), rgba(255, 255, 255, 0.9));
  color: rgba(0, 119, 204, 0.75);
}
.ds-dropzone-title {
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.45;
}
.ds-dropzone-title strong {
  font-weight: 700;
  color: #0f172a;
}
.ds-dropzone-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}
.ds-upload-chip {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.ds-upload-chip--primary {
  color: var(--admin-primary);
  border-color: rgba(0, 119, 204, 0.22);
  background: rgba(255, 255, 255, 0.85);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 1px 3px rgba(15, 23, 42, 0.04);
}
.ds-dropzone:hover .ds-upload-chip--primary {
  border-color: rgba(0, 119, 204, 0.35);
  background: rgba(239, 246, 255, 0.9);
}
.ds-dropzone.ds-dropzone-active .ds-upload-chip--primary {
  background: rgba(219, 234, 254, 0.6);
}
.ds-upload-chip--primary::before {
  content: '';
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), transparent 52%),
    linear-gradient(180deg, var(--admin-primary-light), var(--admin-primary));
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 1px 2px rgba(0, 119, 204, 0.35);
}

.ds-dropzone .ds-dropzone-hint {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 8px;
}
.ds-dropzone .ds-dropzone-hint code {
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(241, 245, 249, 0.9);
}

.ds-status {
  margin-top: 14px;
  font-size: 12px;
  color: #64748b;
  min-height: 1.2em;
}
.ds-preview {
  margin-top: 20px;
  border-top: 1px solid #f1f5f9;
  padding-top: 16px;
}
.ds-preview-meta {
  font-size: 13px;
  color: #334155;
  margin-bottom: 12px;
  line-height: 1.5;
}
.ds-preview-meta code {
  font-size: 12px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}
.ds-preview-scroll {
  overflow: auto;
  max-height: min(420px, 55vh);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fafafa;
}
.ds-preview-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ds-preview-table th,
.ds-preview-table td {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  max-width: 280px;
  background: #fff;
}
.ds-preview-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #334155;
  position: sticky;
  top: 0;
  z-index: 1;
}
.ds-preview-table tbody tr:nth-child(even) td {
  background: #fafbfc;
}

/* Data Studio — GRC import */
.ds-import-panel {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}
.ds-import-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 14px;
}
.ds-import-row {
  margin-bottom: 12px;
  max-width: 560px;
}
.ds-import-row-inline {
  margin-bottom: 8px;
}
.ds-check-label {
  font-size: 12px;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.ds-check-label input {
  margin: 0;
}
.ds-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}
.ds-req { color: #dc2626; }
.ds-label-note {
  font-weight: 400;
  color: #64748b;
  font-size: 11px;
}
.ds-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
}
.ds-import-note {
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
  max-width: 640px;
  margin: 0 0 12px;
}
.ds-import-log {
  margin-top: 14px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-wrap;
  max-height: 280px;
  overflow: auto;
}

/* ——— Legislative sources (modern UI) ——— */
.lu-page .lu-page-container {
  max-width: 1100px;
}
.lu-page-header {
  margin-bottom: 24px;
}
.lu-page-header-text .page-subtitle {
  max-width: 520px;
  line-height: 1.55;
  color: #64748b;
}
.lu-btn-add-source {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  flex-shrink: 0;
}
.lu-btn-add-source svg {
  flex-shrink: 0;
  opacity: 0.95;
}

.lu-panel {
  border-radius: 16px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.04),
    0 12px 32px -12px rgba(15, 23, 42, 0.12);
  padding: 0;
  overflow: hidden;
}
.lu-loading-panel {
  padding: 48px 24px;
  justify-content: center;
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
}
.lu-loading {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lu-empty-state {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 28px 52px;
  margin: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(59, 130, 246, 0.06) 0%, transparent 65%);
}
.lu-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(145deg, #eff6ff 0%, #e0e7ff 100%);
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.lu-empty-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.lu-empty-desc {
  margin: 0;
  max-width: 400px;
  font-size: 14px;
  line-height: 1.6;
  color: #64748b;
}

.lu-table-shell {
  overflow-x: auto;
  padding: 8px 20px 22px;
  border-top: 1px solid rgba(241, 245, 249, 0.9);
}
.lu-table.lu-table-internal {
  table-layout: fixed;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}
.lu-table-internal th.lu-col-actions,
.lu-table-internal td.lu-col-actions {
  width: 152px;
  text-align: right;
  vertical-align: middle;
}
.lu-table-internal .lu-col-name {
  width: 22%;
}
.lu-table-internal .lu-col-user {
  width: 14%;
}
.lu-table-internal .lu-col-date {
  width: 148px;
}
.lu-table-internal .lu-col-desc {
  min-width: 0;
}
.lu-table-internal tbody tr.lu-data-row {
  border-left: 3px solid transparent;
}
.lu-table-internal tbody tr.lu-data-row:hover {
  border-left-color: #3b82f6;
}
.lu-table-internal .lu-desc {
  max-width: none;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.lu-desc-empty {
  color: #94a3b8;
  font-style: italic;
}
.lu-cell-muted {
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}
.lu-doc-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border-radius: 12px;
  background: linear-gradient(160deg, #f8fafc 0%, #e2e8f0 100%);
  border: 1px solid #e2e8f0;
  color: #475569;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}
.lu-doc-open:hover {
  transform: translateY(-1px);
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  text-decoration: none;
  color: #334155;
}
.lu-doc-open:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}
.lu-doc-open.lu-doc-open--preview {
  background: linear-gradient(160deg, #eff6ff 0%, #e0e7ff 100%);
  border-color: #c7d2fe;
  color: #4338ca;
}
.lu-doc-open.lu-doc-open--preview:hover {
  color: #3730a3;
  border-color: #a5b4fc;
  background: linear-gradient(160deg, #e0e7ff 0%, #ddd6fe 100%);
}
.lu-preview-svg {
  flex-shrink: 0;
  pointer-events: none;
}
.lu-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.lu-row-actions .lu-doc-open.lu-doc-open--preview.lu-action-preview {
  width: 36px;
  height: 36px;
  margin: 0;
  border-radius: 10px;
  flex-shrink: 0;
  box-sizing: border-box;
}
.lu-row-actions .lu-doc-open.lu-action-preview .lu-preview-svg {
  width: 18px;
  height: 18px;
}
.lu-action-preview-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #cbd5e1;
  flex-shrink: 0;
}
.lu-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.lu-icon-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.lu-icon-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
}
.lu-icon-btn:active {
  transform: scale(0.96);
}
.lu-icon-btn--danger:hover {
  background: #fee2e2;
  color: #b91c1c;
}
.lu-edit-file-row .admin-form-label {
  display: block;
  margin-bottom: 4px;
}
.lu-edit-file-hint {
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
  margin: 0 0 8px;
  word-break: break-word;
  line-height: 1.45;
}
.lu-edit-file-note {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

.lu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.lu-table th,
.lu-table td {
  text-align: left;
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
.lu-table th {
  font-weight: 600;
  color: #475569;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 1;
}
.lu-table tbody tr {
  background: #fff;
  transition: background 0.15s ease;
}
.lu-table tbody tr:hover {
  background: #f8fafc;
}
.lu-table tbody tr:last-child td {
  border-bottom: none;
}
.lu-cell-name {
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.lu-table .lu-desc {
  max-width: 280px;
  color: #64748b;
  line-height: 1.5;
  font-size: 13px;
}

.lu-error {
  margin: 0 20px 20px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
}

.lu-external-card {
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 40%, #f1f5f9 100%);
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.05),
    0 20px 48px -24px rgba(79, 70, 229, 0.2);
  padding: 2px;
  position: relative;
  overflow: hidden;
}
.lu-external-card::before {
  content: '';
  position: absolute;
  inset: -40% 50% 40% -30%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 65%);
  pointer-events: none;
}
.lu-external-inner {
  position: relative;
  padding: 40px 36px 44px;
  text-align: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px);
}
.lu-external-heading {
  margin: 20px 0 12px;
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.03em;
}
.lu-external-copy {
  margin: 0 auto;
  max-width: 480px;
  font-size: 15px;
  line-height: 1.65;
  color: #475569;
}

.lu-badge-soon {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%);
  color: #4338ca;
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.08);
}

.lu-add-modal.admin-modal {
  max-width: 480px;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 24px 64px -16px rgba(15, 23, 42, 0.25);
}
.lu-add-modal .admin-modal-body {
  padding-top: 8px;
}

.lu-link-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
.lu-link-download:hover {
  background: #eff6ff;
  color: #1d4ed8;
  text-decoration: none;
}
.lu-link-download svg {
  flex-shrink: 0;
  opacity: 0.85;
}

/* Legacy / shared lu utilities */
.lu-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.lu-section .lu-section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.lu-section-hd.lu-section-hd--badge-only {
  justify-content: flex-end;
}
.lu-section-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  color: var(--admin-text, #0f172a);
}
.lu-muted {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.5;
}
.lu-coming-soon .lu-section-hd {
  margin-bottom: 8px;
}
.lu-modal-hint {
  margin-top: 8px;
}

/* Pipeline configuration page (sidebar link under LEGISLATIVE UPDATES) */
.pcfg-panel .pcfg-panel-inner {
  padding: 24px 24px 28px;
}
.pcfg-lead {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.6;
  color: #334155;
  font-weight: 500;
}
.pcfg-muted {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #64748b;
}

/* ── Pipeline config — default org list ───────────────────── */
.pcfg-org-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}
.pcfg-org-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.pcfg-org-card.is-default {
  background: #f0fdf4;
  border-color: #86efac;
}
.pcfg-org-card:not(.is-default):hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.pcfg-org-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.pcfg-org-info {
  flex: 1;
  min-width: 0;
}
.pcfg-org-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pcfg-org-meta {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}
.pcfg-org-badge-default {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #16a34a;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 999px;
  padding: 4px 10px;
  flex-shrink: 0;
}
.pcfg-org-set-default-btn {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  padding: 6px 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.pcfg-org-set-default-btn:hover { background: #e0e7ff; border-color: #a5b4fc; }

/* ── Internal Sources — tabs ───────────────────────────────── */
.lu-is-tabs-wrap {
  margin-bottom: 18px;
}
.lu-is-tabs {
  display: inline-flex;
  align-items: stretch;
  gap: 4px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(241, 245, 249, 0.95);
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.lu-is-tab {
  appearance: none;
  border: none;
  background: transparent;
  margin: 0;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.lu-is-tab:hover { color: #334155; background: rgba(255,255,255,0.65); }
.lu-is-tab.is-active {
  color: #0f172a;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15,23,42,0.06), 0 0 0 1px rgba(226,232,240,0.9);
}
.lu-is-tab:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }
.lu-is-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.lu-is-tab.is-active .lu-is-tab-count {
  background: #e0e7ff;
  color: #4338ca;
}

/* ── Extracted policies grid ───────────────────────────────── */
.lu-ep-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding-top: 4px;
}
.lu-ep-group {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(15,23,42,0.05);
  display: flex;
  flex-direction: column;
}
.lu-ep-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
}
.lu-ep-group-toggle {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.lu-ep-group-toggle:hover { background: #f8fafc; }
.lu-ep-group.is-open .lu-ep-group-toggle { background: #f8fafc; }
.lu-ep-group-chevron {
  flex-shrink: 0;
  color: #94a3b8;
  transition: transform 0.22s;
  margin-left: auto;
}
.lu-ep-group.is-open .lu-ep-group-chevron { transform: rotate(180deg); }
.lu-ep-group-body { border-top: 1px solid #f1f5f9; }
.lu-ep-group-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #eef2ff;
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lu-ep-group-meta {
  flex: 1;
  min-width: 0;
}
.lu-ep-group-file {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lu-ep-group-date {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}
.lu-ep-group-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.lu-ep-policy-list {
  padding: 8px 0;
  flex: 1;
}
/* Accordion list replaces the old scrollable list */
.lu-acc-list {
  padding: 6px 0;
}
.lu-ep-policy-item {
  padding: 10px 16px;
  border-bottom: 1px solid #f8fafc;
}
.lu-ep-policy-item:last-child { border-bottom: none; }
.lu-ep-article-label {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 5px;
  padding: 1px 7px;
  margin-bottom: 4px;
}
.lu-ep-policy-title {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lu-ep-policy-content {
  font-size: 12px;
  color: #475569;
  line-height: 1.6;
  margin: 0;
  white-space: pre-wrap;
}

/* ── Accordion items ───────────────────────────────────────── */
.lu-acc-item {
  border-bottom: 1px solid #f1f5f9;
}
.lu-acc-item:last-child { border-bottom: none; }
.lu-acc-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.lu-acc-trigger:hover { background: #f8fafc; }
.lu-acc-title {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lu-acc-chevron {
  flex-shrink: 0;
  color: #94a3b8;
  transition: transform 0.2s;
}
.lu-acc-item.is-open .lu-acc-chevron { transform: rotate(180deg); }
.lu-acc-item.is-open .lu-acc-trigger { background: #f8fafc; }
.lu-acc-body {
  padding: 4px 16px 14px 16px;
  background: #fafbfc;
  border-top: 1px solid #f1f5f9;
}

.lu-ep-group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid #f1f5f9;
  background: #fafbfc;
}
.lu-ep-raw-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 7px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.lu-ep-raw-btn:hover { background: #e0e7ff; border-color: #a5b4fc; }

/* Raw data modal */
.lu-raw-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.lu-raw-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.lu-raw-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15,23,42,0.2);
  width: min(860px, 94vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lu-raw-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}
.lu-raw-modal-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}
.lu-raw-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s;
}
.lu-raw-modal-close:hover { background: #e2e8f0; }
.lu-raw-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.lu-raw-modal-body pre {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: #1e293b;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  font-family: 'Fira Mono', 'Consolas', monospace;
}

.pcfg-tabs-wrap {
  margin-bottom: 18px;
}
.pcfg-tabs {
  display: inline-flex;
  align-items: stretch;
  gap: 4px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(241, 245, 249, 0.95);
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.pcfg-tab {
  appearance: none;
  border: none;
  background: transparent;
  margin: 0;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  border-radius: 10px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
  font-family: inherit;
}
.pcfg-tab:hover {
  color: #334155;
  background: rgba(255, 255, 255, 0.65);
}
.pcfg-tab.active {
  color: #0f172a;
  background: #fff;
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.06),
    0 0 0 1px rgba(226, 232, 240, 0.9);
}
.pcfg-tab:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}
.pcfg-tab-panel {
  margin-top: 0;
}
