:root {
  font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;

  color-scheme: light dark;

  /* Theme Variables */
  --lab-bg: #0f172a;
  --lab-header-bg: #1e293b;
  --lab-sidebar-bg: #1e293b;
  --lab-border: #334155;
  --lab-text-primary: #f8fafc;
  --lab-text-secondary: #94a3b8;
  --lab-text-muted: #64748b;
  --lab-sidebar-hover: #334155;
  --lab-card-bg: #1e293b;
  --lab-input-bg: #020617;
  --lab-btn-secondary: #334155;
  --lab-accent: #3b82f6;
  --lab-accent-gradient: #3b82f6;
  --lab-success: #4ade80;
  --lab-error: #ef4444;
  --lab-warning: #fb923c;
  --lab-scrollbar-track: #0f172a;
  --lab-scrollbar-thumb: #475569;
  --lab-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  --lab-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --offline-banner-height: 0px;

  /* Modal system */
  --cdx-modal-border: rgba(255, 255, 255, 0.08);

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.light {
  --lab-bg: #f3f4f6;
  --lab-header-bg: #ffffff;
  --lab-sidebar-bg: #ffffff;
  --lab-border: #e5e7eb;
  --lab-text-primary: #111827;
  --lab-text-secondary: #4b5563;
  --lab-text-muted: #9ca3af;
  --lab-sidebar-hover: #f9fafb;
  --lab-card-bg: #ffffff;
  --lab-input-bg: #ffffff;
  --lab-btn-secondary: #f3f4f6;
  --lab-accent: #3b82f6;
  --lab-accent-gradient: #3b82f6;
  --lab-success: #16a34a;
  --lab-error: #dc2626;
  --lab-warning: #d97706;
  --lab-scrollbar-track: #f3f4f6;
  --lab-scrollbar-thumb: #d1d5db;
  --lab-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --lab-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Modal system */
  --cdx-modal-border: rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .modal-dialog {
    padding: 20px;
    margin: 20px;
  }
}

/* Tooltip for Particles Background "shoot" text */
.shoot-tooltip {
  position: fixed;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #3b82f6; /* Modern Blue */
  background: rgba(15, 23, 42, 0.7);
  padding: 4px 10px;
  border-radius: 6px;
  z-index: 10000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

:root.light .shoot-tooltip {
  background: rgba(255, 255, 255, 0.7);
  color: #2563eb;
  border: 1px solid rgba(37, 99, 235, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  background-color: var(--lab-bg);
  color: var(--lab-text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Restore text cursor for text elements */
p, h1, h2, h3, h4, h5, h6, li, blockquote, label {
  cursor: text;
}

#root {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

body.offline-banner-active #root {
  padding-top: 0;
}
a {
  font-weight: 500;
  color: #646cff;
  text-decoration: inherit;
}
a:hover {
  color: #535bf2;
}

/* Custom Animated Aim Cursor */
.custom-aim-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 30px;
  height: 30px;
  pointer-events: none;
  z-index: 10000;
  transition: opacity 0.15s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

/* Outer spinning ring */
.aim-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 1.5px dashed #06b6d4; /* Neon cyan */
  border-radius: 50%;
  animation: spin-aim 6s linear infinite;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
  transition: all 0.15s ease-out;
}

/* Center dot */
.aim-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #ef4444; /* Bright red */
  border-radius: 50%;
  box-shadow: 0 0 8px #ef4444;
  transition: all 0.15s ease;
}

/* Crosshair lines */
.aim-line-h, .aim-line-v {
  position: absolute;
  background: #06b6d4;
  box-shadow: 0 0 6px #06b6d4;
  transition: all 0.15s ease;
}

.aim-line-h {
  width: 140%; /* slightly overflows the ring */
  height: 1px;
}

.aim-line-v {
  width: 1px;
  height: 140%;
}

@keyframes spin-aim {
  to { transform: rotate(360deg); }
}

/* Recoil / Click pulse effect */
.aim-click-pulse .aim-ring {
  transform: scale(0.6);
  border: 1.5px solid #ef4444;
  box-shadow: 0 0 15px #ef4444;
}

.aim-click-pulse .aim-line-h { width: 80%; background: #ef4444; }
.aim-click-pulse .aim-line-v { height: 80%; background: #ef4444; }
.aim-click-pulse .aim-dot { transform: scale(1.5); }

body {
  margin: 0;
  display: flex;
  place-items: center;
  min-width: 320px;
  min-height: 100vh;
}

h1 {
  font-size: 3.2em;
  line-height: 1.1;
}

button {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.6em 1.2em;
  font-size: 1em;
  font-weight: 500;
  font-family: inherit;
  background-color: #1a1a1a;
  cursor: pointer;
  transition: border-color 0.25s;
}
button:hover {
  border-color: #646cff;
}

@media (prefers-color-scheme: light) {
  :root {
    color: #213547;
    background-color: #ffffff;
  }
  a:hover {
    color: #747bff;
  }
  button {
    background-color: #f9f9f9;
  }
}
/* === UNIFIED HEADER: Works for both regular pages and lab pages === */
.header {
  min-height: 60px;
  background: var(--lab-header-bg);
  border-bottom: 1px solid var(--lab-border);
  display: flex;
  flex-direction: column;
  padding: 0;
  flex-shrink: 0;
  z-index: 10000;
  position: sticky;
  top: var(--offline-banner-height, 0px);
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

.header-content {
  height: 60px;
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 15px;
  box-sizing: border-box;
  padding: 0 20px;
}

/* === LEFT SECTION === */
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-lab-info-desktop {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

@media (max-width: 900px) {
  .header-lab-info-desktop {
     display: none;
  }
}

.header-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--lab-btn-secondary);
  border: 1px solid var(--lab-border);
  border-radius: 10px;
  color: var(--lab-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.header-back-btn:hover {
  background: var(--lab-sidebar-hover);
  border-color: var(--lab-text-muted);
  color: var(--lab-text-primary);
  transform: translateX(-2px);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 12px;
  border-right: 0px solid var(--lab-border);
  text-decoration: none;
  color: inherit;
  line-height: 1;
}

.header-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px; /* Added curve to logo */
}

.header-logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--lab-text-primary);
  line-height: 1;
  display: flex;
  align-items: center;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Reduce gap between hamburger and logo when only one tab (header-no-sub) */
.header.header-no-sub .header-breadcrumb {
  gap: 8px;
}

.header-nav-toggle {
  width: 38px;
  height: 40px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--lab-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  flex: 0 0 auto;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.header-nav-toggle-main {
  display: inline-flex;
}

.header-nav-toggle-sub {
  display: none;
  width: 36px;
  height: 34px;
}

.header-nav-toggle:hover {
  color: var(--lab-text-primary);
}

.header-nav-toggle:focus-visible {
  outline: 2px solid var(--lab-accent);
  outline-offset: 2px;
}

.header-nav-toggle-line {
  position: absolute;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.24s ease, opacity 0.2s ease;
}

.header-nav-toggle-line-1 {
  transform: translateY(-6px);
}

.header-nav-toggle-line-2 {
  transform: translateY(0);
}

.header-nav-toggle-line-3 {
  transform: translateY(6px);
}

.header-nav-toggle-quick .header-nav-toggle-line-1 {
  transform: translateY(-9px);
}

.header-nav-toggle-full .header-nav-toggle-line-1 {
  transform: translateY(0) rotate(45deg);
}

.header-nav-toggle-full .header-nav-toggle-line-2 {
  opacity: 0;
}

.header-nav-toggle-full .header-nav-toggle-line-3 {
  transform: translateY(0) rotate(-45deg);
}

.header-logo-breadcrumb {
  gap: 10px;
  padding-right: 0;
  min-width: 0;
  flex-shrink: 0;
}

.header-logo-text-breadcrumb {
  display: flex;
}

.header-breadcrumb-separator {
  color: var(--lab-text-secondary);
  opacity: 0.6;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  padding: 0 2px;
  cursor: default;
  pointer-events: none;
}

.header-breadcrumb-subject-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
  min-width: 0;
}

.header-breadcrumb-subject-link:hover .header-breadcrumb-subject {
  color: #ffffff;
  opacity: 1;
}

.header-breadcrumb-subject-link:active {
  opacity: 0.7;
}

.header-breadcrumb-subject {
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  max-width: 240px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
  display: block;
  margin-top: 1px;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.header-breadcrumb-subject-mobile {
  display: none;
}

.header-lab-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.header-lab-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--lab-text-primary);
  margin: 0;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
  padding: 2px 0;
}

.header-lab-code {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px;
  background: var(--lab-btn-secondary);
  border: 1px solid var(--lab-border);
  border-radius: 10px;
  color: var(--lab-accent);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.header-lab-code:hover {
  background: var(--lab-sidebar-hover);
  border-color: var(--lab-accent);
}

.header-lab-code i {
  font-size: 10px;
  color: var(--lab-accent);
}

/* === CENTER SECTION - Lab Internal Tabs === */
.header-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-tabs-wrapper {
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: center;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.header-tabs {
  display: flex;
  gap: 1rem;
  align-items: center;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.header-tab {
  background: transparent;
  border: none;
  color: var(--lab-text-secondary);
  padding: .3rem 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
  border-bottom: 2px solid transparent;
}

.header-tab:hover {
  color: var(--lab-text-primary);
}

.header-tab.active {
  color: var(--lab-accent);
  border-bottom-color: var(--lab-accent);
}

.header-tab i {
  font-size: 16px;
}

/* === RIGHT SECTION === */
.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  min-width: 0;
}

/* Lab Dropdown (for non-lab pages) */
.header-dropdown {
  position: relative;
}

.header-dropdown-btn {
  background: transparent;
  border: 1px solid var(--lab-border);
  color: var(--lab-text-secondary);
  padding: 6px 12px 8px 12px;
  border-radius: 70px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.header-dropdown-btn:hover,
.header-dropdown-btn.active {
  background: var(--lab-sidebar-hover);
  border-color: var(--lab-text-muted);
  color: var(--lab-text-primary);
}

.header-dropdown-btn i {
  font-size: 12px;
  transition: transform 0.2s;
}

.header-add-btn {
  background: transparent;
  border: none;
  color: var(--lab-text-secondary);
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.header-add-btn:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
}


.header-dropdown-btn.active i {
  transform: rotate(180deg);
}

.header-dropdown-content {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--lab-header-bg);
  border: 1px solid var(--lab-border);
  border-radius: 12px;
  min-width: 160px;
  width: max-content;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  z-index: 1000;
}

@media (max-width: 600px) {
  .header-dropdown-content {
    position: fixed;
    right: 8px;
    left: auto;
    max-width: calc(100vw - 16px);
    top: auto;
    bottom: auto;
  }
}

.header-dropdown-item {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--lab-text-secondary);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.header-dropdown-item:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
}

.header-dropdown-item.selected {
  background: var(--lab-primary-light, rgba(99, 102, 241, 0.1));
  color: var(--lab-primary, #6366f1);
  font-weight: 500;
}

.header-dropdown-item.selected:hover {
  background: var(--lab-primary-light, rgba(99, 102, 241, 0.15));
  color: var(--lab-primary, #6366f1);
}

/* Mobile Menu Button */
.header-mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--lab-border);
  color: var(--lab-text-secondary);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
}

.header-mobile-menu-btn:hover,
.header-mobile-menu-btn.active {
  background: var(--lab-sidebar-hover);
  border-color: var(--lab-text-muted);
  color: var(--lab-text-primary);
}

/* Profile Section */
.header-profile-section {
  position: relative;
}

.header-profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--lab-accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s;
  overflow: hidden;
}

.header-profile-avatar:hover {
  transform: scale(1.05);
}

.header-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.header-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 16px;
  background: var(--lab-accent-gradient);
}

.header-profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--lab-header-bg);
  border: 1px solid var(--lab-border);
  border-radius: 14px;
  min-width: 220px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  z-index: 1000;
}

@media (max-width: 600px) {
  .header-profile-menu {
    position: fixed;
    right: 8px;
    left: auto;
    max-width: calc(100vw - 16px);
    top: auto;
    bottom: auto;
  }
}

.header-profile-menu-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--lab-border);
}

.header-profile-menu-name {
  font-weight: 600;
  color: var(--lab-text-primary);
  font-size: 14px;
  margin-bottom: 4px;
}

.header-profile-menu-email {
  color: var(--lab-text-secondary);
  font-size: 12px;
}

.header-theme-toggle:hover {
  background: var(--lab-sidebar-hover) !important;
  border-color: var(--lab-text-muted) !important;
  transform: translateY(-1px);
}

.header-theme-toggle-btn:hover {
  background: var(--lab-sidebar-hover) !important;
  border-color: var(--lab-text-muted) !important;
  transform: translateY(-1px);
}

.header-profile-menu-item {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--lab-text-secondary);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s;
}

.header-profile-menu-item:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
}

.header-profile-menu-logout {
  color: #ef4444;
  border-top: 1px solid var(--lab-border);
}

.header-profile-menu-logout:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Login Button */
.header-btn-login {
  background: var(--lab-accent);
  color: white;
  padding: 8px 20px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.header-btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* === RESPONSIVE === */
/* === Sub-Header (Mobile Only) === */
.header-sub {
  display: none;
  background: color-mix(in srgb, var(--lab-header-bg) 65%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 6px 12px;
  border-top: 1px solid color-mix(in srgb, var(--lab-border) 40%, transparent);
  width: 100%;
  box-sizing: border-box;
  flex-direction: row;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid color-mix(in srgb, var(--lab-border) 40%, transparent);
}

.header-sub-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.header-sub-tabs {
  display: contents;
  overflow-x: auto;
  padding-bottom: 2px;
  -ms-overflow-style: none;
  scrollbar-width: none;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.header-sub-tabs::-webkit-scrollbar {
  display: none;
}

.header-sub-tab {
  background: var(--lab-btn-secondary);
  border: 1px solid var(--lab-border);
  color: var(--lab-text-secondary);
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.2s;
  flex: 0 1 auto;
  justify-content: center;
  min-width: auto;
  line-height: 1;
}

.header-sub-tab.active {
  background: var(--lab-accent);
  color: white;
  border-color: var(--lab-accent);
}

.header-sub-tab i {
  font-size: 12px;
}

/* Admin Edit/View Mode Toggle */
.header-edit-mode-toggle {
  background: var(--lab-btn-secondary);
  border: 1px solid var(--lab-border);
  color: var(--lab-text-secondary);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  line-height: 1;
  min-width: 74px;
  justify-content: center;
}

.header-edit-mode-toggle.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
}

.header-edit-mode-toggle:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
  border-color: var(--lab-accent);
}

.header-edit-mode-toggle i {
  font-size: 11px;
}

.header-edit-mode-toggle-icon-only {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  gap: 0;
  justify-content: center;
}

.header-edit-mode-toggle-icon-only i {
  font-size: 13px;
}

/* Desktop version - hidden by default */
.header-edit-mode-toggle-desktop {
  display: none;
}

/* Mobile version */
.header-edit-mode-toggle-mobile {
  margin-left: auto;
  margin-right: 8px;
}

@media (max-width: 900px) {
  .header-sub {
    display: flex;
  }
  .header-tabs-desktop {
    display: none;
  }
  .header-edit-mode-toggle-desktop {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .header-sub {
    display: flex;
  }
  .header-tabs-desktop {
    display: none;
  }
  .header-nav-toggle-main {
    display: none;
  }
  .header-nav-toggle-sub {
    display: inline-flex;
  }
  .header-edit-mode-toggle-desktop {
    display: none !important;
  }
  
  /* When header-sub is not rendered (single tab), show hamburger in main header */
  .header.header-no-sub .header-nav-toggle-main {
    display: inline-flex;
  }
}

@media (min-width: 1025px) {
  .header-nav-toggle-main {
    display: inline-flex;
  }
  .header-nav-toggle-sub {
    display: none !important;
  }
  .header-edit-mode-toggle-mobile {
    display: none !important;
  }
  .header-edit-mode-toggle-desktop {
    display: flex !important;
  }
}

@media (max-width: 600px) {
  .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    height: 56px;
  }

  .header-left {
    flex: 1;
    min-width: 0;
  }

  .header-breadcrumb {
    width: 100%;
    min-width: 0;
  }

  .header-breadcrumb-subject-link {
    flex: 0 1 auto;
    min-width: 0;
  }

  .header-logo-text {
    font-size: 1.1rem;
    display: block !important; /* Always show text */
  }

  .header-back-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .header-lab-name {
    font-size: 14px;
    max-width: 200px;
  }

  .header-center {
    display: none;
  }

  .header-right {
    gap: 8px;
  }

  .header-sub-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    gap: 4px;
    width: 100%;
  }

  .header-sub-tab {
    min-width: 36px;
    padding: 6px 6px;
    justify-content: center;
    gap: 4px;
  }

  .header-sub-tab span {
    display: none;
  }

  .header-sub-tab.active {
    min-width: auto;
    justify-content: flex-start;
    padding: 6px 8px;
  }

  .header-sub-tab.active span {
    display: inline;
  }

  .header-sub-tabs.header-sub-tabs-two {
    justify-content: center;
    gap: 6px;
  }

  .header-sub-tabs.header-sub-tabs-two .header-sub-tab {
    min-width: 0;
    padding: 6px 10px;
    gap: 5px;
  }

  .header-sub-tabs.header-sub-tabs-two .header-sub-tab span {
    display: inline;
  }
}

@media (max-width: 480px) {
  .header-logo-text-breadcrumb {
    display: none !important;
  }

  .header-breadcrumb {
    gap: 8px;
  }

  .header-logo-breadcrumb {
    gap: 0;
  }

  .header-breadcrumb-separator,
  .header-breadcrumb-subject-desktop {
    display: none;
  }

  .header-breadcrumb-subject-mobile {
    display: block;
    max-width: 180px;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-logo-text {
    font-size: 1rem;
  }

  .header-right {
    flex-shrink: 0;
  }
  
  .header-lab-name {
    max-width: 140px;
    font-size: 14px;
  }
  
  .header-add-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .header-profile-btn {
    width: 32px;
    height: 32px;
  }

  .header-sub {
    padding: 6px 8px;
    gap: 6px;
  }

  .header-sub-tab {
    padding: 6px 7px;
    font-size: 11px;
    min-width: 34px;
    gap: 3px;
  }

  .header-sub-tab i {
    font-size: 11px;
  }

  .header-sub-tabs.header-sub-tabs-two {
    gap: 5px;
  }

  .header-sub-tabs.header-sub-tabs-two .header-sub-tab {
    padding: 6px 8px;
    min-width: 0;
  }

  .header-sub-tabs.header-sub-tabs-two .header-sub-tab span {
    display: inline;
  }
}

@media (max-width: 360px) {
  .header-logo-text {
    font-size: 0.9rem;
  }
  
  .header-lab-name {
    max-width: 110px;
  }
}

@media (max-width: 320px) {
  .header-logo-text {
    font-size: 0.85rem;
  }
  
  .header-back-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .header-lab-name {
    font-size: 13px;
    max-width: 100px;
  }

  .header-sub {
    padding: 5px 6px;
    gap: 4px;
  }

  .header-sub-tab {
    padding: 5px 6px;
    font-size: 11px;
    gap: 3px;
    min-width: 32px;
  }
}

/* --- Keep header-sub tabs always centered, hamburger only shows/hides, consistent height --- */
.header-sub {
  min-width: 320px;
  min-height: 40px;
  height: 44px;
  padding-top: 2px;
  padding-bottom: 2px;
  align-items: center;
}
.header-sub-left {
  min-height: 28px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.header-sub-tabs {
  width: 220px;
  min-width: 220px;
  max-width: 320px;
  margin: 0 auto;
  justify-content: center !important;
  position: relative;
  z-index: 1;
}
.header-nav-toggle-sub {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  width: 36px;
  height: 28px;
  min-width: 36px;
  min-height: 28px;
  visibility: visible;
}
.header-sub.show-hamburger .header-nav-toggle-sub {
  display: inline-flex;
}
.header-edit-mode-toggle-mobile {
  min-width: 34px;
  min-height: 28px;
}
.modern-loader-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh; /* flexible height depending on container */
  height: 100%;
  padding: 40px;
  width: 100%;
}

.modern-spinner {
  position: relative;
  width: 70px;
  height: 70px;
  margin-bottom: 24px;
}

.modern-spinner-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, rgba(139, 92, 246, 0) 70%);
  filter: blur(12px);
  animation: pulse-glow 2s ease-in-out infinite alternate;
}

.modern-spinner-ring-1 {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #6366f1; /* Indigo */
  border-right-color: #8b5cf6; /* Purple */
  animation: spin-glow 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.modern-spinner-ring-2 {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-bottom-color: #06b6d4; /* Cyan */
  border-left-color: #3b82f6; /* Blue */
  animation: spin-glow 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite reverse;
}

.modern-spinner-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  animation: pulse-opacity 2s ease-in-out infinite alternate;
}

.modern-loading-text {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: linear-gradient(90deg, #6366f1, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: pulse-opacity 1.5s ease-in-out infinite alternate;
}

@keyframes spin-glow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse-glow {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.5; }
  100% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
}

@keyframes pulse-opacity {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}
.offline-notification {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 11000;
  background: var(--lab-header-bg);
  color: #ef4444;
  padding: 4px 16px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14);
  border-bottom: 1px solid var(--lab-border);
  transform: translateY(-100%);
  transition: transform 0.3s ease-in-out;
}

.offline-notification.show {
  transform: translateY(0);
}

.offline-notification.hide {
  transform: translateY(-100%);
}

.offline-notification.back-online {
  background: var(--lab-header-bg);
  color: #16a34a;
}

.offline-content {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
}

.offline-text {
  display: flex;
  align-items: center;
}

.offline-text strong {
  font-size: 13px;
  font-weight: 600;
  color: currentColor;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .offline-notification {
    padding: 3px 12px;
  }

  .offline-content {
    justify-content: center;
  }

  .offline-text strong {
    font-size: 12px;
  }
}
/* ═══════════════════════════════════════════════════════════════
   CODINX — Universal Modal System
   Linear.app-inspired, glassmorphic, 2026 design system
   ═══════════════════════════════════════════════════════════════ */

/* ─── Overlay ─── */
.cdx-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;

  /* Glassmorphic backdrop */
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);

  /* Entry */
  animation: cdx-overlay-in 0.2s ease-out both;
}

@keyframes cdx-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── Panel ─── */
.cdx-modal-panel {
  position: relative;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;

  background: var(--lab-card-bg);
  border: 1px solid var(--cdx-modal-border, rgba(255, 255, 255, 0.08));
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 24px 48px -12px rgba(0, 0, 0, 0.5),
    0 0 80px -20px rgba(59, 130, 246, 0.08);

  outline: none;

  /* Entry animation */
  animation: cdx-panel-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cdx-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── Sizes ─── */
.cdx-modal--sm { max-width: 420px; }
.cdx-modal--md { max-width: 500px; }
.cdx-modal--lg { max-width: 600px; }
.cdx-modal--xl { max-width: 720px; }

/* ─── Variant: Danger ─── */
.cdx-modal--danger {
  border-color: rgba(239, 68, 68, 0.15);
  box-shadow:
    0 0 0 1px rgba(239, 68, 68, 0.06),
    0 24px 48px -12px rgba(0, 0, 0, 0.5),
    0 0 60px -20px rgba(239, 68, 68, 0.12);
}

/* ─── Variant: Warning ─── */
.cdx-modal--warning {
  border-color: rgba(251, 146, 60, 0.15);
  box-shadow:
    0 0 0 1px rgba(251, 146, 60, 0.06),
    0 24px 48px -12px rgba(0, 0, 0, 0.5),
    0 0 60px -20px rgba(251, 146, 60, 0.1);
}

/* Header ─── */
.cdx-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 0 24px;
}

.cdx-modal-header-content {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

/* Icon badge */
.cdx-modal-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.1);
  color: var(--lab-accent);
}

.cdx-modal-icon--danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.cdx-modal-icon--warning {
  background: rgba(251, 146, 60, 0.1);
  color: #fb923c;
}

.cdx-modal-titles {
  flex: 1;
  min-width: 0;
}

.cdx-modal-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--lab-text-primary);
  letter-spacing: -0.02em;
  line-height: 1.4;
}

.cdx-modal-subtitle {
  margin: 4px 0 0 0;
  font-size: 0.8125rem;
  color: var(--lab-text-secondary);
  line-height: 1.5;
  font-weight: 400;
}

.cdx-modal-subtitle strong {
  color: var(--lab-text-primary);
  font-weight: 600;
}

/* Close button */
.cdx-modal-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--lab-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.cdx-modal-close:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
}

/* ─── Body ─── */
.cdx-modal-body {
  padding: 20px 24px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  user-select: text;
  -webkit-user-select: text;
}

/* Thin scrollbar */
.cdx-modal-body::-webkit-scrollbar {
  width: 4px;
}
.cdx-modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.cdx-modal-body::-webkit-scrollbar-thumb {
  background: var(--lab-border);
  border-radius: 4px;
}
.cdx-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--lab-text-muted);
}

/* ─── Footer ─── */
.cdx-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--cdx-modal-border, rgba(255, 255, 255, 0.06));
  background: var(--lab-card-bg);
  border-radius: 0 0 16px 16px;
}

/* ─── Action Buttons Layout ─── */
.cdx-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.cdx-modal-actions--row {
  flex-direction: row;
}

.cdx-modal-actions--grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ─── Buttons ─── */
.cdx-modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 550;
  font-family: inherit;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.25;
  letter-spacing: -0.01em;
  min-height: 40px;
}

.cdx-modal-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

/* Secondary (default) */
.cdx-modal-btn--secondary {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-secondary);
  border: 1px solid var(--cdx-modal-border, rgba(255, 255, 255, 0.06));
}

.cdx-modal-btn--secondary:hover:not(:disabled) {
  background: var(--lab-btn-secondary);
  color: var(--lab-text-primary);
}

/* Primary */
.cdx-modal-btn--primary {
  background: var(--lab-text-primary);
  color: var(--lab-bg);
}

.cdx-modal-btn--primary:hover:not(:disabled) {
  opacity: 0.9;
  box-shadow: 0 0 0 2px var(--lab-bg), 0 0 0 4px var(--lab-text-primary);
}

/* Danger */
.cdx-modal-btn--danger {
  background: #ef4444;
  color: #fff;
}

.cdx-modal-btn--danger:hover:not(:disabled) {
  background: #dc2626;
  box-shadow: 0 0 20px -4px rgba(239, 68, 68, 0.4);
}

.cdx-modal-btn--danger:disabled {
  background: rgba(239, 68, 68, 0.2);
  color: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(239, 68, 68, 0.22);
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.08);
}

/* Ghost */
.cdx-modal-btn--ghost {
  background: transparent;
  color: var(--lab-text-secondary);
}

.cdx-modal-btn--ghost:hover:not(:disabled) {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
}

/* Spinner */
.cdx-modal-btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: cdx-spin 0.6s linear infinite;
}

@keyframes cdx-spin {
  to { transform: rotate(360deg); }
}

/* ─── Info Box ─── */
.cdx-modal-info-box {
  padding: 14px 16px;
  background: var(--lab-bg);
  border: 1px solid var(--cdx-modal-border, rgba(255, 255, 255, 0.06));
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cdx-modal-info-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cdx-modal-info-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lab-text-muted);
}

.cdx-modal-info-value {
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--lab-text-primary);
  user-select: text;
  -webkit-user-select: text;
}

.cdx-modal-info-value--mono {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  letter-spacing: 0.05em;
}

/* ─── Verify Input ─── */
.cdx-modal-verify-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cdx-modal-verify-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--lab-text-secondary);
}

.cdx-modal-verify-label strong {
  color: var(--lab-text-primary);
  font-weight: 600;
}

/* ─── Inputs ─── */
.cdx-modal-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--lab-input-bg);
  border: 1.5px solid var(--cdx-modal-border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  color: var(--lab-text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  transition: all 0.15s ease;
  outline: none;
  min-height: 40px;
  box-sizing: border-box;
}

.cdx-modal-input::placeholder {
  color: var(--lab-text-muted);
}

.cdx-modal-input:hover {
  border-color: rgba(59, 130, 246, 0.25);
}

.cdx-modal-input:focus {
  border-color: var(--lab-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.cdx-modal-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Validation states */
.cdx-input--success {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

.cdx-input--error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08) !important;
}

/* Search variant */
.cdx-modal-search-input-wrap {
  position: relative;
}

.cdx-modal-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--lab-text-muted);
  pointer-events: none;
}

.cdx-modal-input--search {
  padding-left: 40px;
}

/* ─── Textarea ─── */
.cdx-modal-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--lab-input-bg);
  border: 1.5px solid var(--cdx-modal-border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  color: var(--lab-text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  transition: all 0.15s ease;
  outline: none;
  resize: vertical;
  min-height: 80px;
  box-sizing: border-box;
}

.cdx-modal-textarea::placeholder {
  color: var(--lab-text-muted);
}

.cdx-modal-textarea:hover {
  border-color: rgba(59, 130, 246, 0.25);
}

.cdx-modal-textarea:focus {
  border-color: var(--lab-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ─── Select ─── */
.cdx-modal-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--lab-input-bg);
  border: 1.5px solid var(--cdx-modal-border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  color: var(--lab-text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
  transition: all 0.15s ease;
  outline: none;
  min-height: 40px;
  cursor: pointer;
  box-sizing: border-box;
}

.cdx-modal-select:hover {
  border-color: rgba(59, 130, 246, 0.25);
}

.cdx-modal-select:focus {
  border-color: var(--lab-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ─── Form Group ─── */
.cdx-modal-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.cdx-modal-form-group:last-child {
  margin-bottom: 0;
}

.cdx-modal-form-label {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  width: fit-content;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--lab-text-secondary);
  letter-spacing: -0.01em;
}

.cdx-modal-required {
  display: inline-block;
  line-height: 1;
  color: #ef4444;
}

.cdx-modal-form-hint {
  font-size: 0.75rem;
  color: var(--lab-text-muted);
  line-height: 1.4;
}

.cdx-modal-form-error {
  font-size: 0.75rem;
  color: #ef4444;
  line-height: 1.4;
}

/* ─── Error Banner ─── */
.cdx-modal-error {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 10px;
  color: #ef4444;
  font-size: 0.8125rem;
  line-height: 1.4;
  margin-bottom: 16px;
}

.cdx-modal-error svg {
  flex-shrink: 0;
}

/* ─── Search Dropdown (Command Palette style) ─── */
.cdx-modal-search-dropdown {
  position: relative;
}

.cdx-modal-dropdown-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
  background: var(--lab-card-bg);
  border: 1px solid var(--cdx-modal-border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.4);
}

.cdx-modal-dropdown-list::-webkit-scrollbar {
  width: 4px;
}
.cdx-modal-dropdown-list::-webkit-scrollbar-track {
  background: transparent;
}
.cdx-modal-dropdown-list::-webkit-scrollbar-thumb {
  background: var(--lab-border);
  border-radius: 4px;
}

.cdx-modal-dropdown-status {
  padding: 14px 16px;
  font-size: 0.8125rem;
  color: var(--lab-text-muted);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cdx-modal-dropdown-status--error {
  color: #ef4444;
}

.cdx-modal-dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.cdx-modal-dropdown-item:hover {
  background: var(--lab-sidebar-hover);
}

.cdx-modal-dropdown-item:last-child {
  border-bottom: none;
}

.cdx-modal-dropdown-item-title {
  display: block;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--lab-text-primary);
  line-height: 1.5;
}

.cdx-modal-dropdown-item-short {
  color: var(--lab-text-muted);
  font-weight: 400;
  font-size: 0.75rem;
  margin-left: 2px;
}

/* DEPRECATED: use .cdx-modal-dropdown-item-short instead */
.cdx-modal-dropdown-item-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--lab-text-muted);
  margin-top: 1px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile-first bottom-sheet pattern
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  .cdx-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .cdx-modal-panel {
    max-width: 100% !important;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    animation: cdx-panel-in-mobile 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  @keyframes cdx-panel-in-mobile {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .cdx-modal-header {
    padding: 20px 20px 0 20px;
  }

  .cdx-modal-body {
    padding: 16px 20px;
  }

  .cdx-modal-footer {
    padding: 16px 20px;
    /* Safe area for bottom notch */
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .cdx-modal-title {
    font-size: 1.0625rem;
  }

  .cdx-modal-actions--grid {
    grid-template-columns: 1fr;
  }

  /* Reverse order on mobile so primary is on top */
  .cdx-modal-actions--grid .cdx-modal-btn--secondary {
    order: 2;
  }

  .cdx-modal-actions--grid .cdx-modal-btn--danger,
  .cdx-modal-actions--grid .cdx-modal-btn--primary {
    order: 1;
  }

  .cdx-modal-btn {
    min-height: 44px;
    font-size: 0.9375rem;
  }

  .cdx-modal-input,
  .cdx-modal-textarea,
  .cdx-modal-select {
    font-size: 1rem; /* Prevent iOS zoom */
    min-height: 44px;
  }
}

@media (max-width: 380px) {
  .cdx-modal-header {
    padding: 16px 16px 0 16px;
  }

  .cdx-modal-body {
    padding: 14px 16px;
  }

  .cdx-modal-footer {
    padding: 14px 16px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .cdx-modal-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .cdx-modal-title {
    font-size: 1rem;
  }
}

/* ─── Grid helpers ─── */
.cdx-modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) {
  .cdx-modal-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ─── Additional Mobile Optimization (425px) ─── */
@media (max-width: 425px) {
  .cdx-modal-panel {
    max-height: 80vh; /* More compact height */
  }

  .cdx-modal-header {
    padding: 14px 16px 6px 16px;
  }

  .cdx-modal-body {
    padding: 6px 16px 10px 16px;
    gap: 10px;
  }

  .cdx-modal-footer {
    padding: 10px 16px 14px 16px;
  }

  .cdx-modal-title {
    font-size: 0.95rem;
    line-height: 1.3;
  }

  .cdx-modal-text {
    font-size: 0.85rem;
    line-height: 1.4;
  }

  .cdx-warning-box {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .cdx-warning-box .warning-title {
    font-size: 0.85rem;
  }

  .cdx-modal-input {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .cdx-modal-btn {
    padding: 10px 14px;
    min-height: 38px;
    font-size: 0.85rem;
  }

  .cdx-modal-actions {
    gap: 8px;
  }
}

/* ─── Ultra-compact for 320px devices ─── */
@media (max-width: 320px) {
  .cdx-modal-panel {
    max-height: 85vh; /* Even more compact */
  }

  .cdx-modal-header {
    padding: 12px 14px 4px 14px;
  }

  .cdx-modal-body {
    padding: 4px 14px 8px 14px;
    gap: 8px;
  }

  .cdx-modal-footer {
    padding: 8px 14px 12px 14px;
  }

  .cdx-modal-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
  }

  .cdx-modal-title {
    font-size: 0.85rem;
    line-height: 1.2;
  }

  .cdx-modal-text {
    font-size: 0.75rem;
    line-height: 1.3;
  }

  .cdx-warning-box {
    padding: 8px 10px;
    font-size: 0.7rem;
    border-radius: 6px;
  }

  .cdx-warning-box .warning-title {
    font-size: 0.75rem;
    margin-bottom: 2px;
  }

  .cdx-modal-input {
    padding: 6px 8px;
    font-size: 0.8rem;
    min-height: 32px;
  }

  .cdx-modal-btn {
    padding: 6px 10px;
    min-height: 32px;
    font-size: 0.7rem;
  }

  .cdx-modal-actions {
    gap: 6px;
  }

  .cdx-modal-actions--grid {
    gap: 6px;
  }

  /* Checkbox styling for compact layout */
  .cdx-modal-checkbox-label {
    font-size: 0.65rem;
    padding: 4px;
    line-height: 1.2;
  }

  /* Close button */
  .cdx-modal-close {
    width: 24px;
    height: 24px;
  }
}

/* ─── Experiment Dropdown (floating select) ─── */
.cdx-modal-expt-dropdown {
  position: relative;
}

.cdx-modal-expt-dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  background: var(--lab-header-bg, #1e293b);
  border: 1px solid var(--cdx-modal-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.3);
  min-width: 100%;
  width: max-content;
}

.cdx-modal-expt-dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 15px;
  white-space: nowrap;
  border-bottom: 1px solid var(--cdx-modal-border);
  transition: background 0.15s ease;
}

.cdx-modal-expt-dropdown-item:last-child {
  border-bottom: none;
}

.cdx-modal-expt-dropdown-item:hover {
  background: var(--lab-sidebar-hover, rgba(255, 255, 255, 0.04));
}

.cdx-modal-expt-dropdown-item.active {
  background: rgba(59, 130, 246, 0.2);
}

.cdx-modal-expt-dropdown-item-no {
  font-weight: 500;
  color: var(--lab-text-primary);
  font-size: 14px;
  flex-shrink: 0;
}

.cdx-modal-expt-dropdown-item-name {
  color: var(--lab-text-secondary);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 350px;
}

.cdx-modal-expt-dropdown-empty {
  padding: 10px 14px;
  color: var(--lab-text-muted);
  font-size: 13px;
}

/* ─── File Upload Zone ─── */
.cdx-modal-upload-area {
  margin-top: 4px;
}

.cdx-modal-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  background: var(--lab-input-bg, #020617);
  border: 1.5px dashed var(--cdx-modal-border);
  border-radius: 12px;
  color: var(--lab-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 100px;
}

.cdx-modal-upload-label:hover {
  border-color: var(--lab-accent);
  background: rgba(59, 130, 246, 0.04);
  color: var(--lab-text-primary);
}

.cdx-modal-upload-area.is-drag-active .cdx-modal-upload-label {
  border-color: var(--lab-accent);
  background: rgba(59, 130, 246, 0.08);
  color: var(--lab-text-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.cdx-modal-upload-label svg {
  color: var(--lab-accent);
  opacity: 0.8;
}

.cdx-modal-upload-label span {
  font-size: 13px;
  font-weight: 500;
}

/* ─── Upload Progress ─── */
.cdx-modal-upload-progress-container {
  margin: 12px 0;
  padding: 0 4px;
}

.cdx-modal-upload-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--lab-text-secondary);
}

.cdx-modal-upload-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--lab-input-bg, #020617);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--cdx-modal-border);
}

.cdx-modal-upload-progress-bar-fill {
  height: 100%;
  background: var(--lab-accent, #3b82f6);
  transition: width 0.3s ease, background 0.3s;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}
.cdx-modal-upload-progress-bar-fill.complete {
  background: #22c55e !important; /* green-500 */
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}
.cdx-modal-upload-progress-bar-fill.incomplete {
  background: #fff !important;
  box-shadow: 0 0 10px rgba(255,255,255,0.2);
}

/* ─── File List ─── */
.cdx-modal-file-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--cdx-modal-border);
  border-radius: 10px;
  background: var(--lab-bg, #0f172a);
  margin-top: 2px;
}

.cdx-modal-file-item {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--cdx-modal-border);
  transition: background 0.15s ease;
  min-height: 44px;
}

.cdx-modal-file-item:last-child {
  border-bottom: none;
}

.cdx-modal-file-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.cdx-modal-file-item-left {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.cdx-modal-file-item-info {
  flex: 1;
  min-width: 0;
}

.cdx-modal-file-item-name {
  color: var(--lab-text-primary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.cdx-modal-file-badge {
  display: inline-flex;
  padding: 2px 6px;
  background: #3b82f6;
  color: white;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.cdx-modal-file-item-meta {
  color: var(--lab-text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.cdx-modal-file-remove {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
}

.cdx-modal-file-remove:hover {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   LIGHT THEME OVERRIDES
   ═══════════════════════════════════════════════════════════════ */

html.light .cdx-modal-overlay {
  background: rgba(0, 0, 0, 0.35);
}

html.light .cdx-modal-panel {
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.04),
    0 24px 48px -12px rgba(0, 0, 0, 0.18),
    0 0 80px -20px rgba(59, 130, 246, 0.06);
}

html.light .cdx-modal--danger {
  border-color: rgba(239, 68, 68, 0.12);
  box-shadow:
    0 0 0 1px rgba(239, 68, 68, 0.04),
    0 24px 48px -12px rgba(0, 0, 0, 0.18),
    0 0 60px -20px rgba(239, 68, 68, 0.08);
}

html.light .cdx-modal-footer {
  border-top-color: rgba(0, 0, 0, 0.06);
}

html.light .cdx-modal-info-box {
  border-color: rgba(0, 0, 0, 0.06);
}

html.light .cdx-modal-input,
html.light .cdx-modal-textarea,
html.light .cdx-modal-select {
  border-color: rgba(0, 0, 0, 0.12);
}

html.light .cdx-modal-input:hover,
html.light .cdx-modal-textarea:hover,
html.light .cdx-modal-select:hover {
  border-color: rgba(59, 130, 246, 0.3);
}

html.light .cdx-modal-btn--secondary {
  border-color: rgba(0, 0, 0, 0.08);
}

html.light .cdx-modal-dropdown-list {
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.12);
}

html.light .cdx-modal-dropdown-item {
  border-bottom-color: rgba(0, 0, 0, 0.04);
}
/* Skeleton Loading Base Styles */

.skeleton {
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* Light mode - subtle, blended colors */
:not(.dark-mode) .skeleton {
  background-color: #d1d5db;
  opacity: 0.6;
}

/* Dark mode - subtle, blended colors */
.dark-mode .skeleton,
.dark .skeleton {
  background-color: #4b5563;
  opacity: 0.5;
}

/* ========== WAVE ANIMATION ========== */
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    110deg,
    transparent 0%,
    rgba(255, 255, 255, 0.02) 38%,
    rgba(59, 130, 246, 0.12) 50%,
    rgba(255, 255, 255, 0.02) 62%,
    transparent 100%
  );
  background-size: 220% 100%;
  animation: skeleton-wave 2s ease-in-out infinite;
  pointer-events: none;
}

:not(.dark-mode) .skeleton::after {
  background: linear-gradient(
    110deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 42%,
    rgba(96, 165, 250, 0.18) 50%,
    rgba(255, 255, 255, 0.1) 58%,
    transparent 100%
  );
}

.dark-mode .skeleton::after,
.dark .skeleton::after {
  background: linear-gradient(
    110deg,
    transparent 0%,
    rgba(255, 255, 255, 0.02) 38%,
    rgba(59, 130, 246, 0.14) 50%,
    rgba(255, 255, 255, 0.02) 62%,
    transparent 100%
  );
}

.skeleton-pulse,
.skeleton-shimmer {
  animation: skeleton-wave 2s ease-in-out infinite;
}

@keyframes skeleton-wave {
  0% {
    background-position: 200% 0;
    opacity: 1;
  }
  50% {
    background-position: 0% 0;
    opacity: 1;
  }
  100% {
    background-position: -200% 0;
    opacity: 1;
  }
}

/* ========== COMPONENT-SPECIFIC STYLES ========== */

/* Skeleton Code Container */
.skeleton-code-container {
  padding: 16px;
  border-radius: 6px;
  background-color: var(--lab-card-bg, #ffffff);
}

.dark-mode .skeleton-code-container,
.dark .skeleton-code-container {
  background-color: #1f2937;
}

.skeleton-code-lines {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
  line-height: 1.6;
}

/* Skeleton Explanation Container */
.skeleton-explanation-container {
  padding: 16px;
  border-radius: 6px;
}

/* Skeleton Member Card */
.skeleton-member-card {
  padding: 16px;
  border: 1px solid var(--lab-border, #e5e7eb);
  border-radius: 6px;
  background-color: var(--lab-card-bg, #ffffff);
}

.dark-mode .skeleton-member-card,
.dark .skeleton-member-card {
  background-color: #1f2937;
  border-color: #374151;
}

/* Skeleton Settings Container */
.skeleton-settings-container {
  padding: 20px;
  max-width: 600px;
}

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

@media (max-width: 768px) {
  .skeleton {
    height: 12px !important;
  }

  .skeleton-code-container {
    padding: 12px;
  }

  .skeleton-code-lines {
    font-size: 12px;
  }
}

/* ========== ACCESSIBILITY ========== */

@media (prefers-reduced-motion: reduce) {
  .skeleton-pulse,
  .skeleton-shimmer {
    animation: none;
    opacity: 0.6;
  }

  .skeleton::after {
    animation: none;
  }
}

/* ========== LOADING STATE TRANSITIONS ========== */

/* Fade in/out when switching between skeleton and content */
.skeleton-enter {
  animation: fade-in 0.3s ease-in;
}

.skeleton-exit {
  animation: fade-out 0.3s ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
/* --- Fix stuck/abrupt scrolling on mobile: allow overflow for main containers --- */
@media (max-width: 900px) {
    html, body, main, .main-content, .dashboard-root, .dashboard-page, .dashboard-container {
        overflow: visible !important;
    }
}
/* --- SMOOTH & MOMENTUM SCROLLING FOR MOBILE --- */
html, body, main, .main-content {
    scroll-behavior: smooth;
}

@media (max-width: 900px) {
    main, .main-content {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}
@media (max-width: 480px) {
    .page-header .page-actions,
    div.page-header .page-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        width: 100% !important;
        gap: 6px !important;
        align-items: center !important;
    }

    .page-actions .btn,
    .page-actions .semester-dropdown-btn {
        width: auto !important;
        flex: 1 1 0 !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        justify-content: center !important;
        min-height: 32px !important;
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
    }
}
/* Lab Dashboard Styles - CSS Variables and Component Styles */

/* --- THEME VARIABLES --- */
:root {
    --bg-dark: var(--lab-bg);
    --bg-card: var(--lab-card-bg);
    --bg-input: var(--lab-input-bg);
    --bg-lighter: var(--lab-sidebar-hover);
    --text-main: var(--lab-text-primary);
    --text-muted: var(--lab-text-secondary);
    --primary: var(--lab-accent);
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --secondary: #3b82f6;
    --accent-green: var(--lab-success);
    --accent-blue: #38bdf8;
    --accent-orange: var(--lab-warning);
    --accent-red: var(--lab-error);
    --border-color: var(--lab-border);
    --glass-bg: var(--lab-bg);
    --error: var(--lab-error);
}

:root.light {
    --bg-dark: var(--lab-bg);
    --bg-card: var(--lab-card-bg);
    --bg-input: var(--lab-input-bg);
    --bg-lighter: var(--lab-sidebar-hover);
    --text-main: var(--lab-text-primary);
    --text-muted: var(--lab-text-secondary);
    --primary: var(--lab-accent);
    --border-color: var(--lab-border);
    --glass-bg: var(--lab-bg);
}

.dashboard-loading-state {
    padding: 16px;
}

.dashboard-loading-head {
    margin-bottom: 14px;
}

.dashboard-loading-kicker {
    margin: 0 0 4px 0;
    font-size: 0.8rem;
    color: var(--lab-accent);
    font-weight: 600;
    letter-spacing: 0.02em;
    animation: loadingTextFadeIn 0.6s ease-out 0.1s both;
}

.dashboard-loading-head h2 {
    margin: 0;
    color: var(--lab-text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    animation: loadingTextFadeIn 0.6s ease-out 0.15s both;
}

.dashboard-loading-subtitle {
    margin: 4px 0 0 0;
    color: var(--lab-text-secondary);
    font-size: 0.9rem;
    animation: loadingTextFadeIn 0.6s ease-out 0.2s both;
}

.loading-skeleton-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    margin-bottom: 14px;
    animation: skeletonFadeIn 0.6s ease-out 0.3s both;
}

.loading-skeleton-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading-skeleton-chip {
    height: 30px;
    width: 180px;
    border-radius: 8px;
    display: inline-block;
}

.loading-skeleton-chip.short {
    width: 96px;
}

.loading-skeleton-grid {
    margin-top: 0;
}

.semester-switch-loader {
    position: relative;
    height: 4px;
    width: 100%;
    border-radius: 999px;
    overflow: hidden;
    background: var(--lab-sidebar-hover);
    margin: -4px 0 12px;
}

.semester-switch-loader-bar {
    position: absolute;
    inset: 0;
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--lab-accent), var(--primary-hover));
    animation: loadingProgressBar 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.semester-switch-loader-bar.infinite {
    animation: semesterSwitchSlide 0.7s ease-in-out infinite;
    width: 42%;
}

@keyframes loadingProgressBar {
    0% {
        width: 0%;
    }
    25% {
        width: 25%;
    }
    50% {
        width: 50%;
    }
    75% {
        width: 75%;
    }
    100% {
        width: 100%;
    }
}

@keyframes semesterSwitchSlide {
    0% {
        transform: translateX(-120%);
    }
    100% {
        transform: translateX(260%);
    }
}

.loading-skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    pointer-events: none;
    min-height: 155px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
    position: relative;
    overflow: hidden;
    animation: skeletonFadeIn 0.5s ease-out both;
}

.loading-skeleton-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        120deg,
        transparent 0%,
        rgba(59, 130, 246, 0.04) 42%,
        rgba(59, 130, 246, 0.16) 50%,
        rgba(59, 130, 246, 0.04) 58%,
        transparent 100%
    );
    background-size: 220% 100%;
    animation: dashboardCardWave 2s ease-in-out infinite;
    pointer-events: none;
}

.loading-skeleton-card:nth-child(1) { animation-delay: 0.35s; }
.loading-skeleton-card:nth-child(2) { animation-delay: 0.48s; }
.loading-skeleton-card:nth-child(3) { animation-delay: 0.61s; }
.loading-skeleton-card:nth-child(4) { animation-delay: 0.74s; }
.loading-skeleton-card:nth-child(5) { animation-delay: 0.87s; }
.loading-skeleton-card:nth-child(6) { animation-delay: 1.0s; }
.loading-skeleton-card:nth-child(n+7) { animation-delay: 1.0s; }

/* Staggered wave animation for skeleton elements */
.loading-skeleton-line {
    animation-delay: inherit !important;
}

.loading-skeleton-card .loading-skeleton-line:nth-child(1) {
    animation: dashboardWaveShimmer 2s ease-in-out infinite 0s;
}

.loading-skeleton-card .loading-skeleton-line:nth-child(2) {
    animation: dashboardWaveShimmer 2s ease-in-out infinite 0.1s;
}

.loading-skeleton-card .loading-skeleton-line:nth-child(3) {
    animation: dashboardWaveShimmer 2s ease-in-out infinite 0.2s;
}

.loading-skeleton-card .loading-skeleton-owner {
    animation: dashboardWaveShimmer 2s ease-in-out infinite 0.3s;
}

.loading-skeleton-chip:nth-child(1) {
    animation: dashboardWaveShimmer 2s ease-in-out infinite 0s;
}

.loading-skeleton-chip:nth-child(2) {
    animation: dashboardWaveShimmer 2s ease-in-out infinite 0.1s;
}

.loading-skeleton-chip:nth-child(3) {
    animation: dashboardWaveShimmer 2s ease-in-out infinite 0.2s;
}

.loading-skeleton-card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border-color);
}

.loading-skeleton-line {
    display: block;
    height: 10px;
    border-radius: 6px;
}

.loading-skeleton-line.title {
    height: 14px;
    width: 72%;
}

.loading-skeleton-line.medium {
    width: 58%;
}

.loading-skeleton-line.short {
    width: 42%;
}

.loading-skeleton-owner {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.loading-skeleton-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.loading-skeleton-owner-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.skeleton-shimmer {
    background: linear-gradient(
        90deg,
        var(--lab-sidebar-hover) 0%,
        var(--lab-card-bg) 50%,
        var(--lab-sidebar-hover) 100%
    );
    background-size: 200% 100%;
    animation: dashboardWaveShimmer 2s ease-in-out infinite;
}

@keyframes dashboardWaveShimmer {
    0% {
        background-position: 200% 0;
        opacity: 1;
    }
    50% {
        background-position: 0% 0;
        opacity: 1;
    }
    100% {
        background-position: -200% 0;
        opacity: 1;
    }
}

@keyframes dashboardCardWave {
    0% {
        transform: translateX(-16%);
        opacity: 0.18;
    }
    50% {
        transform: translateX(0%);
        opacity: 0.32;
    }
    100% {
        transform: translateX(16%);
        opacity: 0.18;
    }
}

@keyframes loadingTextFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* --- CLASS CODE COPY BUTTON --- */
.class-code-copy-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--lab-bg);
  padding: 6px 12px;
  border-radius: 8px;
  width: fit-content;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--lab-border);
}

.class-code-copy-btn:hover {
  background: var(--lab-sidebar-hover);
  border-color: var(--lab-accent);
}

.class-code-copy-btn code {
  font-size: 12px;
  font-family: monospace;
  color: var(--lab-accent);
  letter-spacing: 1px;
}

.class-code-copy-btn i {
  color: var(--lab-accent);
  font-size: 12px;
  transition: color 0.2s ease;
  opacity: 0.7;
}

.class-code-copy-btn:hover i {
  color: var(--lab-accent);
  opacity: 1;
}

/* --- CLASS LINK COPY BUTTON --- */
.class-link-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  padding: 6px 8px;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  color: var(--lab-accent);
  font-size: 14px;
}

.class-link-copy-btn:hover {
  background: var(--lab-sidebar-hover);
  border-color: var(--lab-accent);
  color: var(--lab-accent);
}

.class-members-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    padding: 6px 8px;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    color: var(--lab-accent);
    font-size: 14px;
}

.class-members-toggle-btn:hover {
    background: var(--lab-sidebar-hover);
    border-color: var(--lab-accent);
    color: var(--lab-accent);
}

/* --- CLASS OPTIONS MENU (Mobile) --- */
.class-options-menu-container {
  position: relative;
  display: flex;
  flex-shrink: 0;
    z-index: 220;
}

.class-options-menu-btn {
  background: none;
  border: none;
  color: var(--lab-accent);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
    min-width: 34px;
    min-height: 34px;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.class-options-menu-btn:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-accent);
}

.class-options-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--lab-card-bg);
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  min-width: 150px;
  margin-top: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  overflow: hidden;
}

.class-options-menu-item {
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  color: var(--lab-text-primary);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  text-align: left;
  font-family: inherit;
  font-weight: 500;
}

.class-options-menu-item:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-accent);
}

.class-options-menu-item i {
  font-size: 0.9rem;
  width: 16px;
}

/* Desktop: Show copy buttons */
.class-code-copy-btn-desktop {
  display: flex;
}

.class-link-copy-btn-desktop {
  display: flex;
}

.active-class-info {
  display: flex;
  align-items: center;
    gap: 10px;
  width: 100%;
  justify-content: flex-start;
}

.active-class-name {
    font-size: 0.92rem;
  font-weight: 600;
  color: var(--lab-text-primary);
  flex-shrink: 1;
  margin-right: auto;
  min-width: 0;
}

/* --- ROOT CONTAINER --- */
#root {
  width: 100%;
  min-width: 100vw;
  overflow-x: hidden;
}

/* --- NAVBAR CONTAINER --- */
.navbar,
.main-header {
  width: 100% !important;
  position: sticky;
  top: 0;
  left: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  display: flex;
  align-items: center;
}

.nav-container {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-main);
  flex-shrink: 0;
}

.logo-icon {
  width: 35px;
  height: 35px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.nav-links a {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-main);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-shrink: 0;
}

/* Navigation Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s;
  outline: none;
}

.nav-dropdown-btn:focus {
  outline: none;
  box-shadow: none;
}

.nav-dropdown-btn:hover,
.nav-dropdown-btn.active {
  color: var(--text-main);
}

.nav-dropdown-btn i {
  font-size: 0.75rem;
  transition: transform 0.2s;
}

.nav-dropdown-btn.active i {
  transform: rotate(180deg);
}

.nav-dropdown-content {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  margin-top: 0.5rem;
  overflow: hidden;
  z-index: 1000;
}

.nav-dropdown-content a,
.nav-dropdown-item {
  display: block !important;
  width: 100%;
  padding: 12px 16px !important;
  color: var(--text-main) !important;
  text-decoration: none !important;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  transition: background 0.2s;
}

.nav-dropdown-content a:last-child,
.nav-dropdown-item:last-child {
  border-bottom: none;
}

.nav-dropdown-content a:hover,
.nav-dropdown-item:hover {
  background: var(--primary-glow);
}

.profile-section {
  position: relative;
}

/* --- MOBILE MENU --- */
.mobile-menu-btn {
  display: none; /* Hidden on desktop */
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

.mobile-menu-btn.sidebar-toggle {
  margin-right: 1rem;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 998;
}

/* --- MAIN CONTENT --- */
main {
    padding: 28px 24px;
    padding-top: 24px;
    width: 100%;
    max-width: 100vw;
    margin: 0 auto;
    min-height: calc(100vh - 70px);
}

main > div {
    max-width: 1400px;
    margin: 0 auto;
}

/* --- PAGE HEADER --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    margin-top: 0;
    flex-wrap: wrap;
    gap: 14px;
    padding: 0 4px;
}

.page-title {
    flex: 1;
    min-width: 200px;
}

.page-title h1 {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.page-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.page-actions .btn,
.page-actions .semester-dropdown-btn {
    min-height: 38px;
}

.page-actions .btn .action-label {
        white-space: nowrap;
}

@media (max-width: 980px) {
    .page-actions {
        gap: 8px;
    }

    .page-actions .semester-selector.semester-regular .semester-label {
        display: none;
    }

    .page-actions .semester-dropdown-btn {
        min-width: auto;
        padding: 8px 10px;
        gap: 6px;
    }

    .page-actions .btn.compact-icon {
        min-width: 38px;
        justify-content: center;
        padding: 8px 10px;
    }

    .page-actions .btn.compact-icon .action-label {
        display: none;
    }

    .page-actions .btn.compact-icon i {
        margin: 0;
        font-size: 0.95rem;
    }
}

/* Semester Selector Styles */
.semester-selector {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    z-index: 100;
    flex-shrink: 0;
}

/* By default, show regular semester selector in page-actions */
.semester-selector.semester-inline {
    display: none;
}

.semester-selector.semester-regular {
    display: flex;
}

.semester-dropdown-btn {
    padding: 8px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-family: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.semester-dropdown-btn:hover {
    border-color: var(--primary);
    background-color: var(--bg-card);
}

.semester-dropdown-btn:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.semester-dropdown-btn i {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

.semester-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 120px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    overflow: visible;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    isolation: isolate;
    pointer-events: auto;
}

.semester-dropdown-item {
    width: 100%;
    padding: 6px 12px;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: auto;
    position: relative;
    z-index: 10001;
}

.semester-dropdown-item:hover {
    background: var(--bg-lighter);
    color: var(--primary);
}

.semester-dropdown-item.active {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* --- BUTTONS --- */
.btn {
    padding: 9px 16px;
    border-radius: 9px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 0.86rem;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: inherit;
    letter-spacing: 0.1px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--text-main);
    transition: all 0.25s ease;
    box-shadow: 0 0 0 1px var(--primary-glow);
}

.btn-secondary:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
}

.btn-danger {
    background: #ef4444;
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-danger:disabled {
    background: rgba(239, 68, 68, 0.2);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* --- EMPTY STATE --- */
.empty-state {
    text-align: center;
    padding: 100px 40px;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-state-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.05));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 32px;
    border: none;
}

.empty-state-icon i {
    font-size: 2.5rem;
    color: var(--primary);
    opacity: 0.8;
}

.empty-state h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 40px;
    line-height: 1.7;
    font-size: 0.95rem;
    max-width: 500px;
}

.empty-state-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

/* --- LABS GRID --- */
.labs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}

/* --- LAB CARD --- */
.lab-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.lab-card.menu-open {
    overflow: visible !important;
    z-index: 1200;
}

.lab-card.menu-open .lab-card-menu-container {
    z-index: 1300;
}

.lab-card.menu-open .lab-card-dropdown {
    z-index: 1400;
}

.lab-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 45px;
    background: linear-gradient(135deg, var(--primary), rgba(99, 102, 241, 0.8));
    opacity: 0.9;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
    z-index: 0;
}

.lab-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.lab-card-menu-container {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
}

.lab-card-menu-btn {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    font-size: 1rem;
}

.lab-card-menu-btn:hover {
    background: rgba(15, 23, 42, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
}

.lab-card-dropdown {
    position: absolute;
    top: 38px;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    width: 170px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 100;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.lab-card-dropdown .dropdown-item {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

.lab-card-dropdown .dropdown-item:hover {
    background: var(--bg-lighter);
}

.lab-card-dropdown .dropdown-item i {
    width: 16px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.lab-card-dropdown .dropdown-item:hover i {
    color: var(--text-main);
}

.lab-card-dropdown .dropdown-item.logout {
    color: #f87171;
}

.lab-card-dropdown .dropdown-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.lab-card-dropdown .dropdown-item.logout i {
    color: #f87171;
}


.lab-card-clickable {
    cursor: pointer;
}

/* Banner styles removed - gradient now applied to .lab-card::before */

.lab-card-content {
    padding: 14px;
    padding-top: 60px;
    position: relative;
    z-index: 1;
}

/* When no owner section is shown (guest/direct access mode), reduce card size */
.lab-card:not(:has(.lab-card-owner)) .lab-card-content {
    padding-top: 45px;
}

.lab-card:not(:has(.lab-card-owner))::before {
    height: 32px;
}



.lab-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Description wrapper - reserves space for 1 line on desktop for alignment */
.lab-card-description-wrapper {
    min-height: 28px; /* 1 line × 1.5 line-height × 0.8rem font + 8px margin */
    margin-bottom: 8px;
}

.lab-card-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    transition: all 0.3s ease;
    padding: 3px 5px;
    border-radius: 4px;
}

.lab-card-description.is-expandable {
    cursor: pointer;
}

.lab-card-description.is-expandable:hover {
    background: var(--lab-sidebar-hover);
}

.lab-card-description.expanded {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    max-height: none;
    background: var(--lab-sidebar-hover);
}

.role-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--primary-glow);
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge.demo {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.lab-card-owner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 0;
}

.owner-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    background: var(--bg-lighter);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.8rem;
}

.owner-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.owner-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.owner-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.lab-card-institute {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lab-card-stats {
    display: flex;
    gap: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stat-item i {
    color: var(--primary);
}

.lab-card-code {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    padding: 6px 12px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.lab-card-code:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lab-card-code button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.lab-card-code button:hover {
    color: white;
}

.demo-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 1;
}

.demo-badge i {
    font-size: 0.7rem;
}

.lab-card.demo-lab {
    border: 2px solid #f59e0b;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.2);
}

.lab-card.demo-lab:hover {
    border-color: #fbbf24;
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.3);
}

/* --- LOADING SPINNER --- */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    padding: 60px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- MODALS --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- MOBILE RESPONSIVE MODALS --- */
@media (max-width: 767px) {
    .modal {
        max-width: 90vw;
        max-height: 90vh;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 16px 20px;
    }
    
    .modal-footer {
        padding: 16px 20px;
    }
    
    .modal-actions {
        padding: 16px 20px;
        margin: -16px -20px 0 -16px;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .modal-overlay {
        padding: 16px;
        align-items: flex-end;
    }
    
    .modal {
        max-width: calc(100vw - 32px);
        max-height: 85vh;
        border-radius: 12px 12px 0 0;
        width: 100%;
        margin: 0 auto;
    }
    
    .modal-header {
        padding: 14px 16px;
        gap: 8px;
    }
    
    .modal-header h2 {
        font-size: 1.1rem;
        margin: 0;
    }
    
    .modal-close {
        width: 28px;
        height: 28px;
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    .modal-footer {
        padding: 12px 16px;
        gap: 10px;
    }
    
    .modal-actions {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px 16px;
        margin: -14px -16px 0 -16px;
    }
    
    .modal-actions .btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
        justify-content: center;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 16px;
        min-height: 40px;
    }
}

@media (max-width: 320px) {
    .modal-overlay {
        padding: 8px;
    }
    
    .modal {
        max-width: calc(100vw - 16px);
        border-radius: 10px 10px 0 0;
    }
    
    .modal-header {
        padding: 12px 14px;
    }
    
    .modal-header h2 {
        font-size: 1rem;
    }
    
    .modal-body {
        padding: 12px 14px;
        font-size: 13px;
    }
    
    .modal-footer {
        padding: 10px 14px;
    }
    
    .modal-actions {
        padding: 10px 14px;
        margin: -12px -14px 0 -14px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
    }
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: var(--text-main);
    background: var(--bg-input);
}

.modal-body {
    padding: 28px;
}

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Ensure proper flow in modals with actions */
.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 28px;
    padding: 20px 28px;
    border-top: 1px solid var(--border-color);
    margin: -28px -28px 0 -28px;
    background: var(--bg-card);
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
}

.modal-actions .btn {
    margin: 0;
}

.modal-actions .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- COMPACT PROFILE COMPLETION MODAL --- */
/* Make profile modal more compact to fit on one screen without scrolling */
.modal-overlay:has(h2:contains("Complete Your Profile")) .modal-content,
.profile-completion-modal {
    max-width: 500px;
    max-height: auto;
}

.profile-completion-modal .modal-header {
    padding: 16px 20px;
}

.profile-completion-modal .modal-header h2 {
    font-size: 1.2rem;
}

.profile-completion-modal .modal-body {
    padding: 16px 20px;
    flex: none;
    overflow: visible;
}

.profile-completion-modal .form-group {
    margin-bottom: 14px;
}

.profile-completion-modal .modal-body label {
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.profile-completion-modal .form-group label {
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.profile-completion-modal .form-group input,
.profile-completion-modal .form-group select {
    padding: 10px 12px;
    font-size: 0.9rem;
    min-height: 40px;
}

.profile-completion-modal .dropdown-list {
    max-height: 200px;
    overflow-y: auto;
}

.profile-completion-modal .modal-actions {
    margin-top: 16px;
    padding: 14px 20px;
    margin: -16px -20px 0 -20px;
    gap: 10px;
}

@media (max-width: 767px) {
    .profile-completion-modal .modal-actions {
        grid-template-columns: 1fr;
        padding: 12px 16px;
        margin: -16px -16px 0 -16px;
    }
}

@media (max-width: 480px) {
    .profile-completion-modal {
        max-width: calc(100vw - 32px);
    }
    
    .profile-completion-modal .modal-header {
        padding: 14px 16px;
    }
    
    .profile-completion-modal .modal-body {
        padding: 14px 16px;
    }
    
    .profile-completion-modal .modal-actions {
        grid-template-columns: 1fr;
        padding: 12px 16px;
        margin: -14px -16px 0 -16px;
        gap: 10px;
    }
    
    .profile-completion-modal .form-group {
        margin-bottom: 14px;
    }
    
    .profile-completion-modal .form-group input,
    .profile-completion-modal .form-group select {
        font-size: 16px;
        padding: 10px 12px;
        min-height: 40px;
    }
    
    .profile-completion-modal .dropdown-list {
        max-height: 150px;
        font-size: 13px;
    }
    
    .profile-completion-modal .error-message {
        font-size: 13px;
        padding: 10px 12px;
    }
}

.profile-completion-modal .error-message {
    font-size: 0.85rem;
    margin-bottom: 12px;
}

/* --- CONFIRMATION MODAL STYLES --- */
.confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    backdrop-filter: blur(4px);
    padding: 20px;
}

.confirm-modal-content {
    background: var(--lab-bg-secondary);
    padding: 28px;
    border-radius: 14px;
    width: 90%;
    max-width: 420px;
    border: 1px solid var(--lab-border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    max-height: 88vh;
    overflow-y: auto;
}

/* --- MOBILE RESPONSIVE CONFIRMATION MODAL --- */
@media (max-width: 767px) {
    .confirm-modal-overlay {
        padding: 16px;
    }
    
    .confirm-modal-content {
        padding: 20px;
        border-radius: 12px;
        max-width: 100%;
        max-height: 85vh;
    }
    
    .confirm-modal-title {
        font-size: 1.1rem;
    }
    
    .confirm-modal-desc {
        font-size: 0.85rem;
    }
    
    .confirm-modal-inputs input {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .confirm-modal-actions {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .confirm-modal-overlay {
        padding: 12px;
        align-items: flex-end;
    }
    
    .confirm-modal-content {
        width: calc(100vw - 24px);
        padding: 16px;
        border-radius: 12px 12px 0 0;
        max-height: 85vh;
    }
    
    .confirm-modal-header {
        margin-bottom: 16px;
    }
    
    .confirm-modal-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 8px;
    }
    
    .confirm-modal-icon i {
        font-size: 1.3rem;
    }
    
    .confirm-modal-title {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .confirm-modal-desc {
        font-size: 0.8rem;
        line-height: 1.5;
        margin-bottom: 14px;
    }
    
    .confirm-modal-info-box {
        padding: 10px 12px;
        margin-bottom: 14px;
        border-radius: 8px;
    }
    
    .confirm-info-field {
        margin-bottom: 8px;
    }
    
    .confirm-info-label {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }
    
    .confirm-info-value {
        font-size: 0.9rem;
    }
    
    .confirm-modal-inputs {
        gap: 10px;
        margin-bottom: 16px;
    }
    
    .confirm-input-group label {
        font-size: 0.85rem;
        margin-bottom: 4px;
    }
    
    .confirm-modal-inputs input {
        padding: 10px 12px;
        font-size: 16px;
        min-height: 40px;
    }
    
    .confirm-modal-actions {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .confirm-modal-actions .btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
        justify-content: center;
    }
}

@media (max-width: 320px) {
    .confirm-modal-overlay {
        padding: 8px;
    }
    
    .confirm-modal-content {
        width: calc(100vw - 16px);
        padding: 12px;
        border-radius: 10px 10px 0 0;
    }
    
    .confirm-modal-title {
        font-size: 0.95rem;
    }
    
    .confirm-modal-desc {
        font-size: 0.75rem;
    }
    
    .confirm-modal-inputs input {
        font-size: 16px;
    }
}

.confirm-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.confirm-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}

.confirm-modal-icon i {
    font-size: 1.5rem;
    color: #ef4444;
}

.confirm-modal-title {
    color: var(--lab-text-primary);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    letter-spacing: -0.3px;
}

.confirm-modal-desc {
    color: var(--lab-text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.confirm-modal-desc strong {
    color: var(--lab-text-primary);
    font-weight: 600;
}

.confirm-modal-info-box {
    padding: 14px;
    background: var(--lab-bg-primary);
    border-radius: 10px;
    border: 1px solid var(--lab-border-color);
    margin-bottom: 20px;
}

.confirm-info-field {
    margin-bottom: 12px;
}

.confirm-info-field:last-child {
    margin-bottom: 0;
}

.confirm-info-label {
    color: var(--lab-text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.confirm-info-value {
    color: var(--lab-text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
}

.confirm-modal-inputs {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.confirm-input-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--lab-text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.confirm-input-group strong {
    color: var(--lab-text-primary);
    font-weight: 700;
}

.confirm-modal-inputs input {
    width: 100%;
    padding: 11px 13px;
    background: var(--lab-bg-primary);
    border: 2px solid var(--lab-border-color);
    color: var(--lab-text-primary);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

.confirm-modal-inputs input:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.confirm-modal-inputs input:focus {
    border-color: var(--lab-accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.confirm-modal-inputs input.input-success {
    border-color: #10b981;
}

.confirm-modal-inputs input.input-error {
    border-color: #ef4444;
}

.confirm-modal-inputs input::placeholder {
    color: var(--lab-text-secondary);
}

.confirm-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Error Message Styles */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    word-break: break-word;
}

@media (max-width: 480px) {
    .error-message {
        font-size: 0.85rem;
        padding: 10px 12px;
        margin-bottom: 14px;
    }
}

@media (max-width: 320px) {
    .error-message {
        font-size: 0.8rem;
        padding: 8px 10px;
    }
}

/* --- FORM STYLES --- */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.2px;
}

.form-group label .required {
    color: var(--error);
}

.modal-body label .required {
    color: var(--error);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: all 0.2s ease;
    min-height: 44px;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: rgba(99, 102, 241, 0.3);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-input);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group .helper-text,
.form-group .form-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.form-group .form-hint i {
    margin-right: 6px;
    color: var(--primary);
}

/* --- LAB INTERNAL PAGE --- */
.lab-internal-page {
    width: 100%;
    min-width: 100vw;
}

.lab-layout {
    width: 100%;
    max-width: 100vw;
}

.main-content {
    width: 100%;
    max-width: 100%;
}

/* Base modal-content style for desktop */
.modal-content {
    width: 100%;
    max-width: 600px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content form {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.modal-content .modal-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 28px;
}

/* Scrollbar styling for modal body */
.modal-content .modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-content .modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content .modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.modal-content .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.4);
}

/* --- JOIN VIA LINK MODAL --- */
.join-via-link-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--lab-bg);
  border-radius: 12px;
  text-align: center;
}

.join-via-link-info i {
  font-size: 48px;
  color: var(--lab-accent);
  opacity: 0.8;
}

.join-via-link-info p {
  margin: 0;
  color: var(--lab-text-primary);
  font-size: 14px;
  line-height: 1.5;
}

.join-via-link-info .class-code-display {
  background: var(--lab-input-bg);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--lab-border);
  margin: 8px 0;
}

.join-via-link-info .class-code-display code {
  font-size: 16px;
  font-family: monospace;
  color: var(--lab-accent);
  letter-spacing: 1px;
  font-weight: 500;
}

.join-via-link-info .join-info-message {
  font-size: 13px;
  color: var(--lab-text-secondary);
  font-style: italic;
}

/* --- CLASS DETAILS DISPLAY --- */
.class-details-display {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--lab-input-bg);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--lab-border);
  margin: 12px 0;
  width: 100%;
}

.class-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.class-detail-item .detail-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--lab-text-secondary);
  font-weight: 600;
}

.class-detail-item .detail-value {
  font-size: 15px;
  color: var(--lab-text-primary);
  font-weight: 500;
}

/* ==========================================
   MOBILE RESPONSIVE STYLES
   ========================================== */

@media (max-width: 600px) {
  /* Show mobile menu button */
  .mobile-menu-btn {
    display: block !important;
  }
  
  /* Hide sidebar toggle on mobile (only show nav toggle) */
  .mobile-menu-btn.sidebar-toggle {
    display: none !important;
  }

  /* Sidebar mobile behavior */
  .sidebar {
    position: fixed !important;
    left: -280px; /* Hidden off-screen */
        top: calc(60px + var(--offline-banner-height, 0px)); /* Below navbar and offline banner */
    bottom: 0;
    width: 280px !important;
    transition: left 0.3s ease !important;
    z-index: 999 !important;
    background: var(--bg-secondary, #1e293b) !important;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
  }

  .sidebar.open {
    left: 0 !important; /* Slide in */
  }

  /* Show overlay when sidebar is open */
  .sidebar-overlay {
    display: block !important;
  }
  
  /* Mobile nav links */
  .nav-links {
    position: fixed;
    top: 70px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 70px);
    background: var(--bg-dark);
    flex-direction: column;
    justify-content: flex-start;
    padding: 2rem;
    transition: left 0.3s ease;
    z-index: 99;
  }
  
  .nav-links.active {
    left: 0;
  }
  
  /* Hide logo text on very small screens */
  .logo span {
    display: inline;
  }

  /* Full width content on mobile */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .lab-layout {
    flex-direction: column;
  }

  /* Reduce padding on mobile */
  main {
    padding: 20px 15px 40px !important;
  }

  .page-header h1 {
    font-size: 1.75rem;
  }

  .semester-dropdown {
    width: 100%;
    min-width: auto;
  }

  /* Stack buttons vertically */
  .page-header .header-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .page-header .header-actions button {
    width: 100%;
  }

  /* Lab grid responsive */
  .labs-grid {
    grid-template-columns: 1fr !important;
  }

  /* Remove fixed height for description on mobile (cards stack vertically) */
  .lab-card-description-wrapper {
    min-height: 0;
    margin-bottom: 0;
  }

  .lab-card-description {
    margin-bottom: 10px;
  }

  /* Reduce card padding on mobile */
  .lab-card-content {
    padding: 12px;
  }

  /* Modal full screen on mobile */
  .modal-content {
    width: 95% !important;
    max-width: 95% !important;
    margin: 1rem !important;
  }
    .toast-container {
        bottom: 15px;
        right: 15px;
        left: 15px;
    }

    .toast {
        min-width: unset;
        max-width: unset;
        width: 100%;
    }
}

/* Compact layout for small mobile screens (321px - 480px) */
@media (max-width: 480px) and (min-width: 321px) {
  /* Reduce main padding on mobile */
  main {
        padding: 20px 14px calc(44px + env(safe-area-inset-bottom, 0px)) !important;
  }

    .labs-grid {
        padding-bottom: calc(36px + env(safe-area-inset-bottom, 0px));
    }

  /* Adjust page-header padding */
  .page-header {
    padding: 0 !important;
    gap: 14px !important;
    flex-direction: column !important;
        align-items: stretch !important;
    }

    .page-title {
        width: 100% !important;
  }

  /* Hide desktop copy buttons on mobile */
  .class-code-copy-btn-desktop,
  .class-link-copy-btn-desktop {
    display: none !important;
  }

  /* Hide regular semester selector in page-actions */
  .semester-selector.semester-regular {
    display: none !important;
  }

  /* Show inline semester selector within active-class-info */
  .semester-selector.semester-inline {
    display: flex !important;
    flex-shrink: 0 !important;
    flex-direction: row !important;
    position: relative;
    z-index: 150;
    pointer-events: auto !important;
  }

  /* Hide "Semester " label text - show only number */
  .semester-selector.semester-inline .semester-label {
    display: none !important;
  }

  /* Make inline semester button more compact - number only */
  .semester-selector.semester-inline .semester-dropdown-btn {
    min-width: auto !important;
    padding: 5px 10px !important;
    font-size: 0.85rem !important;
    gap: 4px !important;
    pointer-events: auto !important;
    cursor: pointer !important;
  }

  .semester-selector.semester-inline .semester-dropdown-btn i {
    font-size: 0.6rem !important;
  }

  /* Ensure dropdown menu stays within screen bounds - align to right edge */
  .semester-selector.semester-inline .semester-dropdown-menu {
    right: 0 !important;
    left: auto !important;
    min-width: 110px !important;
    z-index: 10000 !important;
    pointer-events: auto !important;
  }

  /* Adjust active-class-info to keep everything in one line */
  .active-class-info {
    gap: 10px !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
    justify-content: flex-start !important;
    width: 100% !important;
  }

  /* Hide scrollbar for Chrome, Safari and Opera */
  .active-class-info::-webkit-scrollbar {
    display: none;
  }

  /* Make class name more compact - allow it to shrink */
  .active-class-name {
    font-size: 0.85rem !important;
        white-space: normal !important;
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
    margin-right: auto !important;
    padding-right: 12px !important;
  }

    .semester-selector.semester-inline,
    .class-options-menu-container {
        margin-left: 0 !important;
        flex-shrink: 0 !important;
    }

    /* Keep actions inline first, then wrap only if the viewport is too tight */
  .page-header .page-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: flex-end !important;
        width: 100%;
        gap: 8px !important;
        align-items: center !important;
    }

    .page-actions .btn,
    .page-actions .semester-dropdown-btn {
        width: auto;
        flex: 0 0 auto;
        margin-left: 0 !important;
        justify-content: center;
        min-height: 34px;
        padding: 6px 8px;
        font-size: 0.82rem;
  }
}

/* Styles for larger mobile/tablet (481px - 768px) */
@media (max-width: 767px) and (min-width: 481px) {
    .page-header {
        flex-direction: row;
        align-items: center;
        padding: 0 !important;
        gap: 8px !important;
        flex-wrap: nowrap;
    }

        .page-title {
                width: auto !important;
                min-width: 0 !important;
                flex: 1 1 auto;
        }

  .page-header h1 {
    font-size: 1.5rem;
  }

  .btn {
    padding: 10px 16px;
    font-size: 0.9rem;
  }

  .lab-card {
    padding: 1rem;
  }

  /* Hide desktop copy buttons */
  .class-code-copy-btn-desktop,
  .class-link-copy-btn-desktop {
    display: none !important;
  }

  /* Hide regular semester selector in page-actions */
  .semester-selector.semester-regular {
    display: none !important;
  }

  /* Show inline semester selector */
  .semester-selector.semester-inline {
    display: flex !important;
    flex-shrink: 0 !important;
    position: relative;
    z-index: 150;
  }

  /* Make inline semester button compact */
  .semester-selector.semester-inline .semester-dropdown-btn {
    min-width: auto !important;
    padding: 6px 12px !important;
    font-size: 0.9rem !important;
    gap: 6px !important;
    pointer-events: auto !important;
  }

  .semester-selector.semester-inline .semester-dropdown-menu {
    right: 0 !important;
    left: auto !important;
    min-width: 130px !important;
    z-index: 10000 !important;
  }

  /* Adjust active-class-info layout */
  .active-class-info {
    gap: 8px !important;
    flex-wrap: nowrap !important;
        overflow: visible !important;
    justify-content: flex-start !important;
    width: 100% !important;
    align-items: center !important;
        position: relative;
  }

  .active-class-name {
    font-size: 0.9rem !important;
    white-space: nowrap !important;
    flex-shrink: 1 !important;
    min-width: 80px !important;
    margin-right: auto !important;
    padding-right: 8px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .semester-selector.semester-inline,
  .class-options-menu-container {
    margin-left: 0 !important;
    flex-shrink: 0 !important;
  }

        /* Keep action controls in one row */
  .page-header .page-actions {
        display: flex !important;
        width: auto;
        gap: 6px !important;
    justify-content: flex-end !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        margin-left: auto;
        flex-shrink: 0;
    }

    .page-actions .btn,
    .page-actions .semester-dropdown-btn {
        margin-left: 0 !important;
        min-height: 34px;
        padding: 6px 10px;
    width: auto;
    flex: 0 0 auto;
    min-width: auto;
  }
}

@media(max-width: 320px){
    /* Extra compact layout for very small screens */
    main {
        padding: 16px 12px calc(44px + env(safe-area-inset-bottom, 0px));
    }

    .labs-grid {
        padding-bottom: calc(36px + env(safe-area-inset-bottom, 0px));
    }

    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 0 !important;
        margin-bottom: 16px;
        gap: 12px;
    }

    .page-title {
        width: 100% !important;
    }

    /* Hide desktop copy buttons */
    .class-code-copy-btn-desktop,
    .class-link-copy-btn-desktop {
        display: none !important;
    }

    /* Keep everything in one line like larger screens */
    .active-class-info {
        gap: 6px !important;
        flex-wrap: nowrap !important;
        overflow: visible !important;
        justify-content: flex-start !important;
        width: 100% !important;
    }

    /* Make class name shrink with ellipsis */
    .active-class-name {
        font-size: 0.85rem !important;
        white-space: normal !important;
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        flex-shrink: 1 !important;
        min-width: 0 !important;
        margin-right: auto !important;
        padding-right: 10px !important;
    }

    /* Make semester selector compact - show only number */
    .semester-selector.semester-inline {
        flex-shrink: 0 !important;
        display: flex !important;
        position: relative;
        z-index: 150;
        pointer-events: auto !important;
    }

    /* Hide regular semester selector */
    .semester-selector.semester-regular {
        display: none !important;
    }

    /* Show inline semester selector */
    .semester-selector.semester-inline {
        display: flex !important;
    }

    .semester-selector.semester-inline + .class-options-menu-container {
        margin-left: -2px !important;
    }

    .page-header .page-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        width: 100%;
        gap: 6px !important;
        align-items: center !important;
    }

    .page-actions .btn,
    .page-actions .semester-dropdown-btn {
        width: auto;
        flex: 1 1 0;
        min-width: 0;
        margin-left: 0 !important;
        justify-content: center;
        min-height: 32px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    /* Hide "Semester " label text - show only number */
    .semester-selector.semester-inline .semester-label {
        display: none !important;
    }

    /* Make inline semester button more compact - number only */
    .semester-selector.semester-inline .semester-dropdown-btn {
        min-width: auto !important;
        padding: 5px 10px !important;
        font-size: 0.85rem !important;
        gap: 4px !important;
        pointer-events: auto !important;
        cursor: pointer !important;
    }

    .semester-selector.semester-inline .semester-dropdown-btn i {
        font-size: 0.6rem !important;
    }

    /* Ensure dropdown menu stays within screen bounds - align to right edge */
    .semester-selector.semester-inline .semester-dropdown-menu {
        right: 0 !important;
        left: auto !important;
        min-width: 110px !important;
        z-index: 10000 !important;
        pointer-events: auto !important;
    }

    /* Make options menu stay inline */
    .class-options-menu-container {
        flex-shrink: 0 !important;
        margin-left: 0 !important;
    }

    .lab-card-content {
        padding-top: 42px;
        padding-bottom: 10px;
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Adjust subject name styling for 320px */
    .lab-card-title {
        font-size: 1.05rem;
        line-height: 1.3;
        word-break: break-word;
        margin-bottom: 5px;
    }

    /* Adjust description for 320px */
    .lab-card-description-wrapper {
        min-height: 0;
        margin-bottom: 0;
    }

    .lab-card-description {
        font-size: 0.75rem;
        margin-bottom: 6px;
        padding: 2px 4px;
    }

    /* Compact owner section for 320px */
    .owner-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .owner-label {
        font-size: 0.65rem;
    }

    .owner-name {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .page-actions.single-primary-action .btn.compact-icon .action-label {
        display: inline !important;
    }

    .page-actions.single-primary-action .btn.compact-icon {
        justify-content: center !important;
    }

    .page-actions.single-primary-action .btn.compact-icon i {
        margin-right: 6px !important;
    }
}

/* --- TOAST NOTIFICATIONS --- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-left: 4px solid var(--accent-green);
    border-radius: 8px;
    padding: 14px 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 380px;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
}

.toast-content i {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-success {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    backdrop-filter: blur(10px);
}

.toast-success .toast-content {
    color: #10b981;
}

.toast-error {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    backdrop-filter: blur(10px);
}

.toast-error .toast-content {
    color: #ef4444;
}

.toast-info {
    border-left-color: var(--primary);
    background: rgba(99, 102, 241, 0.12);
    backdrop-filter: blur(10px);
}

.toast-info .toast-content {
    color: var(--primary);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Dropdown Input Styles */
.dropdown-input-wrapper {
    position: relative;
    width: 100%;
}

.dropdown-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.dropdown-input:hover {
    border-color: var(--primary);
}

.dropdown-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.dropdown-input:disabled {
    background: var(--bg-secondary);
    opacity: 0.6;
    cursor: not-allowed;
}

.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Hide scrollbar for dropdown-list */
.dropdown-list::-webkit-scrollbar {
    display: none;
}

.dropdown-list {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.dropdown-placeholder,
.dropdown-error {
    padding: 12px;
    color: var(--text-muted);
    text-align: center;
    font-size: 13px;
}

.dropdown-error {
    color: #ef4444;
}

.dropdown-list-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--bg-lighter);
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px;
}

.dropdown-list-item:hover {
    background: var(--bg-lighter);
}

.dropdown-list-item:last-child {
    border-bottom: none;
}

.dropdown-item-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.dropdown-item-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
     DASHBOARD MEMBERS VIEW (LabInternal Parity)
     ============================================ */
.dashboard-members-container {
    padding: 32px;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.dashboard-members-container .members-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dashboard-members-container .members-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--lab-text-primary);
    margin: 0;
}

.dashboard-members-container .members-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dashboard-members-container .members-count {
    font-size: 14px;
    font-weight: 500;
    color: var(--lab-text-primary);
}

.dashboard-members-container .members-invite-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--lab-accent);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.dashboard-members-container .members-invite-btn:hover {
    background: var(--lab-accent-gradient);
    opacity: 0.9;
}

.dashboard-members-container .members-toolbar {
    background: var(--lab-card-bg);
    border: 1px solid var(--lab-border);
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.dashboard-members-container .toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dashboard-members-container .toolbar-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--lab-accent);
    border: 1px solid var(--lab-text-muted);
    border-radius: 4px;
    background: transparent;
}

.dashboard-members-container .toolbar-actions-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--lab-btn-secondary);
    border: 1px solid var(--lab-border);
    color: var(--lab-text-secondary);
    font-size: 13px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.dashboard-members-container .toolbar-actions-btn:hover {
    color: var(--lab-text-primary);
    border-color: var(--lab-text-muted);
}

.dashboard-members-container .toolbar-sort-btn {
    background: var(--lab-btn-secondary);
    border: 1px solid var(--lab-border);
    color: var(--lab-text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
}

.dashboard-members-container .toolbar-sort-btn:hover {
    color: var(--lab-text-primary);
    border-color: var(--lab-text-muted);
}

.dashboard-members-container .members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 0;
}

.dashboard-members-container .member-card {
    background: var(--lab-card-bg);
    border: 1px solid var(--lab-border);
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.dashboard-members-container .member-card.selected {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--lab-accent);
}

.dashboard-members-container .member-card:hover {
    background: var(--lab-sidebar-hover);
    border-color: var(--lab-text-muted);
}

.dashboard-members-container .member-checkbox {
    width: 18px;
    height: 18px;
    min-width: 18px;
    accent-color: var(--lab-accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.dashboard-members-container .member-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--lab-btn-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--lab-text-primary);
    font-size: 14px;
    overflow: hidden;
    flex-shrink: 0;
}

.dashboard-members-container .member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dashboard-members-container .member-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.dashboard-members-container .member-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--lab-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-members-container .member-email {
    font-size: 12px;
    color: var(--lab-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-members-container .member-badge {
    color: #fbbf24;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.dashboard-members-container .member-menu-btn {
    background: transparent;
    border: none;
    color: var(--lab-text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.dashboard-members-container .member-menu-btn:hover {
    color: var(--lab-text-primary);
    background: var(--lab-btn-secondary);
}

.dashboard-members-container .dropdown-menu {
    position: absolute;
    background: var(--lab-card-bg);
    border: 1px solid var(--lab-border);
    border-radius: 6px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    padding: 6px;
    display: none;
    flex-direction: column;
    z-index: 1000;
}

.dashboard-members-container .dropdown-menu.active {
    display: flex;
}

.dashboard-members-container .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--lab-text-secondary);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    width: 100%;
}

.dashboard-members-container .dropdown-item:hover {
    background: var(--lab-btn-secondary);
    color: var(--lab-text-primary);
}

.dashboard-members-container .dropdown-item.active {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.dashboard-members-container .dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.dashboard-members-container .dropdown-item.text-danger {
    color: #ef4444;
}

.dashboard-members-container .dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.dashboard-members-container .members-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.dashboard-members-container .members-empty i {
    font-size: 48px;
    color: #334155;
    margin-bottom: 16px;
}

.dashboard-members-container .members-empty h3 {
    font-size: 20px;
    color: #e2e8f0;
    margin: 0 0 8px 0;
}

.dashboard-members-container .members-empty p {
    color: #94a3b8;
    margin: 0;
}

@media (max-width: 480px) {
    .dashboard-members-container {
        padding: 12px;
    }

    .dashboard-members-container .members-title {
        font-size: 18px;
    }

    .dashboard-members-container .members-list {
        gap: 6px;
    }

    .dashboard-members-container .member-card {
        padding: 10px 12px;
        gap: 10px;
    }

    .dashboard-members-container .member-name {
        font-size: 13px;
    }

    .dashboard-members-container .member-email {
        font-size: 11px;
    }

    .dashboard-members-container .member-badge {
        font-size: 9px;
    }

    .dashboard-members-container .member-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .dashboard-members-container .members-toolbar {
        padding: 10px 12px;
        gap: 10px;
    }

    .dashboard-members-container .toolbar-left {
        gap: 10px;
    }

    .dashboard-members-container .toolbar-actions-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .dashboard-members-container .toolbar-sort-btn {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 320px) {
    .dashboard-members-container {
        padding: 8px;
    }

    .dashboard-members-container .members-count {
        font-size: 11px;
    }

    .dashboard-members-container .member-card {
        padding: 8px 10px;
        gap: 8px;
    }

    .dashboard-members-container .member-name {
        font-size: 12px;
    }

    .dashboard-members-container .member-email {
        font-size: 10px;
        line-height: 1;
    }

    .dashboard-members-container .member-info {
        gap: 0;
    }

    .dashboard-members-container .member-badge {
        font-size: 6px;
        letter-spacing: 0;
    }

    .dashboard-members-container .member-menu-btn {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }

    .dashboard-members-container .member-avatar {
        width: 20px;
        height: 20px;
        font-size: 8px;
    }

    .dashboard-members-container .member-checkbox {
        width: 12px;
        height: 12px;
    }

    .dashboard-members-container .members-toolbar {
        padding: 6px;
        gap: 4px;
    }

    .dashboard-members-container .toolbar-actions-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .dashboard-members-container .toolbar-sort-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .dashboard-members-container .members-invite-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

.lab-dashboard-archive-notice {
    position: fixed;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    z-index: 9000;
}

.lab-dashboard-archive-notice a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.lab-dashboard-archive-notice a:hover {
    color: var(--primary-hover);
}

.archive-visibility-note {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    cursor: pointer;
    border-radius: 8px;
    transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.archive-visibility-note input[type="checkbox"] {
    margin-top: 0;
    accent-color: var(--primary);
}

.archive-visibility-note span {
    word-break: break-word;
}

.archive-restore-path {
    color: var(--primary);
    font-weight: 600;
}

.archive-visibility-note.attention {
    animation: archiveCheckboxAttentionPulse 0.9s ease-in-out 1;
}

@keyframes archiveCheckboxAttentionPulse {
    0%,
    100% {
        box-shadow: none;
        background-color: transparent;
    }
    20%,
    60% {
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.45), 0 0 16px rgba(59, 130, 246, 0.35);
        background-color: rgba(59, 130, 246, 0.08);
    }
    40%,
    80% {
        box-shadow: none;
        background-color: transparent;
    }
}



/* Scrollbar layout fix: keep scrollbar below header for LabDashboard */
body:has(.lab-dashboard-scroll-container) {
    overflow: hidden;
}

body:has(.lab-dashboard-scroll-container) #root {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.lab-dashboard-scroll-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
.guest-mode-warning-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.guest-mode-warning-modal {
  background: #f3f4f6;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

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

.guest-mode-warning-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.guest-mode-warning-icon-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guest-mode-icon {
  color: #f59e0b;
  flex-shrink: 0;
}

.guest-mode-warning-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
}

.guest-mode-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: color 0.2s;
}

.guest-mode-close-btn:hover {
  color: #1f2937;
}

.guest-mode-warning-content {
  padding: 24px;
  color: #374151;
  line-height: 1.6;
}

.guest-mode-warning-content p {
  margin: 0 0 16px 0;
  font-size: 14px;
}

.guest-mode-warning-content strong {
  color: #1f2937;
}

.guest-mode-limitations {
  background-color: #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 6px;
  padding: 16px;
  margin: 16px 0;
}

.limitation-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 13px;
}

.limitation-item:last-child {
  margin-bottom: 0;
}

.limitation-icon {
  flex-shrink: 0;
  font-size: 16px;
}

.limitation-text {
  flex: 1;
  color: #333;
}

.limitation-text strong {
  color: #1f2937;
}

.guest-mode-cta {
  background-color: #eff6ff;
  border-left: 4px solid #0284c7;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 13px;
  margin: 16px 0;
}

.guest-mode-warning-actions {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #e5e7eb;
}

.guest-mode-close-link-btn,
.guest-mode-login-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.guest-mode-close-link-btn {
  background-color: #f3f4f6;
  color: #374151;
}

.guest-mode-close-link-btn:hover {
  background-color: #e5e7eb;
}

.guest-mode-login-btn {
  background-color: #3b82f6;
  color: white;
}

.guest-mode-login-btn:hover {
  background-color: #2563eb;
}

/* Dark mode support */
.guest-mode-warning-modal.dark-mode {
  background: #111827;
}

.guest-mode-warning-modal.dark-mode .guest-mode-warning-header {
  border-bottom-color: #374151;
}

.guest-mode-warning-modal.dark-mode .guest-mode-warning-header h2 {
  color: #f3f4f6;
}

.guest-mode-warning-modal.dark-mode .guest-mode-close-btn {
  color: #9ca3af;
}

.guest-mode-warning-modal.dark-mode .guest-mode-close-btn:hover {
  color: #f3f4f6;
}

.guest-mode-warning-modal.dark-mode .guest-mode-warning-content {
  color: #d1d5db;
}

.guest-mode-warning-modal.dark-mode .guest-mode-warning-content strong,
.guest-mode-warning-modal.dark-mode .limitation-text strong {
  color: #f3f4f6;
}

.guest-mode-warning-modal.dark-mode .guest-mode-limitations {
  background-color: #1f2937;
  border-left-color: #f59e0b;
}

.guest-mode-warning-modal.dark-mode .limitation-text {
  color: #e5e7eb;
}

.guest-mode-warning-modal.dark-mode .guest-mode-cta {
  background-color: #1e3a8a;
  border-left-color: #0284c7;
  color: #bfdbfe;
}

.guest-mode-warning-modal.dark-mode .guest-mode-warning-actions {
  border-top-color: #374151;
}

.guest-mode-warning-modal.dark-mode .guest-mode-close-link-btn {
  background-color: #374151;
  color: #f3f4f6;
}

.guest-mode-warning-modal.dark-mode .guest-mode-close-link-btn:hover {
  background-color: #4b5563;
}

html.dark .guest-mode-warning-modal {
  background: #111827;
}
@media (max-width: 1024px) {
  .pdf-session-peek-label {
    right: 18px;
    bottom: 36px;
    top: auto;
    transform: none;
  }
}

/* Quiz Tab */
.quiz-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.quiz-title {
  margin: 0;
  color: var(--lab-text-primary);
  font-size: 1.25rem;
}

.quiz-subtitle {
  margin: 6px 0 0;
  color: var(--lab-text-secondary);
  font-size: 0.92rem;
}

.quiz-experiment-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 420px;
}

.quiz-experiment-picker label {
  color: var(--lab-text-secondary);
  font-size: 0.88rem;
}

.quiz-experiment-picker select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid var(--lab-border);
  border-radius: 12px;
  background-color: var(--lab-bg-secondary);
  background-image: linear-gradient(45deg, transparent 50%, var(--lab-text-secondary) 50%), linear-gradient(135deg, var(--lab-text-secondary) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  color: var(--lab-text-primary);
  padding: 11px 38px 11px 12px;
  font-size: 0.94rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.quiz-experiment-picker select:focus {
  outline: none;
  border-color: var(--lab-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lab-accent) 22%, transparent);
}

.quiz-experiment-picker select option {
  background: var(--lab-bg);
  color: var(--lab-text-primary);
}

.quiz-experiment-picker select option[value=''] {
  color: var(--lab-text-secondary);
}

.quiz-error {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 10px;
  padding: 10px 12px;
}

.quiz-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--lab-text-secondary);
  font-size: 0.88rem;
}

.quiz-questions-list {
  display: block;
  width: 100%;
}

.quiz-question-card {
  border: 1px solid var(--lab-border);
  border-radius: 18px;
  padding: 22px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--lab-bg-secondary) 90%, #0f172a 10%), var(--lab-bg-secondary));
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  box-shadow: 0 14px 34px rgba(10, 14, 24, 0.28);
}

.quiz-question-head {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 10px;
}

.quiz-question-progress {
  color: var(--lab-text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
}

.quiz-question-type {
  font-size: 0.75rem;
  color: var(--lab-accent);
  border: 1px solid var(--lab-accent);
  border-radius: 99px;
  padding: 2px 8px;
}

.quiz-question-text {
  color: var(--lab-text-primary);
  margin: 4px 0 16px;
  font-size: 1.65rem;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
}

.quiz-option-item {
  border: 1px solid var(--lab-border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--lab-text-primary);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.quiz-option-item.disabled {
  cursor: default;
}

.quiz-option-item input {
  margin: 0;
}

.quiz-option-item.selected {
  border-color: var(--lab-accent);
  background: color-mix(in srgb, var(--lab-accent) 9%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--lab-accent) 14%, transparent);
}

.quiz-option-item.correct {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.quiz-option-item.wrong-picked {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.1);
}

.quiz-action-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.quiz-secondary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.quiz-check-btn {
  border: 1px solid color-mix(in srgb, var(--lab-accent) 38%, var(--lab-border));
  background: color-mix(in srgb, var(--lab-accent) 14%, transparent);
  color: var(--lab-text-primary);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}

.quiz-check-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.quiz-hint-btn {
  border: 1px solid var(--lab-border);
  background: transparent;
  color: var(--lab-text-secondary);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.quiz-hint-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.quiz-hint-block {
  background: color-mix(in srgb, var(--lab-accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--lab-accent) 30%, transparent);
  border-radius: 10px;
  padding: 14px 16px;
  color: var(--lab-text-primary);
  margin-top: 8px;
  margin-bottom: 12px;
  line-height: 1.45;
}

.quiz-check-feedback {
  border: 1px solid var(--lab-border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 8px;
  margin-bottom: 12px;
}

.quiz-check-feedback.correct {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.09);
}

.quiz-check-feedback.incorrect {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.09);
}

.quiz-wrong-reason {
  margin: 10px 0 8px;
  color: var(--lab-text-primary);
  font-size: 0.9rem;
  line-height: 1.45;
}

.quiz-correct-answer-inline {
  margin: 0;
  color: var(--lab-text-secondary);
  font-size: 0.84rem;
}

.quiz-answer-block {
  border: 1px dashed var(--lab-border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--lab-text-primary);
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.quiz-answer-block.correct {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.08);
}

.quiz-answer-block.incorrect {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
}

.quiz-answer-block.not-answered {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.1);
}

.quiz-explanation-block {
  margin-top: 8px;
  color: var(--lab-text-secondary);
  font-size: 0.84rem;
}

.quiz-navigation-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 0;
}

.quiz-nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 768px) {
  .quiz-action-toolbar {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .quiz-secondary-actions,
  .quiz-nav-actions {
    width: 100%;
    display: flex;
    gap: 10px;
  }

  .quiz-hint-btn,
  .quiz-check-btn,
  .quiz-nav-btn {
    flex: 1;
    width: 100%;
    justify-content: center;
  }

  .quiz-navigation-row {
    width: 100%;
    justify-content: center;
  }

  /* Ensure mobile users can scroll using visible scrollbar thumbs. */
  .lab-content,
  .lab-sidebar-content,
  .quick-jump-list,
  .sub-experiment-card-files,
  .console-output {
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: auto;
    scrollbar-gutter: stable;
    touch-action: pan-y;
  }

  .lab-content {
    overflow-y: auto;
    scrollbar-gutter: auto;
    padding-right: 10px !important;
    padding-left: 10px !important;
  }

  .lab-content:has(.experiment-view-stacked) {
    padding-right: 0 !important;
    padding-bottom: 0 !important;
  }

  .lab-content::-webkit-scrollbar,
  .lab-sidebar-content::-webkit-scrollbar,
  .quick-jump-list::-webkit-scrollbar,
  .sub-experiment-card-files::-webkit-scrollbar,
  .console-output::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  .lab-content::-webkit-scrollbar-track,
  .lab-sidebar-content::-webkit-scrollbar-track,
  .quick-jump-list::-webkit-scrollbar-track,
  .sub-experiment-card-files::-webkit-scrollbar-track,
  .console-output::-webkit-scrollbar-track {
    background: var(--lab-scrollbar-track);
  }

  .lab-content::-webkit-scrollbar-thumb,
  .lab-sidebar-content::-webkit-scrollbar-thumb,
  .quick-jump-list::-webkit-scrollbar-thumb,
  .sub-experiment-card-files::-webkit-scrollbar-thumb,
  .console-output::-webkit-scrollbar-thumb {
    background: var(--lab-scrollbar-thumb);
    border-radius: 99px;
  }
}

.quiz-nav-btn {
  border: 1px solid var(--lab-border);
  background: transparent;
  color: var(--lab-text-primary);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.quiz-nav-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.quiz-progress-pill {
  font-size: 0.85rem;
  color: var(--lab-text-secondary);
  border: 1px solid var(--lab-border);
  border-radius: 99px;
  padding: 4px 10px;
}

.quiz-submit-row {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.quiz-submit-btn,
.quiz-retake-btn {
  border: none;
  border-radius: 9px;
  padding: 9px 14px;
  cursor: pointer;
}

.quiz-submit-btn {
  background: var(--lab-accent);
  color: #fff;
}

.quiz-submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.quiz-retake-btn {
  background: color-mix(in srgb, var(--lab-accent) 16%, transparent);
  color: var(--lab-text-primary);
  border: 1px solid var(--lab-border);
}

.quiz-submit-note {
  margin: 8px 0 0;
  color: var(--lab-text-secondary);
  font-size: 0.84rem;
}

.quiz-result-summary {
  margin-top: 12px;
  font-weight: 600;
  color: var(--lab-text-primary);
}

.quiz-empty-state {
  border: 1px dashed var(--lab-border);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  color: var(--lab-text-secondary);
  grid-column: 1 / -1;
}

.quiz-empty-state i {
  font-size: 1.2rem;
  margin-bottom: 8px;
  color: var(--lab-accent);
}

@media (max-width: 768px) {
  .quiz-container {
    padding: 12px;
  }

  .quiz-header {
    flex-direction: column;
    align-items: stretch;
  }
}
@media (max-width: 768px) {
  .pdf-session-peek-label {
    right: 24px;
    bottom: 48px;
    top: auto;
    transform: none;
  }
}
@media (max-width: 480px) {
  .pdf-session-peek-label {
    right: 28px;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    top: auto;
    transform: none;
  }
}
@media (max-width: 1024px) {
  .pdf-session-peek-label {
    right: 12px;
  }
}
@media (max-width: 768px) {
  .pdf-session-peek-label {
    right: 18px;
  }
}
@media (max-width: 480px) {
  .pdf-session-peek-label {
    right: 24px;
  }
}
.pdf-session-blink {
  box-shadow: 0 0 0 2px #ffe066, 0 0 6px 1px #ffe06644;
  animation: pdf-blink 0.7s linear infinite alternate;
  border-radius: 8px;
  z-index: 1003;
}
@keyframes pdf-blink {
  0% { box-shadow: 0 0 0 2px #ffe066, 0 0 6px 1px #ffe06644; }
  100% { box-shadow: 0 0 0 4px #ffe066, 0 0 12px 2px #ffe06633; }
}
.pdf-session-peek-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2.5px solid #ffe066;
  background: #fffbe6;
  box-shadow: 0 2px 12px rgba(255, 224, 102, 0.16), 0 0 0 2px #ffe066;
  border-radius: 12px;
  border: 2.5px solid #ffe066;
  opacity: 1;
  color: #b8860b;
  border-radius: 22px;
  font-weight: 700;
  font-size: 20px;
  padding: 10px 24px 10px 16px;
  box-shadow: 0 2px 12px rgba(255, 224, 102, 0.16);
  position: fixed;
  right: 24px;
  bottom: 44px;
  top: auto;
  transform: none;
  margin: 0;
  min-width: 0;
  max-width: 90vw;
  z-index: 9999;
  vertical-align: middle;
  overflow: visible;
}

/* Keep this after the base rule so responsive positions win in cascade */
@media (max-width: 1024px) {
  .pdf-session-peek-label {
    right: 12px;
    bottom: 44px;
  }
}

@media (max-width: 768px) {
  .pdf-session-peek-label {
    right: 18px;
    bottom: 52px;
  }
}

@media (max-width: 480px) {
  .pdf-session-peek-label {
    right: 24px;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }
}
.pdf-session-peek-arrow {
  display: flex;
  align-items: center;
  font-size: 2.1em;
  margin-right: 4px;
}
.pdf-session-peek-icon {
  display: flex;
  align-items: center;
  font-size: 2.1em;
  margin-right: 6px;
}
.pdf-session-peek-text {
  display: none;
}
.pdf-session-peek-arrow, .pdf-session-peek-icon, .pdf-session-peek-text {
  flex-shrink: 0;
  min-width: 0;
}
.pdf-session-peek-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdf-session-peek-arrow {
  display: flex;
  align-items: center;
  font-size: 18px;
  margin-right: 0;
}
.pdf-session-peek-icon {
  display: flex;
  align-items: center;
  font-size: 18px;
  margin-right: 0;
}
.pdf-session-peek-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
@media (max-width: 768px) {
  .pdf-session-peek-label.pdf-session-peek-animated {
    animation: pdf-peek-in 0.7s cubic-bezier(0.4,0,0.2,1);
  }
}
@keyframes pdf-peek-in {
  0% { transform: translateX(80px) scale(0.95); opacity: 0; }
  60% { transform: translateX(-8px) scale(1.04); opacity: 1; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}
/* Fade animation for process exit bar */
.fade-exit-bar-enter {
  opacity: 0;
  transform: translateY(10px);
}
.fade-exit-bar-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 250ms, transform 250ms;
}
.fade-exit-bar-exit {
  opacity: 1;
  transform: translateY(0);
}
.fade-exit-bar-exit-active {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 250ms, transform 250ms;
}
/* ============================================
   LabInternal.css - Full-Screen Lab App UI
   Updated: 2026-01-07 - COMPLETE RESTORATION
   ============================================ */

/* Theme Variables moved to index.css for global access */

/* Fix to prevent page scrolling and header overlap glitches when navigating experiments */
body:has(.lab-container) {
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

body:has(.lab-container) #root {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  height: 100vh;
  /* Use dvh for mobile browsers with dynamic search bars if supported */
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* === CONTAINER: Full-screen container === */
.lab-container {
  width: 100%;
  max-width: 100%;
  flex: 1; /* Automatically takes the exact remaining height below the header */
  position: relative; /* Support for inner absolute elements */
  display: flex;
  flex-direction: column;
  background: var(--lab-bg);
  color: var(--lab-text-primary);
  overflow: hidden; /* Guarantee it doesn't cause body scroll */
}

/* === HEADER: Lab name, back button, tabs === */
.lab-header {
  height: 60px;
  background: var(--lab-header-bg);
  border-bottom: 1px solid var(--lab-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 10000;
  position: relative;
}

.lab-header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.lab-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 20px;
  border-right: 2px solid var(--lab-border);
}

.lab-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.lab-logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--lab-text-primary);
}

.lab-back-btn {
  background: transparent;
  border: 1px solid var(--lab-border);
  color: var(--lab-text-secondary);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: all 0.2s;
}

.lab-back-btn:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
  border-color: var(--lab-text-muted);
}

.lab-title-section {
  display: flex;
  flex-direction: column;
}

.lab-name-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--lab-text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.lab-code-badge {
  font-size: 12px;
  color: var(--lab-text-secondary);
  font-family: 'Courier New', monospace;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.lab-code-badge:hover {
  color: #3b82f6;
}

.lab-code-badge i {
  font-size: 11px;
}

/* === CENTER NAVIGATION TABS (Purple Pill) === */
.lab-header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lab-center-tabs {
  display: flex;
  gap: 12px;
  background: var(--lab-bg);
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--lab-border);
}

.lab-center-tab {
  background: transparent;
  border: none;
  color: var(--lab-text-secondary);
  padding: 10px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.lab-center-tab:hover {
  color: var(--lab-text-primary);
  background: var(--lab-sidebar-hover);
}

.lab-center-tab.active {
  background: var(--lab-accent);
  color: white;
  box-shadow: none;
}

.lab-center-tab i {
  font-size: 16px;
}

/* Profile button */
.lab-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lab-profile-btn {
  background: transparent;
  border: 1px solid var(--lab-border);
  padding: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s;
}

.lab-profile-btn:hover {
  border-color: var(--lab-text-muted);
  transform: scale(1.05);
}

.lab-profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* === BODY: Sidebar + Content === */
.lab-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* === SIDEBAR (RESTORED) === */
.lab-sidebar {
  width: 0;
  background: var(--lab-sidebar-bg);
  border-right: 1px solid transparent;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.2s;
  position: relative;
  z-index: 2;
}

.lab-sidebar.open {
  width: 300px;
  border-right-color: var(--lab-border);
}

.lab-sidebar.open::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background: transparent;
  cursor: col-resize;
  z-index: 10;
  transition: background 0.15s ease;
}

.lab-sidebar.open:hover::after {
  background: linear-gradient(90deg, transparent 0%, var(--lab-accent) 50%, transparent 100%);
  opacity: 0.8;
}

.lab-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-width: 300px; /* Ensure content doesn't squish during transition */
}

.lab-sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.lab-sidebar-content::-webkit-scrollbar-track {
  background: var(--lab-scrollbar-track);
}

.lab-sidebar-content::-webkit-scrollbar-thumb {
  background: var(--lab-scrollbar-thumb);
  border-radius: 3px;
}

.lab-sidebar-content::-webkit-scrollbar-thumb:hover {
  background: var(--lab-text-secondary);
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 32px;
  background: var(--lab-sidebar-hover);
  border: 1px solid var(--lab-border);
  border-radius: 40px;
  color: var(--lab-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: .35;
  padding: 0;
  padding-left: 10px;
}

.sidebar-toggle:hover {
  color: var(--lab-text-primary);
  background: var(--lab-accent);
  border-color: var(--lab-accent);
}

.sidebar-toggle:active {
  transform: translateY(-50%) scale(0.95);
}

.sidebar-toggle.open {
  left: calc(300px - 14px);
  background: transparent;
  border: none;
  opacity: 0;
  pointer-events: none;
}

.lab-sidebar.open:hover ~ .sidebar-toggle.open,
.sidebar-toggle.open:hover {
  opacity: 1;
  pointer-events: auto;
  background: var(--lab-sidebar-hover);
  border: 1px solid var(--lab-border);
  border-radius: 40px;
  padding-left: 0;
}

.sidebar-toggle i {
  font-size: 12px;
  transition: transform 0.3s ease;
}

/* Overlay styles for desktop */
.sidebar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  cursor: pointer;
}

.sidebar-overlay-mobile {
  display: none;
}

.sidebar-overlay-close {
  display: none;
}

/* Quick jump strip (all devices) */
.quick-jump-toggle {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 75px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-left: none;
  border-radius: 0 18px 18px 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.045));
  color: var(--lab-text-primary);
  cursor: pointer;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: left 0.25s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.quick-jump-toggle:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(96, 165, 250, 0.1));
  border-color: rgba(147, 197, 253, 0.42);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.quick-jump-toggle span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 11px;
  letter-spacing: 1.5px;
  font-weight: 700;
}

.quick-jump-toggle.quick-jump-open {
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.18), rgba(59, 130, 246, 0.1));
  border-color: rgba(96, 165, 250, 0.4);
}

.quick-jump-toggle.sidebar-open {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.28), rgba(37, 99, 235, 0.14));
  border-color: rgba(147, 197, 253, 0.5);
  color: #fff;
}

.quick-jump-strip {
  position: relative;
  align-self: stretch;
  width: 0;
  height: 100%;
  border-radius: 0 20px 20px 0;
  border: 0 solid transparent;
  border-left: none;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.96));
  box-shadow: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
  overflow: hidden;
  flex-shrink: 0;
  transform: none;
  opacity: 1;
  pointer-events: none;
  transition: width 0.15s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.15s ease, padding 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.quick-jump-strip:not(.open) > * {
  opacity: 0;
}

.quick-jump-strip.open {
  width: 148px;
  border-width: 1px;
  padding: 10px 6px 8px 18px;
  gap: 8px;
  border-color: var(--lab-border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--lab-sidebar-bg) 94%, transparent), color-mix(in srgb, var(--lab-sidebar-bg) 88%, transparent));
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.42), inset 1px 0 0 rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: visible;
  pointer-events: auto;
  z-index: 9000;
}

.quick-jump-strip.menu-open {
  overflow: visible;
  isolation: isolate;
}

.quick-jump-strip.menu-open .quick-jump-group {
  content-visibility: visible;
  contain: none;
}

.quick-jump-expand-more-indicator {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  background: transparent;
  border: none;
  color: var(--lab-text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  padding: 10px 4px;
  transition: color 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.quick-jump-expand-more-indicator:hover {
  color: var(--lab-text-primary);
  transform: translateY(-50%) rotate(180deg) scale(1.05);
}

.quick-jump-strip-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--lab-text-muted);
  text-align: center;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--lab-border);
  margin-right: 0;
  font-weight: 700;
}

.quick-jump-empty {
  color: var(--lab-text-muted);
  font-size: 11px;
  text-align: center;
  padding: 8px;
}

.quick-jump-strip-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.quick-jump-strip-header-row .quick-jump-strip-header {
  flex: 1;
  text-align: left;
  padding-bottom: 8px;
}

.quick-jump-strip-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-bottom: 8px;
}

.quick-jump-strip-icon-btn {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(15, 23, 42, 0.48);
  color: var(--lab-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.14s ease;
}

.quick-jump-strip-icon-btn i {
  font-size: 10px;
}

.quick-jump-strip-icon-btn:hover {
  background: rgba(37, 99, 235, 0.24);
  border-color: rgba(147, 197, 253, 0.5);
  color: var(--lab-text-primary);
  transform: translateY(-1px);
}

.quick-jump-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: visible;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 1px;
  padding-left: 1px;
  scrollbar-width: thin;
  scrollbar-color: var(--lab-scrollbar-thumb) transparent;
}

.quick-jump-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-jump-group-header,
.quick-jump-subgroup-header {
  width: 100%;
  min-height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.32);
  color: var(--lab-text-secondary);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0 6px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.16s ease, box-shadow 0.2s ease;
}

.quick-jump-group-header:hover,
.quick-jump-subgroup-header:hover {
  background: color-mix(in srgb, var(--lab-sidebar-hover) 78%, white 8%);
  color: var(--lab-text-primary);
  border-color: rgba(148, 163, 184, 0.28);
  transform: translateX(2px);
}

.quick-jump-group-header.active,
.quick-jump-subgroup-header.active {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.28), rgba(37, 99, 235, 0.2));
  border-color: var(--lab-accent);
  color: var(--lab-text-primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 18px rgba(37, 99, 235, 0.14);
}

.quick-jump-group-label,
.quick-jump-subgroup-label {
  flex: 1;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-jump-group-chevron,
.quick-jump-subgroup-chevron {
  flex-shrink: 0;
  color: var(--lab-text-muted);
  font-size: 11px;
}

.quick-jump-sublist,
.quick-jump-query-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 6px;
  border-left: 1px solid rgba(148, 163, 184, 0.12);
  margin-left: 4px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition: max-height 0.26s ease, opacity 0.2s ease, transform 0.2s ease, margin-top 0.2s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--lab-scrollbar-thumb) transparent;
}

.quick-jump-sublist.open {
  max-height: 1200px;
  overflow-y: auto;
  opacity: 1;
  transform: translateY(0);
  margin-top: 2px;
}

.quick-jump-query-list.open {
  max-height: 190px; /* ~6.5 items */
  overflow-y: auto;
  opacity: 1;
  transform: translateY(0);
  margin-top: 2px;
}

.quick-jump-strip.menu-open .quick-jump-sublist.open,
.quick-jump-strip.menu-open .quick-jump-query-list.open {
  overflow: visible;
}

.quick-jump-sublist.open:has(.quick-jump-item-row.menu-open),
.quick-jump-query-list.open:has(.quick-jump-item-row.menu-open) {
  overflow: visible;
}

.quick-jump-sublist.collapsed,
.quick-jump-query-list.collapsed {
  margin-top: 0;
  border-left-color: transparent;
}

.quick-jump-subgroup {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-jump-list::-webkit-scrollbar,
.quick-jump-sublist::-webkit-scrollbar,
.quick-jump-query-list::-webkit-scrollbar {
  width: 5px;
}

.quick-jump-list::-webkit-scrollbar-track,
.quick-jump-sublist::-webkit-scrollbar-track,
.quick-jump-query-list::-webkit-scrollbar-track {
  background: transparent;
}

.quick-jump-list::-webkit-scrollbar-thumb,
.quick-jump-sublist::-webkit-scrollbar-thumb,
.quick-jump-query-list::-webkit-scrollbar-thumb {
  background: var(--lab-scrollbar-thumb);
  border-radius: 99px;
}

.quick-jump-list::-webkit-scrollbar-button,
.quick-jump-sublist::-webkit-scrollbar-button,
.quick-jump-query-list::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.quick-jump-item {
  min-height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.32);
  color: var(--lab-text-secondary);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
  letter-spacing: 0.01em;
  padding: 0 6px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.quick-jump-item-row {
  position: relative;
  display: block;
  overflow: visible;
}

.quick-jump-item-row.menu-open {
  z-index: 9100;
}

.quick-jump-select-btn {
  width: 100%;
  padding-right: 36px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-jump-item-actions {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.quick-jump-item-actions.open {
  z-index: 9200;
}

.quick-jump-item-menu-btn {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--lab-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  line-height: 1;
  cursor: pointer;
  transition: color 0.18s ease, transform 0.14s ease;
}

.quick-jump-item-menu-btn:hover,
.quick-jump-item-menu-btn.open {
  color: var(--lab-text-primary);
  transform: scale(1.05);
}

.quick-jump-item-menu {
  position: absolute;
  left: auto;
  right: -2px;
  top: calc(100% + 6px);
  min-width: 118px;
  max-width: 142px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgb(15, 23, 42), rgb(13, 18, 33));
  box-shadow: 0 14px 28px rgba(2, 6, 23, 0.48);
  z-index: 9300;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: auto;
}

.quick-jump-item-menu-action {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--lab-text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  padding: 6px 7px;
  transition: background 0.15s ease, color 0.15s ease;
}

.quick-jump-item-menu-action i {
  width: 12px;
  text-align: center;
  flex-shrink: 0;
}

.quick-jump-item-menu-action span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-jump-item-menu-action:hover {
  background: rgba(59, 130, 246, 0.18);
  color: var(--lab-text-primary);
}

.quick-jump-item:hover {
  background: color-mix(in srgb, var(--lab-sidebar-hover) 78%, white 8%);
  color: var(--lab-text-primary);
  border-color: rgba(148, 163, 184, 0.28);
  transform: translateX(2px);
}

.quick-jump-item.active {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.28), rgba(37, 99, 235, 0.2));
  border-color: var(--lab-accent);
  color: var(--lab-text-primary);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 18px rgba(37, 99, 235, 0.18);
}

.quick-jump-empty {
  min-height: 36px;
  border-radius: 13px;
  border: 1px dashed var(--lab-border);
  color: var(--lab-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* Empty state */
.lab-sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--lab-text-muted);
}

.lab-sidebar-empty i {
  font-size: 48px;
  color: var(--lab-text-muted);
  margin-bottom: 12px;
}

.lab-sidebar-empty p {
  margin: 0;
  font-size: 14px;
}

/* === SUBJECT LIST (RESTORED) === */
.subject-item {
  margin-bottom: 16px;
}

/* === EXPERIMENTS LIST (RESTORED) === */
.experiments-list {
  padding-left: 0;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.experiment-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: all 0.2s;
  color: var(--lab-text-secondary);
  font-size: 13px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.experiment-item:hover {
  background: var(--lab-sidebar-hover);
  border-color: var(--lab-border);
  color: var(--lab-text-primary);
}

.experiment-item.active {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #3b82f6;
  font-weight: 600;
  cursor: default;
}

.experiment-item.active i {
  color: #3b82f6;
}

/* Experiment group (for sub-experiments like 1a, 1b) */
.experiment-group {
  margin-bottom: 4px;
}

.experiment-group-header {
  background: transparent;
  border-radius: 4px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
  color: var(--lab-text-secondary);
  font-size: 13px;
}

.experiment-group-header:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
}

.experiment-group-header.active {
  color: #3b82f6;
}

.experiment-group-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.experiment-group-right {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.experiment-group-menu-wrap {
  position: relative;
}

.experiment-group-menu-btn {
  border: none;
  background: transparent;
  color: var(--lab-text-muted);
  width: 22px;
  height: 22px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.experiment-group-menu-btn:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
}

.experiment-group-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--lab-card-bg);
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  z-index: 30;
}

.experiment-group-menu-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--lab-text-primary);
  font-size: 12px;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
}

.experiment-group-menu-item:hover {
  background: var(--lab-sidebar-hover);
}

.experiment-group-left i {
  color: var(--lab-text-muted);
  font-size: 14px;
}

.experiment-sub-list {
  padding-left: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.experiment-item.sub-experiment-item {
  padding: 8px 12px 8px 24px;
  font-size: 13px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Media file items - golden color for images/audio/video */
.experiment-item.media-item {
  color: #d4a574 !important; /* Golden brown that works in dark mode */
}

.experiment-item.media-item:hover {
  color: #e0b887 !important; /* Lighter golden on hover */
}

.experiment-item.media-item.active {
  background: rgba(212, 165, 116, 0.15) !important;
  color: #f0c896 !important; /* Even lighter when active */
}

/* Light mode adjustments for media items */
html.light .experiment-item.media-item {
  color: #b8823d !important; /* Darker golden for light mode */
}

html.light .experiment-item.media-item:hover {
  color: #a0712f !important; /* Even darker on hover in light mode */
}

html.light .experiment-item.media-item.active {
  background: rgba(184, 130, 61, 0.15) !important;
  color: #8d6328 !important; /* Darkest when active in light mode */
}

.experiment-item.single-experiment-item {
  padding: 8px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.single-experiment-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.single-experiment-actions {
  position: relative;
  flex: 0 0 auto;
}

.sidebar-item-actions {
  position: relative;
  flex: 0 0 auto;
  z-index: 1;
}

.sidebar-item-actions.open {
  z-index: 1400;
}

.sidebar-item-menu-btn {
  border: none;
  background: transparent;
  color: var(--lab-text-muted);
  width: 24px;
  height: 24px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.experiment-item:has(.sidebar-item-actions.open),
.sub-experiment-card-file:has(.sidebar-item-actions.open),
.sub-experiment-card-files:has(.sidebar-item-actions.open),
.sub-experiment-card:has(.sidebar-item-actions.open) {
  overflow: visible;
  z-index: 1200;
}

.sidebar-item-menu-btn:hover,
.sidebar-item-menu-btn.open {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
}

.sidebar-item-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 132px;
  border-radius: 8px;
  border: 1px solid var(--lab-border);
  background: var(--lab-card-bg);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  z-index: 1500;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-item-menu-action {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--lab-text-primary);
  border-radius: 6px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
}

.sidebar-item-menu-action:hover {
  background: var(--lab-sidebar-hover);
}

.sub-experiment-label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.experiment-item.active .sub-experiment-label {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  flex: 1;
  min-width: 0;
}

/* Sub-Experiment Card Styles for Multiple Files */
.sub-experiment-card {
  border: 1px solid var(--lab-border);
  border-radius: 6px;
  background: var(--lab-card-bg);
  margin: 8px 6px;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.sub-experiment-card-header {
  padding: 10px 12px;
  background: rgba(var(--lab-accent-rgb, 79, 172, 254), 0.1);
  border-bottom: 1px solid var(--lab-border);
  font-weight: 500;
  font-size: 13px;
  color: var(--lab-text-primary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.sub-experiment-card-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.sub-experiment-card-files {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 6px 0;
  max-height: 240px;
  overflow-y: auto;
}

.sub-experiment-card-file {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--lab-text-secondary);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid var(--lab-border, rgba(255, 255, 255, 0.1));
  background: var(--lab-card-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sub-experiment-card-file:hover {
  background: rgba(var(--lab-accent-rgb, 79, 172, 254), 0.05);
  color: var(--lab-text-primary);
}

.sub-experiment-card-file.active {
  background: rgba(var(--lab-accent-rgb, 79, 172, 254), 0.15);
  border-left-color: var(--lab-accent, #4facfe);
  color: var(--lab-accent, #4facfe);
  font-weight: 500;
}

.sub-experiment-card-file.media-item {
  color: #d4a574;
}

.sub-experiment-card-file.media-item:hover {
  color: #e0b887;
}

.sub-experiment-card-file.media-item.active {
  color: #f0c896;
  border-left-color: #d4a574;
}

.file-name-short {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
  flex: 1;
  min-width: 0;
}

.experiment-item span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-word;
  flex: 1;
  min-width: 0;
}

.experiment-item.active span {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  flex: 1;
  min-width: 0;
}

/* === MAIN CONTENT AREA === */
.lab-content {
  flex: 1;
  min-width: 0;
  background: var(--lab-bg);
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

/* Remove main padding-top globally for the lab-content so sticky headers can sit tightly against the top edge */
main.lab-content {
  padding-top: 0 !important;
  min-height: 0 !important;
}

body:has(.lab-container) main.lab-content {
  min-height: 0 !important;
  height: 100% !important;
}

/* Restore the visual top spacing for all other generic tabs */
main.lab-content > *:not(.experiment-view-stacked) {
  margin-top: 24px;
}

/* Welcome screen */
.lab-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
}

.lab-welcome i {
  font-size: 64px;
  color: var(--lab-border);
  margin-bottom: 20px;
}

.lab-welcome h3 {
  font-size: 24px;
  font-weight: 600;
  color: var(--lab-text-primary);
  margin: 0 0 10px 0;
}

.lab-welcome p {
  font-size: 16px;
  color: var(--lab-text-secondary);
  margin: 0;
}

/* Experiment view */
.experiment-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.experiment-header {
  margin: 0;
  padding: 12px 8px;
  background: var(--lab-header-bg);
  border-bottom: 1px solid var(--lab-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  box-sizing: border-box;
  z-index: 2;
}

.experiment-info {
  min-width: 0;
  flex: 1;
}

.experiment-info h1 {
  font-size: 24px;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.experiment-info .experiment-title {
  margin: 0;
  color: var(--lab-text-primary);
  font-weight: 400;
}

.experiment-info .experiment-title-no-subexpt {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.experiment-info .experiment-title-with-subexpt {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.2;
}

.experiment-subtitle {
  font-size: 15px;
  color: #ffffff;
  margin: 4px 0 0 0;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.35;
}

.experiment-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.experiment-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  margin-left: auto;
}

.experiment-header-actions .action-btn-outline {
  min-width: 32px;
  justify-content: center;
}

.experiment-action-row {
  margin: 0;
  padding: 10px 8px;
  border-bottom: 1px solid var(--lab-border);
  background: var(--lab-bg);
}

.experiment-action-row .code-header-title {
  flex: 1;
  min-width: 0;
}

.experiment-action-row .code-header-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.experiment-action-row .code-header-actions > * {
  flex: 0 0 auto;
}

.experiment-action-row .action-btn,
.experiment-action-row .action-btn-outline {
  min-width: 0;
}

.experiment-action-row .action-btn-icon-only {
  width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
}

.experiment-action-row .action-btn-icon-only i {
  margin: 0;
}

.code-header-run-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.experiment-info .experiment-title-no-subexpt {
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  line-clamp: 2 !important;
  -webkit-box-orient: vertical;
  overflow: hidden !important;
}

.experiment-info .experiment-title-no-subexpt.experiment-title-clickable {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.experiment-info .experiment-title-no-subexpt.experiment-title-clickable:focus-visible {
  outline: 2px solid var(--lab-accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.experiment-edit-form {
  background: color-mix(in srgb, var(--lab-bg-secondary) 82%, transparent);
  border: 1px solid var(--lab-border);
  border-radius: 10px;
  padding: 10px 12px;
  gap: 10px;
}

.experiment-edit-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.experiment-edit-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.experiment-edit-label {
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.experiment-convert-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px dashed color-mix(in srgb, var(--lab-accent) 45%, var(--lab-border));
  background: color-mix(in srgb, var(--lab-bg) 86%, transparent);
  border-radius: 8px;
  padding: 8px 10px;
}

.experiment-convert-box-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.experiment-convert-box-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--lab-text-primary);
}

.experiment-convert-box-subtitle {
  font-size: 11px;
  color: var(--lab-text-secondary);
  line-height: 1.3;
}

.quick-jump-header-toggle {
  flex: 0 0 auto;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 34px;
  width: 34px;
  height: 66px;
  padding: 4px 4px;
  z-index: auto;
}

.quick-jump-header-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1;
  margin-left: 0;
}

.quick-jump-header-symbol {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  width: 10px;
  text-align: center;
}

.quick-jump-header-toggle.quick-jump-open {
  border-color: color-mix(in srgb, var(--lab-accent) 65%, var(--lab-border));
  color: var(--lab-accent);
}

.quick-jump-header-toggle.sidebar-open {
  background: var(--lab-accent);
  color: #fff;
  border-color: var(--lab-accent);
}

@media (max-width: 768px) {
  .quick-jump-header-toggle {
    flex: 0 0 auto;
    align-self: flex-start;
    min-width: 32px;
    width: 32px;
    height: 64px;
    padding: 3px;
    gap: 3px;
  }

  .quick-jump-header-label {
    font-size: 11px;
    letter-spacing: 0.85px;
  }

  .quick-jump-header-symbol {
    width: 9px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .experiment-actions {
    gap: 4px;
    margin-top: 4px;
  }

  .experiment-action-row {
    padding: 8px 10px;
  }

  .experiment-action-row .code-header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .quick-jump-header-toggle {
    flex: 0 0 auto;
    align-self: flex-start;
    min-width: 32px;
    width: 32px;
    height: 60px;
    padding: 3px;
    gap: 2px;
  }

  .quick-jump-header-label {
    font-size: 10px;
    letter-spacing: 0.7px;
  }

  .quick-jump-header-symbol {
    width: 8px;
    font-size: 12px;
  }
}

.action-btn, .action-btn-outline {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.action-btn {
  background: var(--lab-accent);
  color: white;
  border: 1px solid var(--lab-accent);
}
.action-btn:hover { background: var(--lab-accent-gradient); opacity: 0.9; }

.action-btn-outline {
  background: transparent;
  color: var(--lab-text-primary);
  border: 1px solid var(--lab-border);
}
.action-btn-outline:hover { background: var(--lab-sidebar-hover); }

/* Code Container */
.code-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid var(--lab-border);
  margin: 0;
}

.code-header {
  background: var(--lab-bg);
  padding: 10px 20px;
  border-bottom: 1px solid var(--lab-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.code-header-title {
  overflow: hidden;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.code-edit-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #0ea5e9;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.global-updated-at {
  font-size: 11px;
  color: var(--lab-text-secondary);
  margin-left: auto; /* Push to right slightly or rely on flex */
  font-style: italic;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.code-edit-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .code-header-title {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    min-width: 0;
  }

  .code-edit-row {
    flex-shrink: 0;
    margin-left: auto;
  }

  .global-updated-at {
    margin-left: 0;
    white-space: normal;
    width: 100%;
    margin-top: 2px;
  }
}

.word-wrap-toggle {
  background: var(--lab-btn-secondary);
  border: 1px solid var(--lab-border);
  color: var(--lab-text-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.word-wrap-toggle:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
}

.word-wrap-toggle.active {
  background: var(--lab-accent);
  color: white;
  border-color: var(--lab-accent);
}

.code-filename {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.2;
  color: var(--lab-text-secondary);
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.code-filename.is-expanded {
  overflow: visible;
}

.code-filename-main {
  font-family: 'Courier New', monospace;
  color: var(--lab-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  line-height: 1.2;
  cursor: pointer;
}

.code-filename-main.is-expanded {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.code-folder-path {
  font-family: 'Courier New', monospace;
  color: var(--lab-accent);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-folder-sep {
  color: var(--lab-text-secondary);
  margin: 0 1px;
}

@media (max-width: 768px) {
  .code-filename {
    font-size: 11px;
  }

  .code-header {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .code-header-title {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  .experiment-action-row .code-header-actions {
    flex: 0 0 auto;
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    overflow: visible;
    row-gap: 4px;
    padding-bottom: 0;
    margin-left: 0;
  }

  .experiment-action-row .code-header-actions .screenshot-dropdown-container {
    position: relative;
    z-index: 40;
  }

  .code-header .screenshot-dropdown {
    left: 0;
    right: auto;
    min-width: 0;
    width: min(168px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
  }
}

.code-loading {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.experiment-view-stacked {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 0;
}

.code-section {
  display: flex;
  flex-direction: column;
  margin: 10px 10px 0 10px;
}

.code-section .code-container {
  display: flex;
  flex-direction: column;
  border-radius: 6px 6px 0 0;
  border: 1px solid var(--lab-border);
  border-bottom: none;
  overflow: visible;
}

.ai-explanation-section {
  background: var(--lab-bg);
  border: 1px solid var(--lab-border);
  border-radius: 6px;
  margin: 0 10px 20px 10px;
}

.sql-stacked-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--lab-border);
  border-radius: 0;
  overflow: hidden;
  background: var(--lab-bg);
}

.sql-query-card {
  position: relative;
  background: var(--lab-bg);
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.14s ease;
}

@supports (content-visibility: auto) {
  .quick-jump-group,
  .experiment-group,
  .sub-experiment-card,
  .sql-query-card,
  .ai-explanation-section {
    content-visibility: auto;
    contain-intrinsic-size: 360px;
  }
}

.sql-query-card + .sql-query-card {
  border-top: 1px solid var(--lab-border);
}

.sql-query-card:hover {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lab-accent) 28%, var(--lab-border));
}

.sql-query-card.selected {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lab-accent) 48%, var(--lab-border));
}

.sql-query-card:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--lab-accent) 70%, white);
  outline-offset: -2px;
}

.sql-query-main {
  position: relative;
}

.sql-query-main.selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1px;
  bottom: 1px;
  width: 4px;
  background: var(--lab-accent);
  border-radius: 0;
  z-index: 2;
  pointer-events: none;
}

.sql-query-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--lab-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.sql-query-card:hover .sql-query-header {
  background: color-mix(in srgb, var(--lab-card-bg) 70%, var(--lab-bg));
}

.sql-query-header.active {
  padding-left: 20px;
  background: var(--lab-card-bg);
}

.sql-query-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.sql-query-number {
  color: var(--lab-text-secondary);
  font-family: monospace;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.sql-query-number.active {
  color: var(--lab-accent);
  font-weight: 700;
}

.sql-query-name {
  color: var(--lab-text-primary);
  font-size: 13px;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.25;
}

.sql-query-name.active {
  font-weight: 500;
}

.sql-query-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sql-query-actions .action-btn,
.sql-query-actions .action-btn-outline {
  opacity: 0.92;
}

.sql-query-card:hover .sql-query-actions .action-btn,
.sql-query-card:hover .sql-query-actions .action-btn-outline,
.sql-query-card.selected .sql-query-actions .action-btn,
.sql-query-card.selected .sql-query-actions .action-btn-outline {
  opacity: 1;
}

.sql-reset-btn {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.sql-ai-toggle-row {
  padding: 8px 12px;
  border-top: 1px solid var(--lab-border);
  background: var(--lab-bg);
}

.sql-ai-toggle-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sql-ai-toggle-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-color: color-mix(in srgb, var(--lab-accent) 50%, var(--lab-border));
}

.sql-ai-regenerate-btn {
  font-size: 11px;
  padding: 4px 10px;
}

.sql-ai-regenerate-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.sql-ai-toggle-btn.open {
  background: color-mix(in srgb, var(--lab-accent) 20%, transparent);
  border-color: color-mix(in srgb, var(--lab-accent) 70%, var(--lab-border));
}

.sql-ai-toggle-btn:hover,
.sql-ai-regenerate-btn:hover {
  background: color-mix(in srgb, var(--lab-accent) 12%, transparent);
}

.sql-ai-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.28s ease, opacity 0.22s ease;
  background: var(--lab-card-bg);
}

.sql-ai-panel.open {
  max-height: 440px;
  opacity: 1;
  border-top: 1px solid var(--lab-border);
}

.sql-ai-panel-inner {
  padding: 12px 14px;
  max-height: 420px;
  overflow: auto;
}

.sql-ai-content-shell {
  border: 1px solid color-mix(in srgb, var(--lab-border) 85%, var(--lab-accent));
  background: color-mix(in srgb, var(--lab-card-bg) 75%, var(--lab-bg));
  border-radius: 8px;
  padding: 14px 16px;
}

.sql-ai-state {
  font-size: 12px;
}

.sql-ai-state-loading {
  color: var(--lab-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sql-ai-state-error {
  color: #ef4444;
}

.sql-ai-state-empty {
  color: var(--lab-text-secondary);
}

.sql-ai-markdown {
  font-size: 12px;
  line-height: 1.7;
  color: var(--lab-text-primary);
}

.sql-ai-markdown p,
.sql-ai-markdown li {
  margin: 0 0 10px 0;
}

.sql-ai-markdown strong {
  color: color-mix(in srgb, var(--lab-accent) 82%, white);
  font-weight: 700;
}

.sql-ai-markdown h1,
.sql-ai-markdown h2,
.sql-ai-markdown h3 {
  color: color-mix(in srgb, var(--lab-accent) 78%, white);
  margin: 12px 0 8px;
}

.sql-ai-markdown ul,
.sql-ai-markdown ol {
  padding-left: 18px;
  margin: 8px 0 12px;
}

.sql-ai-markdown li::marker {
  color: var(--lab-accent);
}

.sql-ai-markdown code {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.28);
  padding: 1px 5px;
  border-radius: 4px;
}

.sql-ai-markdown pre {
  overflow-x: auto;
  background: #0b1220;
  border: 1px solid color-mix(in srgb, var(--lab-border) 78%, #3b82f6);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0 12px;
}

.sql-ai-markdown pre code {
  background: transparent;
  border: none;
  color: #dbeafe;
  padding: 0;
}

@media (max-width: 768px) {
  .sql-query-header {
    padding: 10px 12px;
    gap: 8px;
  }

  .sql-query-header.active {
    padding-left: 16px;
  }

  .sql-query-title-wrap {
    gap: 8px;
    flex-wrap: wrap;
  }

  .sql-query-number {
    font-size: 13px;
  }

  .sql-query-name {
    font-size: 12px;
  }

  .sql-ai-panel.open {
    max-height: 360px;
  }

  .sql-ai-panel-inner {
    max-height: 340px;
    padding: 10px 12px;
  }

  .sql-ai-content-shell {
    padding: 12px;
  }
}

.ai-explanation-header {
  background: var(--lab-header-bg);
  border-bottom: 1px solid var(--lab-border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 6px 6px 0 0;
}

.ai-explanation-header > div {
  width: 100%;
}

.ai-explanation-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-explanation-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--lab-text-primary);
  font-weight: 600;
}

.ai-explanation-title-wrap i {
  color: var(--lab-accent);
}

.ai-explanation-header-btn {
  margin-left: auto;
  padding: 4px 8px;
  font-size: 12px;
}

.ai-explanation-header .action-btn-outline {
  margin-left: auto;
}

.ai-explanation-content {
  padding: 16px;
  /* Remove scroll constraints for natural flow */
}

.ai-explanation-refresh-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 246, 0.28);
  background: rgba(59, 130, 246, 0.12);
  color: var(--lab-text-primary);
  font-size: 12px;
}

.ai-explanation-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--lab-border);
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.ai-explanation-tab {
  padding: 8px 12px;
  background: transparent;
  color: var(--lab-text-secondary);
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.16s ease;
}

.ai-explanation-tab:hover {
  background: color-mix(in srgb, var(--lab-accent) 13%, transparent);
  color: var(--lab-text-primary);
  border-color: color-mix(in srgb, var(--lab-accent) 38%, var(--lab-border));
  transform: translateY(-1px);
}

.ai-explanation-tab.active {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.3), rgba(37, 99, 235, 0.22));
  border-color: color-mix(in srgb, var(--lab-accent) 75%, white 10%);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.ai-explanation-tab-panel {
  font-size: 13px;
  line-height: 1.6;
  color: var(--lab-text-primary);
  animation: aiExplanationTabEnter 0.22s ease;
}

.ai-explanation-tab-panel .explanation-content {
  white-space: normal;
  word-break: break-word;
}

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

.ai-generation-progress {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
  margin-bottom: 12px;
}

.ai-generation-progress-bar {
  width: 42%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.35) 0%, rgba(59, 130, 246, 0.95) 55%, rgba(34, 197, 94, 0.85) 100%);
  animation: aiProgressSlide 1.1s ease-in-out infinite;
}

@keyframes aiProgressSlide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(260%);
  }
}

/* Runner Section - Attached to code view */
.runner-section {
  display: flex;
  flex-direction: column;
  margin: 0 10px 20px 10px;
}

.runner-section .console-container {
  display: flex;
  flex-direction: column;
  background: var(--lab-bg);
  border: 1px solid var(--lab-border);
  border-radius: 0 0 6px 6px;
  border-top: none;
  margin: 0;
}

.console-header {
  background: var(--lab-header-bg);
  border-bottom: 1px solid var(--lab-border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  min-height: 32px;
}

.console-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.console-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.console-header-btn {
  background: none;
  border: 1px solid var(--lab-border);
  color: var(--lab-text-secondary);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.console-header-btn-lg {
  min-width: 34px;
  height: 30px;
  padding: 6px 10px;
}

.console-header-btn:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
}

.screenshot-dropdown-container {
  position: relative;
  display: inline-block;
  z-index: 40;
}

.screenshot-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--lab-bg);
  border: 1px solid var(--lab-border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  z-index: 4000;
  overflow: hidden;
}

.screenshot-dropdown-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--lab-text-secondary);
  border-bottom: 1px solid var(--lab-border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.screenshot-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: none;
  border: none;
  color: var(--lab-text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.screenshot-dropdown-item:hover {
  background: var(--lab-sidebar-hover);
}

.screenshot-dropdown-item i:first-child {
  width: 16px;
  text-align: center;
}

.screenshot-dropdown-item span {
  flex: 1;
}

.screenshot-copy-btn {
  padding: 4px 8px;
  background: var(--lab-accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
}

.screenshot-copy-btn:hover {
  background: var(--lab-accent-hover);
  transform: scale(1.05);
}

.screenshot-copy-btn i {
  font-size: 11px;
}

.console-screenshot-source {
  position: fixed;
  left: -10000px;
  top: 0;
  z-index: -1;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.4;
  padding: 12px;
  border: 1px solid var(--lab-border);
  border-radius: 6px;
}

/* Screenshot theme classes */
/* Light theme: white background */
.screenshot-theme-light {
  background: #ffffff !important;
  background-color: #ffffff !important;
}

.screenshot-theme-light *,
.screenshot-theme-light textarea,
.screenshot-theme-light pre,
.screenshot-theme-light code,
.screenshot-theme-light div {
  background: #ffffff !important;
  background-color: #ffffff !important;
}

/* Dark theme: force dark background, preserve original syntax highlighting colors */
.screenshot-theme-dark {
  background: #0b1220 !important;
  background-color: #0b1220 !important;
}

.screenshot-theme-dark *,
.screenshot-theme-dark textarea,
.screenshot-theme-dark pre,
.screenshot-theme-dark code,
.screenshot-theme-dark div {
  background: #0b1220 !important;
  background-color: #0b1220 !important;
}

.console-header-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.console-header-btn:disabled:hover {
  background: none;
  color: var(--lab-text-secondary);
}

.console-header-btn.stop {
  border-color: #ef4444;
  color: #ef4444;
}

.console-header-btn.stop:hover {
  background: rgba(239, 68, 68, 0.1);
}

.runner-section .console-output {
  min-height: 180px;
  max-height: 350px;
  overflow-y: auto;
  padding: 12px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.4;
  background: var(--lab-bg);
  color: var(--lab-text-primary);
  border: none;
  resize: vertical;
  outline: none;
}

.runner-section .console-output.input-locked {
  cursor: text;
  caret-color: transparent;
}

.runner-section .console-output.input-active {
  cursor: text;
  caret-color: var(--lab-text-primary);
}

.console-footer {
  padding: 8px 16px;
  background: var(--lab-header-bg);
  border-top: 1px solid var(--lab-border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--lab-text-secondary);
}

.console-footer i {
  color: #22c55e;
}

/* Mobile responsiveness for compact layout */
@media (max-width: 768px) {
  .code-section {
    margin: 8px 8px 0 8px;
  }
  
  .runner-section {
    margin: 0 8px 15px 8px;
  }
  
  .ai-explanation-section {
    margin: 0 8px 15px 8px;
  }
  
  .syntax-highlighter-wrapper {
    max-height: 50vh;
  }
  
  .runner-section .console-output {
    min-height: 150px;
    max-height: 250px;
    font-size: 12px;
  }
  
  .console-header {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 28px;
  }
  
  .console-header-btn {
    padding: 4px 8px;
    font-size: 11px;
  }

  .console-header-btn-lg {
    min-width: 32px;
    height: 28px;
    padding: 4px 8px;
  }
}

@media (max-width: 480px) {
  .code-section {
    margin: 5px 5px 0 5px;
  }
  
  .runner-section {
    margin: 0 5px 10px 5px;
  }
  
  .ai-explanation-section {
    margin: 0 5px 10px 5px;
  }
  
  .syntax-highlighter-wrapper {
    max-height: 45vh;
  }
  
  .runner-section .console-output {
    min-height: 120px;
    max-height: 200px;
    font-size: 11px;
    padding: 10px;
  }
  
  .console-header {
    padding: 5px 8px;
    font-size: 11px;
    min-height: 24px;
  }
  
  .console-header-left {
    gap: 6px;
  }
  
  .console-header-actions {
    gap: 4px;
  }
  
  .console-header-btn {
    padding: 3px 7px;
    font-size: 10px;
  }
  
  .console-header-btn i {
    font-size: 9px;
  }

  .console-header-btn-lg {
    min-width: 30px;
    height: 26px;
    padding: 3px 7px;
  }
}

/* ============================================
   MEMBERS TAB STYLES
   ============================================ */
.members-container {
  padding: 32px;
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.members-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

@media (max-width: 480px) {
  .experiment-header {
    padding: 10px 12px;
    gap: 8px;
  }
  
  .experiment-info h1 {
    font-size: 19px;
  }

  .experiment-info .experiment-title-no-subexpt {
    font-size: 17px;
    line-height: 1.28;
  }

  .experiment-info .experiment-title-with-subexpt {
    font-size: 16px;
    line-height: 1.2;
  }
  
  .experiment-subtitle {
    font-size: 14px;
  }
  
  .experiment-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .sql-query-header {
    flex-wrap: wrap;
    align-items: flex-start;
    row-gap: 8px;
  }

  .sql-query-title-wrap {
    flex: 1 1 100%;
    min-width: 0;
  }

  .sql-query-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }

  .sql-query-name {
    line-height: 1.3;
  }
  
  .action-btn, .action-btn-outline {
    padding: 4px 8px;
    font-size: 11px;
    flex: 1;
    justify-content: center;
  }

  .experiment-edit-form {
    padding: 10px !important;
    padding-right: 10px !important;
  }

  .experiment-edit-row {
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
  }

  .experiment-edit-row > .experiment-edit-field:first-child {
    flex: 0 0 34%;
    min-width: 0;
  }

  .experiment-edit-row > .experiment-edit-field:first-child input {
    width: 100% !important;
  }

  .experiment-edit-row > .experiment-edit-field:last-child {
    flex: 1 1 66%;
    min-width: 0;
  }

  .experiment-edit-input {
    width: 100% !important;
    min-width: auto !important;
  }

  .experiment-edit-field {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 4px !important;
    width: 100%;
    flex-wrap: wrap;
    min-width: 0 !important;
  }

  .experiment-edit-label {
    min-width: 0 !important;
    width: auto;
    white-space: nowrap;
    font-size: 11px !important;
    line-height: 1.15;
    text-align: left !important;
  }

  .experiment-edit-input {
    width: 100% !important;
  }

  .experiment-edit-field input {
    font-size: 12px !important;
  }

  .experiment-convert-box {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .experiment-convert-box .action-btn-outline {
    width: 100%;
    justify-content: center;
    padding: 6px 10px;
  }

  .experiment-edit-error {
    margin-left: 0 !important;
    margin-top: 4px !important;
  }

  .experiment-actions.editing {
    position: static !important;
    width: 100%;
    justify-content: flex-end;
    margin-top: 6px;
  }

  .members-container {
    padding: 12px;
  }

  .members-title {
    font-size: 18px;
  }

  .members-list {
    gap: 6px;
  }

  .member-card {
    padding: 10px 12px;
    gap: 10px;
  }

  .member-name {
    font-size: 13px;
  }

  .member-email {
    font-size: 11px;
  }

  .member-badge {
    font-size: 9px;
  }

  .member-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .members-toolbar {
    padding: 10px 12px;
    gap: 10px;
  }

  .toolbar-left {
    gap: 10px;
  }

  .toolbar-actions-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .toolbar-sort-btn {
    width: 32px;
    height: 32px;
  }

  .code-header {
    padding: 8px 12px;
  }

  .status-text {
    display: none;
  }
}

@media (max-width: 768px) {
  .experiment-view-stacked > div:first-child .action-btn-outline {
    padding: 7px 5px !important;
    font-size: 12px !important;
  }
}

@media (max-width: 480px) {
  .experiment-view-stacked > div:first-child .action-btn-outline {
    padding: 6px 3px !important;
    font-size: 11px !important;
  }
}

@media (max-width: 320px) {
  .experiment-info h1 {
    font-size: 15px;
  }

  .experiment-info .experiment-title-no-subexpt {
    font-size: 14px;
    line-height: 1.26;
  }

  .experiment-info .experiment-title-with-subexpt {
    font-size: 13px;
    line-height: 1.2;
  }

  .experiment-view-stacked > div:first-child .action-btn-outline {
    padding: 6px 2px !important;
    font-size: 10px !important;
  }

  .action-btn, .action-btn-outline {
    padding: 4px 6px;
    font-size: 10px;
    gap: 2px;
  }

  .code-header {
    padding: 8px 10px;
    row-gap: 6px;
  }

  .code-header-actions {
    gap: 4px;
  }

  .code-filename {
    max-width: 100%;
  }
  
  .action-btn i, .action-btn-outline i {
    font-size: 10px;
  }

  .members-container {
    padding: 8px;
  }

  .members-count {
    font-size: 11px;
  }

  .member-card {
    padding: 8px 10px;
    gap: 8px;
  }

  .member-name {
    font-size: 12px;
  }

  .member-email {
    font-size: 10px;
    line-height: 1;
  }

  .member-info {
    gap: 0px;
  }

  .member-badge {
    font-size: 6px;
    letter-spacing: 0;
  }

  .member-menu-btn {
    width: 18px;
    height: 18px;
    font-size: 9px;
  }

  .member-avatar {
    width: 20px;
    height: 20px;
    font-size: 8px;
  }

  .member-checkbox {
    width: 12px;
    height: 12px;
  }

  .members-toolbar {
    padding: 6px;
    gap: 4px;
  }

  .toolbar-actions-btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  .toolbar-sort-btn {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .members-invite-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .word-wrap-toggle span {
    display: none;
  }
}

.members-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--lab-text-primary);
  margin: 0;
}

.members-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.members-count {
  font-size: 14px;
  font-weight: 500;
  color: var(--lab-text-primary);
}

.members-invite-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--lab-accent);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.members-invite-btn:hover { background: var(--lab-accent-gradient); opacity: 0.9; }

/* Toolbar */
.members-toolbar {
  background: var(--lab-card-bg);
  border: 1px solid var(--lab-border);
  border-radius: 6px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.toolbar-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--lab-accent);
  border: 1px solid var(--lab-text-muted);
  border-radius: 4px;
  background: transparent;
}

.toolbar-actions-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--lab-btn-secondary);
  border: 1px solid var(--lab-border);
  color: var(--lab-text-secondary);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}
.toolbar-actions-btn:hover { color: var(--lab-text-primary); border-color: var(--lab-text-muted); }

.toolbar-sort-btn {
  background: var(--lab-btn-secondary);
  border: 1px solid var(--lab-border);
  color: var(--lab-text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
}
.toolbar-sort-btn:hover { color: var(--lab-text-primary); border-color: var(--lab-text-muted); }

/* Settings Tab Styles */
.settings-section-title {
  font-size: 1.1rem;
  color: var(--lab-text-primary);
  margin-bottom: 16px;
  border-bottom: 1px solid var(--lab-border);
  padding-bottom: 8px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--lab-bg);
  border-radius: 6px;
  border: 1px solid var(--lab-border);
  gap: 16px;
}

.settings-row-info {
  flex: 1;
  min-width: 0;
}

.settings-row-title {
  font-weight: 600;
  color: var(--lab-text-primary);
}

.settings-row-desc {
  font-size: 0.85rem;
  color: var(--lab-text-secondary);
}

.settings-danger-section {
  border-color: rgba(239, 68, 68, 0.2);
}

.settings-danger-title {
  color: #ef4444;
  border-bottom-color: rgba(239, 68, 68, 0.2);
}

@media (max-width: 480px) {
  .settings-section {
    padding: 16px;
  }
  .settings-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .settings-row-btn {
    width: 100%;
  }
}

@media (max-width: 320px) {
  .settings-section {
    padding: 12px;
  }
  .settings-row-title {
    font-size: 14px;
  }
  .settings-row-desc {
    font-size: 12px;
  }
}

.members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
}

.member-card {
  background: var(--lab-card-bg);
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}

.member-card.selected {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--lab-accent);
}

.member-card:hover {
  background: var(--lab-sidebar-hover);
  border-color: var(--lab-text-muted);
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 185, 129, 0.15);
  backdrop-filter: blur(10px);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  animation: slide-up 0.3s ease-out;
}

@keyframes slide-up {
  from { transform: translate(-50%, 100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.toast-notification--warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

/* Code container scroll only for very long code (higher threshold) */
.syntax-highlighter-wrapper {
  max-height: 70vh;
  overflow-y: auto;
}

.syntax-highlighter-wrapper.wrap-enabled pre {
  white-space: pre-wrap !important;
  word-break: break-all !important;
}

.syntax-highlighter-wrapper.wrap-enabled code {
  white-space: pre-wrap !important;
}

.member-checkbox {
  width: 18px;
  height: 18px;
  min-width: 18px;
  accent-color: var(--lab-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.member-checkbox:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.member-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--lab-btn-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--lab-text-primary);
  font-size: 14px;
  overflow: hidden;
  flex-shrink: 0;
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; }

.member-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.member-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--lab-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-email {
  font-size: 12px;
  color: var(--lab-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-badge {
  color: #fbbf24;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.member-menu-btn {
  background: transparent;
  border: none;
  color: var(--lab-text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  flex-shrink: 0;
}
.member-menu-btn:hover { 
  color: var(--lab-text-primary); 
  background: var(--lab-btn-secondary); 
}

/* Dropdown Menu (Universal) */
.dropdown-menu {
  position: absolute;
  background: var(--lab-card-bg);
  border: 1px solid var(--lab-border);
  border-radius: 6px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 1000;
}

.dropdown-menu.active {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--lab-text-secondary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  width: 100%;
}

.dropdown-item:hover {
  background: var(--lab-btn-secondary);
  color: var(--lab-text-primary);
}

.dropdown-item.active {
  color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
}

.dropdown-item i {
  width: 16px;
  text-align: center;
  font-size: 14px;
}

.dropdown-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--lab-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--lab-border);
  margin-bottom: 4px;
}

.dropdown-item.text-danger {
  color: #ef4444;
}

.dropdown-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Empty State */
.members-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}
.members-empty i { font-size: 48px; color: #334155; margin-bottom: 16px; }
.members-empty h3 { font-size: 20px; color: #e2e8f0; margin: 0 0 8px 0; }
.members-empty p { color: #94a3b8; margin: 0; }

/* === SETTINGS TAB === */
.settings-container {
  padding: 30px;
  max-width: 700px;
}

.settings-section {
  background: var(--lab-card-bg);
  border: 1px solid var(--lab-border);
  border-radius: 6px;
  padding: 24px;
  overflow: hidden;
  margin-bottom: 24px;
}

.settings-header {
  background: var(--lab-bg);
  padding: 20px;
  border-bottom: 1px solid var(--lab-border);
}

.settings-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--lab-text-primary);
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-header p {
  font-size: 14px;
  color: var(--lab-text-secondary);
  margin: 0;
}

.settings-content {
  padding: 24px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: var(--lab-text-secondary);
}

.form-group input,
.form-group textarea {
  background: var(--lab-input-bg);
  border: 1px solid var(--lab-border);
  color: var(--lab-text-primary);
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

.btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}
.btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Network error state */
.network-error-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.2), transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(14, 165, 233, 0.16), transparent 45%),
    var(--lab-bg);
}

.network-error-card {
  width: min(620px, 100%);
  border: 1px solid var(--lab-border);
  border-radius: 20px;
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.72));
  box-shadow: 0 18px 60px rgba(2, 6, 23, 0.5);
  padding: 36px 30px;
  text-align: center;
  backdrop-filter: blur(4px);
}

.network-error-graphic {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 18px;
}

.network-error-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(148, 163, 184, 0.45);
  animation: pulseRing 2.2s ease-in-out infinite;
}

.network-error-ring.ring-one {
  width: 150px;
  height: 150px;
  top: 0;
  left: 0;
}

.network-error-ring.ring-two {
  width: 116px;
  height: 116px;
  top: 17px;
  left: 17px;
  animation-delay: 0.5s;
}

.network-error-icon-wrap {
  position: absolute;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  top: 36px;
  left: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0f172a, #1e293b);
  border: 1px solid rgba(59, 130, 246, 0.45);
  color: #60a5fa;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.32);
}

.network-error-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #93c5fd;
  opacity: 0.8;
}

.network-error-dot.dot-one { top: 20px; right: 18px; }
.network-error-dot.dot-two { bottom: 24px; right: 10px; }
.network-error-dot.dot-three { bottom: 20px; left: 16px; }

.network-error-card h2 {
  margin: 6px 0 10px;
  font-size: 28px;
  color: #f8fafc;
}

.network-error-card p {
  margin: 0 auto;
  max-width: 480px;
  font-size: 15px;
  line-height: 1.65;
  color: #cbd5e1;
}

.network-error-actions {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.network-error-secondary {
  background: transparent;
  border: 1px solid var(--lab-border);
  color: var(--lab-text-secondary);
}

.network-error-secondary:hover {
  background: var(--lab-sidebar-hover);
  color: var(--lab-text-primary);
}

.network-error-meta {
  margin-top: 18px;
  font-size: 12px;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  padding: 10px 12px;
  word-break: break-word;
}

.spin {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulseRing {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.04); opacity: 0.8; }
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 768px) {
  .experiment-header {
    display: flex !important;
    align-items: start !important;
    gap: 10px !important;
  }

  .experiment-info {
    min-width: 0;
    width: 100%;
    position: relative;
    z-index: 1;
    padding: 2px 0 2px 2px;
    background: var(--lab-header-bg);
  }

  .experiment-info h1,
  .experiment-subtitle {
    position: relative;
    z-index: 1;
  }

  .quick-jump-strip {
    width: 0;
    border-radius: 0 18px 18px 0;
    z-index: 1;
  }

  .quick-jump-strip.open {
    width: clamp(116px, 34vw, 132px);
    padding: 8px 4px;
    overflow: visible;
    z-index: 1200;
  }

  .quick-jump-strip-header {
    font-size: 9px;
    letter-spacing: 1.2px;
    padding-bottom: 8px;
  }

  .quick-jump-list {
    gap: 5px;
  }

  .quick-jump-toggle {
    width: 24px;
    height: 70px;
    border-radius: 0 16px 16px 0;
  }

  .quick-jump-toggle span {
    font-size: 9px;
    letter-spacing: 1.1px;
  }

  .quick-jump-item {
    min-height: 31px;
    font-size: 10.5px;
    border-radius: 11px;
  }

  .quick-jump-select-btn {
    padding-right: 26px;
  }

  .quick-jump-item-actions {
    right: 2px;
  }

  .quick-jump-item-menu-btn {
    width: 22px;
    height: 22px;
  }

  .quick-jump-item-menu {
    left: auto;
    right: 0;
    top: calc(100% + 6px);
    transform: none;
    min-width: 120px;
    max-width: 138px;
  }

  .quick-jump-item-menu-action {
    font-size: 11px;
    padding: 7px 8px;
  }

  .quick-jump-group-header,
  .quick-jump-subgroup-header {
    min-height: 31px;
    font-size: 10.5px;
    border-radius: 11px;
  }

  .quick-jump-sublist,
  .quick-jump-query-list {
    gap: 4px;
    padding-left: 4px;
    margin-left: 2px;
  }

  .lab-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 2200;
    height: 100%;
    width: 300px;
    border-right-color: transparent;
    transform: translateX(-100%);
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    overflow: visible;
    transition: transform 0.25s ease, opacity 0.2s ease, visibility 0s linear 0.25s;
  }

  .lab-sidebar.open::after {
    display: none;
  }
  
  .lab-sidebar.open {
    z-index: 2200;
    width: 300px;
    transform: translateX(0);
    box-shadow: 0 20px 44px rgba(2, 6, 23, 0.45);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: transform 0.25s ease, opacity 0.2s ease;
  }
  
  .sidebar-toggle.open {
    left: 300px;
    opacity: 1;
    pointer-events: auto;
  }

  .lab-sidebar:hover + .sidebar-toggle.open {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-overlay {
    display: none;
  }

  .sidebar-overlay-mobile {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    cursor: pointer;
  }

  .sidebar-overlay-close {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translate(0, -50%);
    width: 28px;
    height: 52px;
    border: 1px solid var(--lab-border);
    border-left: none;
    border-radius: 0 14px 14px 0;
    background: color-mix(in srgb, var(--lab-sidebar-bg) 84%, var(--lab-sidebar-hover));
    color: var(--lab-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 10px 0 24px rgba(2, 6, 23, 0.24);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease, visibility 0s linear 0.24s;
    will-change: transform, opacity;
    z-index: 1201;
  }

  .sidebar-overlay-close.open {
    transform: translate(100%, -50%);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  }

  .sidebar-overlay-close:hover {
    background: var(--lab-accent);
    border-color: var(--lab-accent);
    color: #fff;
  }

  .sidebar-overlay-close i {
    font-size: 12px;
  }

  .lab-header {
    padding: 0 12px;
    height: 56px;
  }

  .network-error-card {
    padding: 28px 18px;
    border-radius: 16px;
  }

  .network-error-card h2 {
    font-size: 23px;
  }

  .network-error-card p {
    font-size: 14px;
  }

  .network-error-graphic {
    width: 132px;
    height: 132px;
  }

  .network-error-ring.ring-one {
    width: 132px;
    height: 132px;
  }

  .network-error-ring.ring-two {
    width: 100px;
    height: 100px;
    top: 16px;
    left: 16px;
  }

  .network-error-icon-wrap {
    width: 70px;
    height: 70px;
    top: 31px;
    left: 31px;
  }
  
  .lab-logo-text {
    font-size: 16px;
  }
  
  .lab-logo {
    padding-right: 12px;
    gap: 8px;
  }
  
  .lab-back-btn span {
    display: none;
  }
  
  .lab-back-btn {
    padding: 8px;
  }

  .lab-center-tabs {
    gap: 4px;
    padding: 4px;
  }
  
  .lab-center-tab {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .lab-center-tab span {
    display: none;
  }
}

@media (max-width: 480px) {
  .lab-content {
    padding-right: 8px !important;
    padding-left: 8px !important;
  }

  .lab-content:has(.experiment-view-stacked) {
    padding-right: 0 !important;
    padding-bottom: 0 !important;
  }

  .quick-jump-strip {
    width: 0;
    border-radius: 0 16px 16px 0;
  }

  .quick-jump-strip.open {
    width: clamp(108px, 44vw, 124px);
    padding: 8px 3px;
    overflow: visible;
    z-index: 1200;
  }

  .quick-jump-toggle {
    width: 20px;
    height: 58px;
    border-radius: 0 14px 14px 0;
  }

  .quick-jump-toggle span {
    font-size: 8px;
    letter-spacing: 0.9px;
  }

  .quick-jump-item {
    min-height: 28px;
    font-size: 9.5px;
  }

  .quick-jump-select-btn {
    padding-right: 24px;
  }

  .quick-jump-item-menu-btn {
    width: 20px;
    height: 20px;
  }

  .quick-jump-item-menu {
    left: auto;
    right: 0;
    top: calc(100% + 6px);
    transform: none;
    min-width: 112px;
    max-width: 126px;
  }

  .quick-jump-group-header,
  .quick-jump-subgroup-header {
    min-height: 30px;
    font-size: 10.5px;
  }

  .quick-jump-sublist,
  .quick-jump-query-list {
    gap: 4px;
    padding-left: 5px;
    margin-left: 3px;
  }

  .lab-header {
    height: auto;
    padding: 10px;
    flex-wrap: wrap;
  }

  .experiment-info {
    padding-left: 0;
  }
  
  .lab-header-left {
    width: 60%;
    gap: 10px;
  }
  
  .lab-header-right {
    width: 30%;
    justify-content: flex-end;
  }
  
  .lab-header-center {
    width: 100%;
    order: 3;
    padding-top: 10px;
  }
  
  .lab-center-tabs {
    width: 100%;
    justify-content: space-around;
  }

  .lab-sidebar {
    width: 80%;
    max-width: 280px;
    border-right-color: transparent;
  }

  .sidebar-overlay-close {
    width: 24px;
    height: 46px;
    border-radius: 0 12px 12px 0;
  }

  .sidebar-overlay-close i {
    font-size: 11px;
  }

  .lab-sidebar-content {
    min-width: 100%;
  }
  
  .sidebar-toggle.open {
    left: 280px;
    opacity: 1;
    pointer-events: auto;
  }

  .lab-sidebar:hover + .sidebar-toggle.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Make sure floating toggle is accessible */
  .sidebar-toggle {
    width: 30px;
    height: 32px;
  }

  /* Experiment Header Mobile */
  .experiment-header {
    padding: 10px 12px;
    gap: 10px;
  }

  .experiment-info h1 {
    font-size: 19px;
  }

  .experiment-subtitle {
    font-size: 14px;
  }

  .experiment-actions {
    width: 100%;
    gap: 6px;
  }

  .action-btn, .action-btn-outline {
    padding: 5px 8px;
    font-size: 11px;
    flex: 1;
    min-width: 0;
  }
}

/* Base adjustment for smaller devices */
@media (max-width: 320px) {
  .lab-logo-text { display: none; }
  .lab-name-title { font-size: 12px; max-width: 80px; }
  
  .experiment-header {
    padding: 8px 10px;
  }
  
  .action-btn, .action-btn-outline {
    padding: 4px 6px;
    font-size: 10px;
  }
}

/* === CODE RUNNER SECTION === */
.code-runner-section {
  margin-top: 16px;
  border-top: 1px solid var(--lab-border);
  padding-top: 16px;
}

.runner-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
  padding: 12px;
  background: var(--lab-panel-bg);
  border-radius: 8px;
  border: 1px solid var(--lab-border);
}

.runner-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.runner-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.runner-btn.run {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
}

.runner-btn.run:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 12px rgba(16, 185, 129, 0.45);
  transform: translateY(-2px);
}

.runner-btn.run:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.runner-btn.running {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.runner-btn.stop {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.35);
}

.runner-btn.stop:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 6px 12px rgba(239, 68, 68, 0.45);
  transform: translateY(-2px);
}

.runner-btn.stop:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.runner-btn.toggle {
  background: var(--lab-input-bg);
  color: var(--lab-text-primary);
  border: 1px solid var(--lab-border);
}

.runner-btn.toggle:hover {
  background: var(--lab-hover-bg);
  border-color: var(--lab-text-secondary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.runner-btn.toggle.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.runner-btn.toggle.active:hover {
  background: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.runner-btn.clear {
  background: var(--lab-input-bg);
  color: var(--lab-text-secondary);
  border: 1px solid var(--lab-border);
}

.runner-btn.clear:hover {
  background: var(--lab-hover-bg);
  color: var(--lab-text-primary);
  border-color: var(--lab-text-secondary);
}

.console-container {
  background: var(--lab-panel-bg);
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  overflow: hidden;
}

.console-header i {
  color: var(--lab-text-secondary);
}

.console-status {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.console-status.running {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.console-output {
  width: 100%;
  min-height: 300px;
  max-height: 500px;
  background: var(--lab-bg);
  color: var(--lab-text-primary);
  border: none;
  padding: 16px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  overflow-y: auto;
}

.console-output::-webkit-scrollbar {
  width: 8px;
}

.console-output::-webkit-scrollbar-track {
  background: var(--lab-bg);
}

.console-output::-webkit-scrollbar-thumb {
  background: var(--lab-border);
  border-radius: 4px;
}

.console-output::-webkit-scrollbar-thumb:hover {
  background: var(--lab-text-muted);
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .experiment-header {
    display: flex !important;
    align-items: start !important;
    gap: 10px !important;
    grid-template-columns: none !important;
  }
  .console-output {
    min-height: 200px;
    font-size: 13px;
  }
}

/* ============================================
   MODALS - RESPONSIVE STYLES
   ============================================ */

/* Base modal overlay styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

/* Base modal content */
.modal {
  background: var(--lab-card-bg);
  border: 1px solid var(--lab-border);
  border-radius: 14px;
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--lab-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--lab-text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.modal-close:hover {
  color: var(--lab-text-primary);
  background: var(--lab-btn-secondary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--lab-border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
  padding: 20px 24px;
  border-top: 1px solid var(--lab-border);
  margin: -24px -24px 0 -24px;
  background: var(--lab-card-bg);
  border-radius: 0 0 14px 14px;
}

.modal-actions .btn {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.modal-actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Form elements in modals */
.modal .form-group {
  margin-bottom: 18px;
}

.modal .form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--lab-text-secondary);
}

.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--lab-input-bg);
  border: 1px solid var(--lab-border);
  border-radius: 6px;
  color: var(--lab-text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
  min-height: 40px;
}

.modal .form-group input:focus,
.modal .form-group select:focus,
.modal .form-group textarea:focus {
  outline: none;
  border-color: var(--lab-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Experiment Modal Styles */
.add-experiment-modal .modal-body {
  max-height: calc(88vh - 120px);
  overflow-y: auto;
}

.experiment-form-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--lab-border);
}

.experiment-form-section:last-of-type {
  border-bottom: none;
}

.file-upload-area {
  border: 2px dashed var(--lab-border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.file-upload-area:hover {
  border-color: var(--lab-accent);
  background: rgba(59, 130, 246, 0.05);
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--lab-bg);
  border: 1px solid var(--lab-border);
  border-radius: 6px;
  font-size: 13px;
}

/* Confirmation Modal */
.confirm-modal {
  background: var(--lab-card-bg);
  border: 1px solid var(--lab-border);
  border-radius: 12px;
  padding: 28px;
  max-width: 420px;
  text-align: center;
}

.confirm-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.confirm-modal-icon i {
  font-size: 1.8rem;
  color: #ef4444;
}

.confirm-modal-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--lab-text-primary);
  margin-bottom: 8px;
}

.confirm-modal-text {
  font-size: 0.95rem;
  color: var(--lab-text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Delete Modal */
.delete-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.delete-modal-icon i {
  font-size: 1.8rem;
  color: #ef4444;
}

/* --- TABLET RESPONSIVE (768px and below) --- */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 16px;
  }
  
  .modal {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 12px;
  }
  
  .modal-header {
    padding: 16px 20px;
    gap: 10px;
  }
  
  .modal-header h2 {
    font-size: 1.2rem;
  }
  
  .modal-body {
    padding: 16px 20px;
  }
  
  .modal-footer {
    padding: 14px 20px;
    gap: 10px;
  }
  
  .modal-actions {
    padding: 14px 20px;
    margin: -16px -20px 0 -20px;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  
  .modal .form-group {
    margin-bottom: 14px;
  }
  
  .modal .form-group input,
  .modal .form-group select,
  .modal .form-group textarea {
    font-size: 14px;
    padding: 10px 12px;
  }
  
  .experiment-form-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
  }
  
  .file-upload-area {
    padding: 16px;
  }
  
  .confirm-modal {
    padding: 20px;
  }
  
  .confirm-modal-icon {
    width: 48px;
    height: 48px;
  }
}

/* --- MOBILE RESPONSIVE (480px and below) --- */
@media (max-width: 480px) {
  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }
  
  .modal {
    width: calc(100vw - 24px);
    max-width: 100%;
    max-height: 85vh;
    border-radius: 12px 12px 0 0;
    margin: 0 auto;
  }
  
  .modal-header {
    padding: 14px 16px;
    gap: 8px;
  }
  
  .modal-header h2 {
    font-size: 1.1rem;
    word-break: break-word;
  }
  
  .modal-close {
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
    flex-shrink: 0;
  }
  
  .modal-body {
    padding: 14px 16px;
    overflow-y: auto;
  }
  
  .add-experiment-modal .modal-body {
    max-height: calc(85vh - 130px);
  }
  
  .modal-footer {
    padding: 12px 16px;
    gap: 8px;
  }
  
  .modal-actions {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px 16px;
    margin: -14px -16px 0 -16px;
    border-radius: 0;
  }
  
  .modal-actions .btn {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    justify-content: center;
  }
  
  .modal .form-group {
    margin-bottom: 12px;
  }
  
  .modal .form-group label {
    font-size: 0.85rem;
    margin-bottom: 6px;
  }
  
  .modal .form-group input,
  .modal .form-group select,
  .modal .form-group textarea {
    font-size: 16px;
    padding: 10px 12px;
    min-height: 44px;
  }
  
  .experiment-form-section {
    margin-bottom: 14px;
    padding-bottom: 14px;
  }
  
  .file-upload-area {
    padding: 14px;
  }
  
  .file-upload-area i {
    font-size: 32px;
  }
  
  .file-upload-area p {
    font-size: 13px;
    margin: 8px 0 0 0;
  }
  
  .file-item {
    padding: 10px;
    font-size: 12px;
  }
  
  .confirm-modal {
    padding: 16px;
    border-radius: 12px 12px 0 0;
  }
  
  .confirm-modal-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
  }
  
  .confirm-modal-icon i {
    font-size: 1.5rem;
  }
  
  .confirm-modal-title {
    font-size: 1rem;
  }
  
  .confirm-modal-text {
    font-size: 0.85rem;
    margin-bottom: 16px;
  }
}

/* --- SMALL PHONE RESPONSIVE (320px and below) --- */
@media (max-width: 320px) {
  .modal-overlay {
    padding: 8px;
  }
  
  .modal {
    width: calc(100vw - 16px);
    border-radius: 10px 10px 0 0;
    max-height: 88vh;
  }
  
  .modal-header {
    padding: 12px 14px;
  }
  
  .modal-header h2 {
    font-size: 0.95rem;
  }
  
  .modal-body {
    padding: 12px 14px;
  }
  
  .modal-footer {
    padding: 10px 14px;
  }
  
  .modal-actions {
    padding: 10px 14px;
    margin: -12px -14px 0 -14px;
  }
  
  .modal .form-group input,
  .modal .form-group select,
  .modal .form-group textarea {
    font-size: 16px;
  }
  
  .confirm-modal {
    padding: 12px;
  }
  
  .confirm-modal-title {
    font-size: 0.95rem;
  }
  
  .confirm-modal-text {
    font-size: 0.8rem;
  }
}

/* === MARKDOWN CONTENT STYLING === */
/* Styles for AI-generated markdown content in explanation tabs */

/* Markdown content container */
.explanation-content .markdown-content {
  line-height: 1.6;
  color: var(--lab-text-primary);
}

/* Headings */
.explanation-content h1,
.explanation-content h2,
.explanation-content h3,
.explanation-content h4,
.explanation-content h5,
.explanation-content h6 {
  color: var(--lab-accent);
  margin: 1.2em 0 0.6em 0;
  font-weight: 600;
  line-height: 1.3;
}

.explanation-content h1 { font-size: 1.6rem; }
.explanation-content h2 { font-size: 1.4rem; }
.explanation-content h3 { font-size: 1.2rem; }
.explanation-content h4 { font-size: 1.1rem; }
.explanation-content h5 { font-size: 1rem; }
.explanation-content h6 { font-size: 0.9rem; }

/* First heading has no top margin */
.explanation-content h1:first-child,
.explanation-content h2:first-child,
.explanation-content h3:first-child,
.explanation-content h4:first-child,
.explanation-content h5:first-child,
.explanation-content h6:first-child {
  margin-top: 0;
}

/* Paragraphs */
.explanation-content p {
  margin: 0.8em 0;
  color: var(--lab-text-primary);
}

/* Strong/Bold text */
.explanation-content strong,
.explanation-content b {
  font-weight: 600;
  color: var(--lab-accent);
}

/* Emphasis/Italic text */
.explanation-content em,
.explanation-content i {
  font-style: italic;
  color: var(--lab-text-secondary);
}

/* Code inline */
.explanation-content code {
  background: rgba(116, 116, 116, 0.1);
  border: 1px solid var(--lab-border);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--lab-accent);
}

/* Modal Tabs */
.cdx-modal-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--lab-border);
  padding-bottom: 12px;
}

.cdx-modal-tab {
  flex: 1;
  padding: 10px 16px;
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.04);
  color: var(--lab-text-secondary);
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cdx-modal-tab:hover {
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.08);
  color: var(--lab-text-primary);
  border-color: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.3);
  transform: translateY(-1px);
}

.cdx-modal-tab.active {
  background: linear-gradient(135deg, rgba(var(--lab-accent-rgb, 100, 150, 200), 0.15), rgba(var(--lab-accent-rgb, 100, 150, 200), 0.08));
  color: var(--lab-accent);
  border-color: var(--lab-accent);
  box-shadow: 0 4px 12px rgba(var(--lab-accent-rgb, 100, 150, 200), 0.12);
  font-weight: 600;
}

/* File Creation Section in Experiment Modal */
.cdx-modal-file-creation-section-v2 {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.04);
  border: 1px solid rgba(var(--lab-accent-rgb, 100, 150, 200), 0.12);
  border-radius: 12px;
  margin-bottom: 24px;
  animation: modalTabEnter 0.3s ease;
}

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

.cdx-modal-file-creation-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cdx-modal-file-create-inline {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 112px 124px;
  gap: 12px;
  align-items: end;
}

.cdx-modal-file-create-inline .cdx-modal-form-group {
  margin-bottom: 0;
}

.cdx-modal-filetype-group {
  min-width: 0;
}

.cdx-modal-file-type-select-wrap {
  position: relative;
}

.cdx-modal-file-type-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  background-color: var(--lab-bg-secondary);
  background-image: linear-gradient(45deg, transparent 50%, var(--lab-text-secondary) 50%), linear-gradient(135deg, var(--lab-text-secondary) 50%, transparent 50%);
  background-position: calc(100% - 12px) calc(50% - 3px), calc(100% - 6px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  color: var(--lab-text-primary);
  padding: 10px 36px 10px 12px;
  font-size: 0.94rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  color: transparent;
  text-shadow: 0 0 0 transparent;
}

.cdx-modal-file-type-selected {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--lab-text-primary);
  font-size: 0.94rem;
  font-weight: 600;
  pointer-events: none;
}

.cdx-modal-file-type-select:hover {
  border-color: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.3);
}

.cdx-modal-file-type-select:focus {
  outline: none;
  border-color: var(--lab-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--lab-accent) 22%, transparent);
}

.cdx-modal-file-type-select option {
  background: var(--lab-bg);
  color: var(--lab-text-primary);
  font-weight: 500;
}

.cdx-modal-create-file-inline-btn-wrap {
  display: flex;
  align-items: end;
  justify-content: flex-start;
}

.cdx-modal-create-file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--lab-accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 124px;
  max-width: 100%;
  min-height: 42px;
}

.cdx-modal-create-file-btn:hover {
  background: color-mix(in srgb, var(--lab-accent) 110%, black);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cdx-modal-create-file-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cdx-modal-create-file-btn:disabled {
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.4);
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 860px) {
  .cdx-modal-file-create-inline {
    grid-template-columns: 1fr;
  }

  .cdx-modal-create-file-inline-btn-wrap {
    width: 100%;
  }
}

/* File Editor in Modal */
.cdx-modal-file-editor-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
  border: 1px solid rgba(var(--lab-accent-rgb, 100, 150, 200), 0.24);
  border-radius: 10px;
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.04);
  overflow: hidden;
  animation: slideDown 0.2s ease;
}

.cdx-modal-file-editor-container.dark {
  background: #000000;
  border-color: rgba(255, 255, 255, 0.1);
}

.cdx-modal-file-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.08);
  border-bottom: 1px solid rgba(var(--lab-accent-rgb, 100, 150, 200), 0.12);
}

.dark .cdx-modal-file-editor-header {
  background: #111111;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.cdx-modal-file-editor-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--lab-text-primary);
}

.cdx-modal-editor-pencil {
  font-size: 1.1rem;
  color: var(--lab-accent);
}

.cdx-modal-editor-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--lab-text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.cdx-modal-editor-close:hover {
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.12);
  color: var(--lab-text-primary);
}

.cdx-modal-file-editor {
  width: 100%;
  min-height: 240px;
  max-height: 400px;
  padding: 12px 16px;
  border: none;
  border-radius: 0;
  background: var(--lab-bg-secondary);
  color: var(--lab-text-primary);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.dark .cdx-modal-file-editor {
  background: #000000;
}

.cdx-modal-file-editor::placeholder {
  color: var(--lab-text-secondary);
}

.cdx-modal-editor-info {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.04);
  border-top: 1px solid rgba(var(--lab-accent-rgb, 100, 150, 200), 0.12);
  font-size: 0.82rem;
  color: var(--lab-text-secondary);
}

.cdx-modal-editor-lines,
.cdx-modal-editor-chars {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* File Item Actions */
.cdx-modal-file-item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cdx-modal-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(var(--lab-border-rgb, 51, 65, 85), 0.7);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cdx-modal-file-item:last-child {
  border-bottom: none;
}

.cdx-modal-file-item.is-drop-target {
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.08);
}

.cdx-modal-file-item.is-dragging {
  opacity: 0.75;
}

.cdx-modal-file-item-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.cdx-modal-file-order-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--lab-text-muted);
  cursor: grab;
  flex-shrink: 0;
}

.cdx-modal-file-order-handle:active {
  cursor: grabbing;
}

.cdx-modal-file-order-handle:hover {
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.12);
  color: var(--lab-text-primary);
}

.cdx-modal-file-order-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.14);
  color: var(--lab-text-primary);
  font-size: 0.74rem;
  font-weight: 700;
  flex-shrink: 0;
}

.cdx-modal-file-item-info {
  min-width: 0;
  flex: 1;
}

.cdx-modal-file-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--lab-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cdx-modal-file-folder-help {
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--lab-text-secondary);
}

.cdx-upload-explorer-shell {
  margin-top: 10px;
  border: 1px solid var(--lab-border);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.4);
  overflow: hidden;
}

.cdx-upload-explorer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.08);
  border-bottom: 1px solid var(--lab-border);
}

.cdx-upload-explorer-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.cdx-upload-explorer-new-folder-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(var(--lab-accent-rgb, 100, 150, 200), 0.22);
  border-radius: 8px;
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.08);
  color: var(--lab-text-primary);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cdx-upload-explorer-new-folder-btn:hover {
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.14);
  border-color: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.4);
}

.cdx-upload-explorer-creator {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--lab-border);
  background: rgba(255, 255, 255, 0.02);
}

.cdx-upload-explorer-creator-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  background: var(--lab-input-bg);
  color: var(--lab-text-primary);
  font-size: 0.86rem;
}

.cdx-upload-explorer-creator-input:focus {
  outline: none;
  border-color: var(--lab-accent);
  box-shadow: 0 0 0 2px rgba(var(--lab-accent-rgb, 100, 150, 200), 0.18);
}

.cdx-upload-explorer-creator-confirm,
.cdx-upload-explorer-creator-cancel,
.cdx-explorer-folder-action {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--lab-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--lab-text-primary);
  font-size: 0.8rem;
  cursor: pointer;
}

.cdx-upload-explorer-creator-confirm {
  border-color: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.3);
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.12);
}

.cdx-upload-explorer-creator-cancel {
  color: var(--lab-text-secondary);
}

.cdx-upload-explorer-creator-confirm:hover,
.cdx-upload-explorer-creator-cancel:hover,
.cdx-explorer-folder-action:hover {
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.1);
}

.cdx-explorer-folder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border-top: 1px solid rgba(var(--lab-border-rgb, 51, 65, 85), 0.55);
  background: rgba(255, 255, 255, 0.01);
  cursor: pointer;
}

.cdx-explorer-folder-row:hover,
.cdx-explorer-folder-row.is-drop-target {
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.08);
}

.cdx-explorer-folder-row-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cdx-explorer-folder-toggle {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--lab-text-secondary);
  cursor: pointer;
}

.cdx-explorer-folder-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--lab-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cdx-explorer-folder-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.14);
  color: var(--lab-text-primary);
  font-size: 0.72rem;
  font-weight: 700;
}

.cdx-explorer-folder-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cdx-explorer-folder-action {
  height: 28px;
  padding: 0 8px;
  font-size: 0.74rem;
}

.cdx-explorer-folder-children {
  padding-left: 10px;
}

.cdx-upload-explorer-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--lab-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cdx-upload-explorer-count {
  font-size: 0.76rem;
  color: var(--lab-text-secondary);
}

.cdx-upload-explorer-empty {
  padding: 12px;
  font-size: 0.82rem;
  color: var(--lab-text-secondary);
}

.cdx-modal-file-item-folder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.cdx-modal-file-item-folder-label {
  font-size: 0.75rem;
  color: var(--lab-text-secondary);
  min-width: 42px;
}

.cdx-modal-file-item-folder-input {
  width: min(260px, 100%);
  height: 28px;
  border: 1px solid var(--lab-border);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 0.8rem;
  background: var(--lab-bg-secondary);
  color: var(--lab-text-primary);
}

.cdx-modal-file-item-folder-input:focus {
  outline: none;
  border-color: var(--lab-accent);
  box-shadow: 0 0 0 2px rgba(var(--lab-accent-rgb, 100, 150, 200), 0.18);
}

.cdx-modal-file-item.is-dragging .cdx-modal-file-item-name,
.cdx-modal-file-item.is-dragging .cdx-modal-file-order-badge {
  opacity: 0.85;
}

.cdx-modal-file-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid rgba(var(--lab-accent-rgb, 100, 150, 200), 0.2);
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.08);
  color: var(--lab-accent);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  transition: all 0.2s ease;
}

.cdx-modal-file-edit:hover {
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.16);
  border-color: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.4);
}

.cdx-modal-file-edit:active {
  background: rgba(var(--lab-accent-rgb, 100, 150, 200), 0.24);
}

/* Code blocks */
.explanation-content pre {
  background: var(--lab-header-bg);
  border: 1px solid var(--lab-border);
  border-radius: 6px;
  padding: 12px 16px;
  overflow-x: auto;
  margin: 1em 0;
}

.explanation-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--lab-text-primary);
}

/* Lists */
.explanation-content ul,
.explanation-content ol {
  margin: 0.8em 0;
  padding-left: 1.5em;
}

.explanation-content li {
  margin: 0.4em 0;
  color: var(--lab-text-primary);
}

.explanation-content li > p {
  margin: 0.2em 0;
}

/* Nested lists */
.explanation-content ul ul,
.explanation-content ol ul,
.explanation-content ul ol,
.explanation-content ol ol {
  margin: 0.2em 0;
}

/* Blockquotes */
.explanation-content blockquote {
  border-left: 4px solid var(--lab-accent);
  margin: 1em 0;
  padding: 0.5em 0 0.5em 1em;
  background: rgba(116, 116, 116, 0.05);
  color: var(--lab-text-secondary);
  font-style: italic;
}

.explanation-content blockquote p {
  margin: 0.4em 0;
}

/* Tables */
.explanation-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

.explanation-content th,
.explanation-content td {
  border: 1px solid var(--lab-border);
  padding: 8px 12px;
  text-align: left;
}

.explanation-content th {
  background: var(--lab-header-bg);
  font-weight: 600;
  color: var(--lab-accent);
}

.explanation-content td {
  color: var(--lab-text-primary);
}

/* Horizontal rules */
.explanation-content hr {
  border: none;
  border-top: 1px solid var(--lab-border);
  margin: 1.5em 0;
}

/* Links */
.explanation-content a {
  color: var(--lab-accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.explanation-content a:hover {
  border-bottom-color: var(--lab-accent);
}

/* Images */
.explanation-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0.5em 0;
}

/* Responsive adjustments for markdown */
@media (max-width: 768px) {
  .explanation-content h1 { font-size: 1.4rem; }
  .explanation-content h2 { font-size: 1.2rem; }
  .explanation-content h3 { font-size: 1.1rem; }
  .explanation-content h4 { font-size: 1rem; }
  .explanation-content h5 { font-size: 0.9rem; }
  .explanation-content h6 { font-size: 0.85rem; }
  
  .explanation-content pre {
    padding: 8px 12px;
    font-size: 0.9rem;
  }
  
  .explanation-content ul,
  .explanation-content ol {
    padding-left: 1.2em;
  }
}

/* ─── PDF Session ──────────────────────────────────────────────────────────── */

/* Toggle button active state */
.action-btn-outline.pdf-session-toggle-btn {
  font-size: 14px;
}

.action-btn-outline.pdf-session-toggle-btn i {
  font-size: 15px;
  line-height: 1;
}

.action-btn-outline.pdf-session-toggle-btn.active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}

/* Floating session panel */
.pdf-session-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1200;
  width: 230px;
  background: var(--lab-sidebar-bg, #1e1e2e);
  border: 1px solid var(--lab-border, #3b3b5c);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 12px;
  font-size: 13px;
  color: var(--lab-text, #e2e8f0);
  transition: transform 0.22s ease;
}


.pdf-session-panel.peek-collapsed {
  transform: translateX(calc(100% - 36px));
  min-width: 0;
  width: 56px;
  padding: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  background: transparent;
  border: none;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.pdf-session-peek-toggle {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #233a5e;
  color: #bfdbfe;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transition: background 0.18s;
}
.pdf-session-peek-toggle:hover {
  background: #35507a;
}


.pdf-session-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
}

.pdf-session-panel-title {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #3b82f6;
  padding: 4px 10px 4px 6px;
  border-radius: 6px;
}

.pdf-session-panel-title i {
  font-size: 1.2em;
  margin-right: 4px;
}

.pdf-session-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--lab-text-secondary, #94a3b8);
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}
.pdf-session-close-btn:hover { color: #ef4444; }

.pdf-session-basket-count {
  font-size: 12px;
  color: var(--lab-text-secondary, #94a3b8);
}

.pdf-output-warning {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: 6px;
  padding: 7px 8px;
}

.pdf-output-warning i {
  font-size: 11px;
}

.pdf-session-basket-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 130px;
  overflow-y: auto;
  border-top: 1px solid var(--lab-border, #3b3b5c);
  padding-top: 8px;
}

.pdf-session-basket-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--lab-sidebar-hover, #2a2a3d);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}

.pdf-session-basket-label { flex: 1; }

.pdf-basket-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--lab-text-secondary, #94a3b8);
  font-size: 11px;
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1;
}
.pdf-basket-remove-btn:hover { color: #ef4444; }

.pdf-session-actions {
  display: flex;
  gap: 6px;
}

.pdf-collect-btn,
.pdf-next-btn {
  flex: 1;
  border: none;
  border-radius: 7px;
  padding: 6px 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s, opacity 0.15s;
}

.pdf-collect-btn.eligible {
  background: #10b981;
  color: #fff;
}
.pdf-collect-btn.eligible:hover { background: #059669; }

.pdf-collect-btn.run-first {
  background: #3b82f6;
  color: #fff;
}
.pdf-collect-btn.run-first:hover { background: #2563eb; }

.pdf-collect-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.pdf-collect-btn.is-disabled,
.pdf-next-btn.is-disabled,
.pdf-next-btn:disabled {
  background: #374151 !important;
  color: #9ca3af !important;
  border: 1px dashed #6b7280;
  box-shadow: none;
  opacity: 1;
}

.pdf-collect-btn.ineligible {
  background: var(--lab-sidebar-hover, #2a2a3d);
  color: var(--lab-text-secondary, #94a3b8);
  cursor: not-allowed;
  opacity: 0.7;
}

.pdf-next-btn {
  background: #3b82f6;
  color: #fff;
}
.pdf-next-btn:hover:not(:disabled):not(.is-disabled) { background: #2563eb; }

.pdf-finish-btn {
  width: 100%;
  border: none;
  border-radius: 7px;
  padding: 7px;
  font-size: 12px;
  font-weight: 700;
  background: #3b82f6;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-top: 1px solid var(--lab-border, #3b3b5c);
  margin-top: 2px;
  transition: background 0.15s;
}
.pdf-finish-btn:hover { background: #2563eb; }

/* PDF format modal basket preview */
.pdf-basket-preview {
  margin: 12px 0 4px;
  font-size: 13px;
}

.pdf-output-mode-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pdf-output-mode-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--lab-text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pdf-output-mode-toggle {
  --pdf-toggle-gap: 6px;
  --pdf-toggle-pad: 4px;
  display: flex;
  gap: var(--pdf-toggle-gap);
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  padding: var(--pdf-toggle-pad);
  position: relative;
  overflow: hidden;
}

.pdf-output-mode-toggle::before {
  content: '';
  position: absolute;
  top: var(--pdf-toggle-pad);
  left: var(--pdf-toggle-pad);
  width: calc(50% - var(--pdf-toggle-pad) - (var(--pdf-toggle-gap) / 2));
  height: calc(100% - (var(--pdf-toggle-pad) * 2));
  border-radius: 6px;
  background: #3f7fe0;
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 3px 8px rgba(59, 130, 246, 0.2);
  transition: left 0.28s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.2s ease;
  will-change: left;
  pointer-events: none;
}

.pdf-output-mode-toggle.text-selected::before {
  left: calc(50% + (var(--pdf-toggle-gap) / 2));
}

.pdf-output-mode-option {
  flex: 1;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--lab-text-secondary, #94a3b8);
  background: transparent;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: color 0.24s ease, background 0.24s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.pdf-output-mode-option:hover:not(:disabled):not(.active) {
  background: rgba(59, 130, 246, 0.18);
  color: var(--lab-text, #e2e8f0);
}

.pdf-output-mode-option.active {
  color: #fff;
  background: transparent;
  border-color: transparent;
}

.pdf-output-mode-option.active:hover:not(:disabled) {
  background: transparent;
  color: #fff;
}

.pdf-output-mode-option:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.pdf-basket-preview-list {
  max-height: 190px;
  overflow-y: auto;
  padding-right: 4px;
}

.pdf-basket-preview-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--lab-text-secondary, #94a3b8);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pdf-basket-preview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--lab-sidebar-hover, #2a2a3d);
  margin-bottom: 4px;
  font-size: 13px;
}

.pdf-basket-label {
  flex: 1;
  color: var(--lab-text, #e2e8f0);
  word-break: break-word;
}

/* Mobile adjustments */
  .lab-name-title {
    color: #ffffff;
  }

  .experiment-header {
    display: flex;
    align-items: start;
    gap: 10px;
  }

  .experiment-header > .experiment-actions:not(.editing) {
    grid-column: 3;
    grid-row: 1;
    width: auto;
    margin-top: 0;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .experiment-header > .experiment-actions:not(.editing) .action-btn,
  .experiment-header > .experiment-actions:not(.editing) .action-btn-outline {
    flex: 0 0 auto;
    min-width: 32px;
    width: 32px;
    padding: 6px;
    justify-content: center;
    color: #ffffff;
  }

  .pdf-session-panel {
    bottom: 12px;
    right: 12px;
    width: 200px;
    font-size: 12px;
  }
  .pdf-session-panel-title { font-size: 12px; }

  .experiment-header > .quick-jump-header-toggle.action-btn-outline {
    flex: 0 0 32px;
    min-width: 32px;
    width: 32px;
    max-width: 32px;
    height: 60px;
    padding: 3px;
    align-self: flex-start;
  }

@media (max-width: 480px) {
  .experiment-header {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .experiment-header > .experiment-actions:not(.editing) {
    gap: 5px;
  }

  .experiment-header > .experiment-actions:not(.editing) .action-btn,
  .experiment-header > .experiment-actions:not(.editing) .action-btn-outline {
    min-width: 28px;
    width: 28px;
    padding: 5px;
  }

  .experiment-header > .quick-jump-header-toggle.action-btn-outline {
    flex: 0 0 30px;
    min-width: 30px;
    width: 30px;
    max-width: 30px;
    height: 54px;
    padding: 2px;
  }

  .experiment-header > .quick-jump-header-toggle .quick-jump-header-label {
    font-size: 11px;
    letter-spacing: 0.65px;
  }

  .experiment-header > .quick-jump-header-toggle .quick-jump-header-symbol {
    width: 7px;
    font-size: 11px;
  }
}

@media (max-width: 320px) {
  .experiment-header > .quick-jump-header-toggle.action-btn-outline {
    flex: 0 0 28px;
    min-width: 28px;
    width: 28px;
    max-width: 28px;
    height: 50px;
  }
}

.sidebar-index-view-btn {
  width: calc(100% - 12px);
  margin: 8px 6px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--lab-border);
  border-radius: 10px;
  background: var(--lab-bg-secondary);
  color: var(--lab-text-primary);
  padding: 8px 10px;
  cursor: pointer;
}
  
@media (max-width: 768px) {
  .experiment-header {
    display: flex !important;
    align-items: start;
    gap: 10px;
    grid-template-columns: none !important;
    justify-content: flex-start !important;
  }
}

@media (max-width: 480px) {
  .experiment-header {
    display: flex !important;
    gap: 8px;
    /* padding-left: 0 !important;
    padding-right: 0 !important; */
    margin-left: 0 !important;
    margin-right: 0 !important;
    grid-template-columns: none !important;
    justify-content: flex-start !important;
  }
}

@media (max-width: 320px) {
  .experiment-header {
    display: flex !important;
    align-items: start !important;
    gap: 10px !important;
    grid-template-columns: none !important;
  }
}

.sidebar-index-view-btn:hover {
  border-color: var(--lab-accent);
}

.index-view-host {
  padding: 6px;
}

/* Experiment Navigation Bar */
.experiment-nav-bar {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  position: absolute; /* Detached from scroll flow so content scrolls under it visually */
  top: 0;
  left: 0;
  right: 0;
  min-height: 48px;
  box-sizing: border-box;
  z-index: 1400;
  background: color-mix(in srgb, var(--lab-bg) 65%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--lab-border) 40%, transparent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.experiment-view-stacked {
  display: flex !important;
  flex-direction: column !important;
  flex: 1; /* Automatically fill outer space */
  height: 100%; /* Ensure flex bounds */
  min-height: 0; /* Important for deeply nested flex columns */
  overflow: hidden !important; /* Lock vertical scroll above inner wrapper */
  position: relative; /* Anchor for absolute experiment-nav-bar */
}

/* Dedicated inner scroll wrapper for experiment contents, 100% disconnected from the top nav bar */
.experiment-scrollbar-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  min-height: 0;
  padding-top: 52px; /* Reserve stable space for nav bar at all depths */
  scrollbar-width: thin;
  scrollbar-color: var(--lab-scrollbar-thumb) var(--lab-scrollbar-track);
}

.experiment-scrollbar-wrapper::-webkit-scrollbar {
  width: 6px;
}

.experiment-scrollbar-wrapper::-webkit-scrollbar-track {
  background: var(--lab-scrollbar-track);
}

.experiment-scrollbar-wrapper::-webkit-scrollbar-thumb {
  background: var(--lab-scrollbar-thumb);
  border-radius: 99px;
}

@media (max-width: 480px) {
  .experiment-scrollbar-wrapper::-webkit-scrollbar {
    width: 5px;
  }
}

.experiment-nav-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--lab-text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.experiment-nav-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.experiment-nav-btn {
  padding: 4px 6px;
  font-size: 12px;
  min-width: 84px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s;
}

@media (max-width: 480px) {
  .experiment-nav-bar {
    padding: 6px 8px;
    gap: 4px;
  }
  
  .experiment-nav-title {
    font-size: 13px;
  }

  .experiment-nav-actions {
    gap: 4px;
  }

  .experiment-nav-btn {
    padding: 4px 5px;
    font-size: 11px;
    min-width: 60px;
  }
}

/* ExperimentAttribution.css */

.exp-attribution {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--lab-text-secondary, #8b92a5);
  line-height: 1.4;
}

.exp-attribution__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.exp-attribution__badge--pending {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.exp-attribution__badge--rejected {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.exp-attribution__field {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.exp-attribution__label {
  font-weight: 500;
  color: var(--lab-text-muted, #6b7280);
}

.exp-attribution__value {
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
  font-size: 11px;
  color: var(--lab-text-secondary, #8b92a5);
  background: var(--lab-hover-bg, rgba(255,255,255,0.04));
  border-radius: 3px;
  padding: 0 4px;
}

.exp-attribution__separator {
  color: var(--lab-text-muted, #6b7280);
  user-select: none;
}

.exp-attribution__history-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 11.5px;
  color: var(--lab-accent, #6366f1);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.15s ease;
  font-family: inherit;
}

.exp-attribution__history-link:hover {
  opacity: 0.75;
}

.exp-attribution__approve-btn {
  background: var(--lab-accent, #6366f1);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
  margin-left: 4px;
}

.exp-attribution__approve-btn:hover {
  opacity: 0.85;
}

.exp-attribution__reject-btn {
  background: var(--danger-color, #ef4444);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
  margin-left: 4px;
}

.exp-attribution__reject-btn:hover {
  opacity: 0.85;
}
/* RevisionHistoryModal.css */

/* ─── Backdrop ─────────────────────────────────────────────────────────────── */
.rhm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9900;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 16px;
  animation: rhm-backdrop-in 0.18s ease;
}

@keyframes rhm-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── Modal Panel ──────────────────────────────────────────────────────────── */
.rhm-modal {
  background: var(--lab-bg, #1a1d27);
  border: 1px solid var(--lab-border, rgba(255,255,255,0.08));
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  width: min(420px, 100%);
  max-height: min(520px, calc(100vh - 32px));
  animation: rhm-modal-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rhm-modal-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Header ───────────────────────────────────────────────────────────────── */
.rhm-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--lab-border, rgba(255,255,255,0.07));
}

.rhm-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.rhm-header-content {
  flex: 1;
  min-width: 0;
}

.rhm-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--lab-text-primary, #e2e8f0);
  margin: 0;
  line-height: 1.3;
}

.rhm-subtitle {
  font-size: 12px;
  color: var(--lab-text-secondary, #8b92a5);
  margin: 2px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rhm-close-btn {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--lab-text-secondary, #8b92a5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.rhm-close-btn:hover {
  background: var(--lab-hover-bg, rgba(255,255,255,0.06));
  color: var(--lab-text-primary, #e2e8f0);
}

/* ─── Meta strip ───────────────────────────────────────────────────────────── */
.rhm-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 18px;
  background: var(--lab-hover-bg, rgba(255,255,255,0.03));
  border-bottom: 1px solid var(--lab-border, rgba(255,255,255,0.05));
  font-size: 11.5px;
  color: var(--lab-text-secondary, #8b92a5);
}

.rhm-meta-label {
  font-weight: 600;
  color: var(--lab-text-muted, #6b7280);
}

/* ─── Body ─────────────────────────────────────────────────────────────────── */
.rhm-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
}

.rhm-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 0;
  color: var(--lab-text-secondary, #8b92a5);
  font-size: 13px;
  text-align: center;
}

.rhm-state i {
  font-size: 22px;
  opacity: 0.6;
}

.rhm-state--error {
  color: #f87171;
}

/* ─── Timeline ─────────────────────────────────────────────────────────────── */
.rhm-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rhm-entry {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}

.rhm-entry:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 24px;
  bottom: -10px;
  width: 1px;
  background: var(--lab-border, rgba(255,255,255,0.07));
}

.rhm-entry-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #6366f1;
  flex-shrink: 0;
  margin-top: 4px;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.rhm-entry-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 12.5px;
}

.rhm-entry-author {
  font-weight: 600;
  color: var(--lab-text-primary, #e2e8f0);
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  font-size: 12px;
}

.rhm-entry-time {
  color: var(--lab-text-muted, #6b7280);
  font-size: 11px;
}

.rhm-entry-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rhm-entry-badge--approved {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.rhm-entry-badge--latest {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* ─── Footer ───────────────────────────────────────────────────────────────── */
.rhm-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--lab-border, rgba(255,255,255,0.07));
  display: flex;
  justify-content: flex-end;
}

.rhm-footer-btn {
  padding: 7px 18px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: var(--lab-hover-bg, rgba(255,255,255,0.06));
  color: var(--lab-text-primary, #e2e8f0);
  border: 1px solid var(--lab-border, rgba(255,255,255,0.1));
  transition: background 0.15s;
  font-family: inherit;
}

.rhm-footer-btn:hover {
  background: var(--lab-hover-bg-strong, rgba(255,255,255,0.1));
}
