/* ============================================
 * JanitorAI Script Builder
 * ============================================ */

/* ============================================
 * FONTS - Jura
 * ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Jura:wght@300..700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ============================================
 * ROOT VARIABLES
 * ============================================ */
:root {
  /* Base Colors */
  --colour-base-white: #ffffff;
  --colour-grey-900: #1c1c1e;
  --colour-grey-800: #202123;
  --colour-grey-700: #252629;
  --colour-grey-600: #2a2b2e;
  --colour-grey-500: #4c4e53;
  --colour-grey-400: #6e7179;
  --colour-grey-300: #93959c;
  --colour-grey-200: #b8b9be;
  --colour-grey-100: #dddee0;

  /* Pink Palette */
  --colour-pink-900: #251425;
  --colour-pink-800: #3e213d;
  --colour-pink-700: #7b437a;
  --colour-pink-600: #b964b7;
  --colour-pink-500: #f786f4;
  --colour-pink-400: #f9a4f7;
  --colour-pink-300: #fbc3fa;
  --colour-pink-200: #fde0fc;
  --colour-pink-100: #feedfe;

  /* Purple Palette */
  --colour-purple-900: #1a1726;
  --colour-purple-800: #2b2640;
  --colour-purple-700: #574c7f;
  --colour-purple-600: #8273bf;
  --colour-purple-500: #ae99ff;
  --colour-purple-400: #c2b3ff;
  --colour-purple-300: #d7ccff;
  --colour-purple-200: #eae5ff;
  --colour-purple-100: #f3f0ff;
  --purple-badge: #8400ff;
  --purple-600: #6b46c1;
  --purple-700: #553c9a;

  /* White Opacity */
  --white-opacity-75: rgba(255, 255, 255, 0.75);
  --white-opacity-50: rgba(255, 255, 255, 0.5);
  --white-opacity-25: rgba(255, 255, 255, 0.25);
  --white-opacity-15: rgba(255, 255, 255, 0.15);
  --white-opacity-10: rgba(255, 255, 255, 0.1);
  --white-opacity-5: rgba(255, 255, 255, 0.05);

  /* Typography */
  --font-family-primary: "Poppins", sans-serif;
  --font-family-jura: "Jura", monospace;
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --fontsize-heading-h4: 1.3125rem;
  --fontsize-body-lg: 1.125rem;
  --fontsize-body-md: 1rem;
  --fontsize-body-sm: 0.875rem;
  --fontsize-body-ty: 0.75rem;
  --line-height-heading-h4: 1.75rem;
  --line-height-body-lg: 1.5rem;
  --line-height-body-md: 1.3125rem;
  --line-height-body-sm: 1.125rem;
  --line-height-body-ty: 0.9375rem;

  /* Radius */
  --radius-5: 5px;
  --radius-10: 10px;

  /* Scripts Theme Colors - Primary Palette */
  --scripts-bg-primary: #36393f;
  --scripts-border-color: #40444b;
  --text-placeholder: #c6a3ff;
  --border-color: #7f3cec;
  --bg-primary: #313338;
  --bg-secondary: #00000042;
  --bg-tertiary: #5b21b6;
  --text-primary: #c6a3ff;
  --text-secondary: #ffffffcc;
  --color-error-primary: #ff4444;

  /* Theme Colors */
  --scripts-theme-purple: #4a3570;
  --scripts-theme-purple-light: #8b5cf6;
  --scripts-theme-teal: #0e5a70;
  --scripts-theme-teal-light: #14b8a6;
  --scripts-theme-green: #0f5940;
  --scripts-theme-green-light: #10b981;
  --scripts-theme-orange: #8b3a1a;
  --scripts-theme-orange-light: #f97316;
  --scripts-theme-pink: #8b2c50;
  --scripts-theme-pink-light: #ec4899;
  --scripts-theme-red: #8b2929;
  --scripts-theme-red-light: #ef4444;
  --scripts-theme-cyan: #164e63;
  --scripts-theme-cyan-light: #06b6d4;
  --scripts-theme-candy: #d10056;
  --scripts-theme-candy-light: #ff6b6b;
  --scripts-theme-mint: #00826f;
  --scripts-theme-mint-light: #4ade80;
  --scripts-theme-sunset: #dc2626;
  --scripts-theme-sunset-light: #fbbf24;
  --scripts-theme-grape: #6366f1;
  --scripts-theme-grape-light: #a78bfa;
  --scripts-theme-forest: #14532d;
  --scripts-theme-forest-light: #22c55e;

  /* White Scale */
  --white-100: #ffffff;
  --white-90: #ffffffe6;
  --white-80: #ffffffcc;
  --white-70: #ffffffb3;
  --white-60: #ffffff99;
  --white-50: #ffffff80;
  --white-40: #ffffff66;
  --white-30: #ffffff4d;
  --white-20: #ffffff33;
  --white-10: #ffffff1a;
  --white-16: #ffffff29;

  /* Success/Error */
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Legacy Variables for Compatibility */
  --accent: #f786f4;
  --accent-hover: #f9a4f7;
  --accent-soft: rgba(247, 134, 244, 0.15);
}

/* ============================================
 * BASE STYLES
 * ============================================ */
* {
  box-sizing: border-box;
}

html, body {
  background-color: var(--bg-primary) !important;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-jura);
  color: var(--white-90);
  line-height: 1.5;
  min-height: 100vh;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 0.4em;
}

::-webkit-scrollbar-track {
  background-color: transparent;
}

::-webkit-scrollbar-thumb {
  background: #8080804d;
  border-radius: 6px;
  box-shadow: inset 0.05em 0.05em #0000001a, inset 0 -0.05em #00000012;
}

/* Text Selection */
::selection {
  background: var(--accent);
  color: var(--white-100);
}

/* ============================================
 * LAYOUT - Sidebar Structure
 * ============================================ */
.janitor-app {
  display: flex;
  min-height: 100vh;
}

.janitor-sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--colour-grey-800);
  border-right: 1px solid var(--scripts-border-color);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.janitor-sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--scripts-border-color);
  text-align: center;
}

.janitor-sidebar-logo {
  max-width: 100px;
  height: auto;
  margin-bottom: 0.5rem;
}

.janitor-sidebar-title {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  color: var(--white-70);
  margin: 0;
}

.janitor-sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.janitor-nav-section {
  margin-bottom: 0.5rem;
}

.janitor-nav-section-title {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  font-weight: var(--font-weight-semibold);
  color: var(--white-50);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.5rem 1.5rem;
  margin: 0;
}

.janitor-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--white-70);
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.janitor-nav-item:hover {
  background: var(--white-opacity-5);
  color: var(--white-100);
}

.janitor-nav-item.active {
  background: linear-gradient(90deg, rgba(247, 134, 244, 0.15), transparent);
  color: var(--colour-pink-500);
  border-left: 3px solid var(--colour-pink-500);
}

.janitor-nav-item.experimental {
  color: var(--warning);
}

.janitor-main {
  flex: 1;
  padding: 2rem 3rem;
  overflow-x: hidden;
  max-width: calc(100vw - 280px);
}

.janitor-content {
  max-width: 1000px;
  margin: 0 auto;
}

/* ============================================
 * HEADER
 * ============================================ */
.janitor-header {
  text-align: center;
  margin-bottom: 2rem;
}

.header-banner-wrap {
  text-align: center;
  margin-bottom: 1rem;
}

.header-logo {
  max-width: 120px;
  height: auto;
  margin-bottom: 0.5rem;
}

.header-banner-subtext {
  font-size: var(--fontsize-body-ty);
  color: var(--white-50);
}

.page-title {
  font-family: var(--font-family-jura);
  font-size: 2rem;
  font-weight: var(--font-weight-bold);
  color: var(--white-100);
  margin: 0 0 0.5rem 0;
  text-align: center;
}

.page-subtitle {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  color: var(--white-60);
  margin: 0 0 1.5rem 0;
  text-align: center;
}

/* ============================================
 * CARDS
 * ============================================ */
.card, .janitor-card {
  background: var(--scripts-bg-primary);
  border: 1px solid var(--scripts-border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card h3, .janitor-card h3 {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-heading-h4);
  font-weight: var(--font-weight-semibold);
  color: var(--white-100);
  margin: 0 0 1rem 0;
}

.card h4, .janitor-card h4 {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-md);
  font-weight: var(--font-weight-semibold);
  color: var(--white-90);
  margin: 1rem 0 0.75rem 0;
}

.card p, .janitor-card p {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  color: var(--white-80);
  line-height: 1.6;
}

/* ============================================
 * FORM INPUTS
 * ============================================ */
.form-group {
  margin-bottom: 1.5rem;
}

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

.janitor-label, .form-group label {
  display: block;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  font-weight: var(--font-weight-semibold);
  color: #dcddde;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.janitor-label-required {
  color: var(--color-error-primary);
  margin-left: 0.25rem;
}

.janitor-label-optional {
  color: #72767d;
  margin-left: 0.5rem;
  font-weight: var(--font-weight-regular);
  text-transform: none;
}

.janitor-input, .form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--scripts-bg-primary);
  border: 1px solid var(--scripts-border-color);
  border-radius: 6px;
  color: var(--white-100);
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  transition: all 0.2s ease;
}

.janitor-input:focus, .form-group input:focus,
.form-group textarea:focus, .form-group select:focus {
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
  outline: none;
}

.janitor-input::placeholder, .form-group input::placeholder,
.form-group textarea::placeholder {
  color: #72767d;
}

.janitor-input.error {
  border-color: var(--color-error-primary);
}

.janitor-input.error:focus {
  border-color: var(--color-error-primary);
  box-shadow: 0 0 0 3px rgba(240, 71, 71, 0.1);
}

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

.janitor-number-input {
  max-width: 120px;
}

/* Textarea */
.janitor-textarea, .form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--scripts-bg-primary);
  border: 1px solid var(--scripts-border-color);
  border-radius: 6px;
  color: var(--white-100);
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  resize: vertical;
  min-height: 80px;
  transition: all 0.2s ease;
}

.janitor-textarea:focus, .form-group textarea:focus {
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
  outline: none;
}

.janitor-textarea::placeholder {
  color: #72767d;
}

/* Select */
.janitor-select-wrapper {
  position: relative;
}

.janitor-select, .form-group select {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  background: var(--scripts-bg-primary);
  border: 1px solid var(--scripts-border-color);
  border-radius: 6px;
  color: #dcddde;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  cursor: pointer;
  appearance: none;
  transition: all 0.2s ease;
}

.janitor-select:focus {
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
  outline: none;
}

.janitor-select-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #8e9297;
  pointer-events: none;
}

/* Char Count */
.janitor-char-count {
  text-align: right;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  color: #72767d;
  margin-top: 0.25rem;
}

/* Help/Hint Text */
.help-text, .janitor-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  color: #8e9297;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.janitor-error-message {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  color: var(--color-error-primary);
  margin-top: 0.5rem;
}

/* Example Text */
.example-text {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  color: var(--colour-pink-400);
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(247, 134, 244, 0.1);
  border-radius: 4px;
  border-left: 3px solid var(--colour-pink-500);
}

.example-text code {
  background: var(--scripts-border-color);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  font-size: 0.9em;
}

/* ============================================
 * SWITCHES - JanitorAI Native Toggle Style
 * ============================================ */
.janitor-switch-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.janitor-switch-label {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.janitor-switch {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  z-index: 1;
}

.janitor-switch.sm {
  width: 2.5rem;
  height: 1.375rem;
}

.janitor-switch.md {
  width: 3rem;
  height: 1.625rem;
}

.janitor-switch.lg {
  width: 3.5rem;
  height: 2rem;
}

.janitor-switch-input {
  opacity: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  cursor: pointer;
}

.janitor-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 34px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.janitor-switch-slider:before {
  position: absolute;
  content: "";
  background-color: #9ca3af;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  top: 50%;
  transform: translateY(-50%);
}

.janitor-switch.sm .janitor-switch-slider:before {
  height: 1rem;
  width: 1rem;
  left: 0.1875rem;
  bottom: 0.1875rem;
}

.janitor-switch.md .janitor-switch-slider:before {
  height: 1.25rem;
  width: 1.25rem;
  left: 0.1875rem;
  bottom: 0.1875rem;
}

.janitor-switch.lg .janitor-switch-slider:before {
  height: 1.5rem;
  width: 1.5rem;
  left: 0.25rem;
  bottom: 0.25rem;
}

.janitor-switch-input:checked + .janitor-switch-slider {
  background-color: var(--purple-600, #6b46c1);
  border-color: var(--purple-700, #553c9a);
}

.janitor-switch-input:checked + .janitor-switch-slider:before {
  background-color: #fff;
}

.janitor-switch.sm .janitor-switch-input:checked + .janitor-switch-slider:before {
  transform: translate(1.0625rem, -50%);
}

.janitor-switch.md .janitor-switch-input:checked + .janitor-switch-slider:before {
  transform: translate(1.3125rem, -50%);
}

.janitor-switch.lg .janitor-switch-input:checked + .janitor-switch-slider:before {
  transform: translate(1.4375rem, -50%);
}

.janitor-switch-input:not(:disabled):hover + .janitor-switch-slider {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.janitor-switch-input:checked:not(:disabled):hover + .janitor-switch-slider {
  box-shadow: 0 0 0 2px rgba(159, 122, 234, 0.3);
}

.janitor-switch-input:focus + .janitor-switch-slider {
  box-shadow: 0 0 0 3px rgba(159, 122, 234, 0.4);
}

.janitor-switch-input:disabled + .janitor-switch-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.janitor-switch-input:disabled + .janitor-switch-slider:before {
  cursor: not-allowed;
}

/* Switch Group - Left Alignment */
.switch-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

/* ============================================
 * BUTTONS
 * ============================================ */
.btn, .janitor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  font-weight: var(--font-weight-semibold);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.btn, .janitor-btn-primary {
  background: linear-gradient(135deg, var(--colour-pink-600), var(--colour-purple-600));
  color: var(--white-100);
}

.btn:hover, .janitor-btn-primary:hover {
  background: linear-gradient(135deg, var(--colour-pink-500), var(--colour-purple-500));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(247, 134, 244, 0.3);
}

.btn-secondary, .janitor-btn-secondary {
  background: var(--scripts-border-color);
  color: var(--white-90);
}

.btn-secondary:hover, .janitor-btn-secondary:hover {
  background: var(--colour-grey-500);
}

.btn-success, .janitor-btn-success {
  background: linear-gradient(135deg, #16a34a, var(--success));
  color: var(--white-100);
}

.btn-success:hover, .janitor-btn-success:hover {
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-danger, .janitor-btn-danger {
  background: linear-gradient(135deg, #dc2626, var(--danger));
  color: var(--white-100);
}

.btn-danger:hover, .janitor-btn-danger:hover {
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-warning, .janitor-btn-warning {
  background: linear-gradient(135deg, #d97706, var(--warning));
  color: var(--white-100);
}

.btn-warning:hover, .janitor-btn-warning:hover {
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* ============================================
 * TABS
 * ============================================ */
.tabs, .janitor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--scripts-border-color);
}

.tab-btn, .janitor-tab {
  padding: 0.625rem 1rem;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  font-weight: var(--font-weight-medium);
  color: var(--white-70);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover, .janitor-tab:hover {
  background: var(--white-opacity-5);
  color: var(--white-100);
}

.tab-btn.active, .janitor-tab.active {
  background: linear-gradient(135deg, rgba(247, 134, 244, 0.2), rgba(174, 153, 255, 0.2));
  color: var(--colour-pink-400);
  border-color: var(--colour-pink-500);
}

.tab-btn.experimental, .janitor-tab.experimental {
  color: var(--warning);
  border: 1px dashed var(--warning);
}

.tab-btn.experimental.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
  color: var(--warning);
}

/* Scroll Spy Layout - All panels visible and stacked */
.tab-panel, .janitor-tab-panel {
  display: block;
  margin-bottom: 2.5rem;
  padding-top: 1rem;
  scroll-margin-top: 1rem;
}

.tab-panel:last-child, .janitor-tab-panel:last-child {
  margin-bottom: 0;
}

/* Section divider between modules */
.tab-panel + .tab-panel,
.janitor-tab-panel + .janitor-tab-panel {
  border-top: 1px solid var(--scripts-border-color);
  padding-top: 2rem;
}

/* ============================================
 * MODALS
 * ============================================ */
.janitor-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 999999;
  padding: 5vh 1rem;
  background: rgba(0, 0, 0, 0.6);
  animation: janitor-fadeIn 0.2s ease;
  overflow-y: auto;
}

.janitor-modal-container {
  width: 100%;
  animation: janitor-slideUp 0.3s ease;
}

.janitor-modal-container.sm {
  max-width: 320px;
}

.janitor-modal-container.md {
  max-width: 480px;
}

.janitor-modal-container.lg {
  max-width: 640px;
}

.janitor-modal-container.xl {
  max-width: 800px;
}

.janitor-modal-content {
  background: #3e3e3e;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.janitor-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 56px;
}

.janitor-modal-title {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-md);
  font-weight: var(--font-weight-semibold);
  color: var(--white-90);
  margin: 0;
}

.janitor-modal-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.janitor-modal-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--white-100);
}

.janitor-modal-body {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--fontsize-body-sm);
  line-height: 1.5;
  max-height: 60vh;
}

.janitor-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

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

@keyframes janitor-slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
 * BANNERS
 * ============================================ */
.warning-banner, .janitor-banner-warning {
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  background: rgba(245, 158, 11, 0.1);
  border-left: 4px solid var(--warning);
  color: var(--white-90);
}

.info-banner, .janitor-banner-info {
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  background: rgba(59, 130, 246, 0.1);
  border-left: 4px solid var(--info);
  color: var(--white-90);
}

.success-banner, .janitor-banner-success {
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  background: rgba(34, 197, 94, 0.1);
  border-left: 4px solid var(--success);
  color: var(--white-90);
}

.danger-banner, .janitor-banner-danger {
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  background: rgba(239, 68, 68, 0.1);
  border-left: 4px solid var(--danger);
  color: var(--white-90);
}

/* ============================================
 * ONBOARDING CARD
 * ============================================ */
.onboarding-card {
  background: linear-gradient(135deg, var(--colour-purple-900) 0%, var(--scripts-bg-primary) 100%);
  border: 1px solid var(--colour-purple-700);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.onboarding-card h2 {
  font-family: var(--font-family-jura);
  font-size: 1.5rem;
  font-weight: var(--font-weight-bold);
  color: var(--white-100);
  margin: 0 0 1rem 0;
}

.onboarding-examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.onboarding-example {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--colour-purple-700);
}

.onboarding-example strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: var(--fontsize-body-sm);
  color: var(--white-90);
}

.onboarding-example code {
  display: block;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  color: var(--colour-pink-400);
}

/* ============================================
 * PITFALL BOX
 * ============================================ */
.pitfall-box {
  background: var(--scripts-bg-primary);
  border-left: 4px solid var(--colour-pink-500);
  padding: 1rem;
  margin-top: 1rem;
  border-radius: 8px;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
}

.pitfall-box strong {
  color: var(--colour-pink-400);
}

.pitfall-box ul {
  margin: 0.75rem 0 0 0;
  padding-left: 1.25rem;
}

.pitfall-box li {
  margin-bottom: 0.375rem;
  color: var(--white-80);
}

/* ============================================
 * GLOSSARY
 * ============================================ */
.glossary {
  background: var(--scripts-bg-primary);
  border-left: 4px solid var(--colour-purple-500);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
}

.glossary h4 {
  margin: 0 0 0.75rem 0;
  color: var(--colour-purple-400);
}

.glossary dl {
  margin: 0;
}

.glossary dt {
  font-weight: var(--font-weight-semibold);
  margin-top: 0.75rem;
  color: var(--white-90);
}

.glossary dt:first-child {
  margin-top: 0;
}

.glossary dd {
  margin: 0.25rem 0 0 1rem;
  color: var(--white-70);
}

/* ============================================
 * CHECKLIST
 * ============================================ */
.checklist {
  background: var(--scripts-bg-primary);
  border-left: 4px solid var(--success);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
}

.checklist h4 {
  margin: 0 0 0.75rem 0;
  color: var(--success);
}

.checklist ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1.25rem;
}

.checklist li {
  margin-bottom: 0.5rem;
  color: var(--white-80);
}

/* ============================================
 * MODULE CONTROL PANEL
 * ============================================ */
.debug-toggle {
  padding: 1rem;
  background: var(--colour-grey-700);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.debug-toggle .janitor-switch-container {
  width: 100%;
}

.debug-toggle .janitor-switch-label {
  flex: 1;
  color: var(--white-80);
}

.module-order {
  border: 2px dashed var(--scripts-border-color);
  border-radius: 8px;
  padding: 1rem;
  min-height: 80px;
  margin-bottom: 1rem;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--colour-grey-700);
  border: 1px solid var(--scripts-border-color);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: move;
  transition: all 0.2s ease;
}

.order-item:hover {
  background: var(--colour-grey-600);
  border-color: var(--colour-pink-700);
}

.order-item:last-child {
  margin-bottom: 0;
}

.order-item .janitor-switch-container {
  flex: 1;
}

.order-item .janitor-switch-label {
  font-family: var(--font-family-jura);
  font-weight: var(--font-weight-regular);
  color: var(--white-90);
}

.drag-handle {
  color: var(--white-40);
  font-size: 1.25rem;
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

/* ============================================
 * TOKEN METER
 * ============================================ */
.token-meter {
  margin-top: 1rem;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  color: var(--white-70);
}

.token-meter .bar {
  height: 8px;
  background: var(--colour-grey-700);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.token-meter .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--colour-pink-500), var(--danger));
  transition: width 0.3s ease;
  border-radius: 4px;
}

/* ============================================
 * DYNAMIC LIST
 * ============================================ */
.dynamic-list {
  border: 1px solid var(--scripts-border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 0.75rem;
  background: var(--colour-grey-800);
  /* No max-height - allow natural expansion so main page scrolls */
}

/* Hide empty dynamic lists to prevent black bar bug */
.dynamic-list:empty {
  display: none;
}

.dynamic-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 1rem;
  background: var(--colour-grey-700);
  border: 1px solid var(--scripts-border-color);
  border-radius: 8px;
}

.dynamic-item:last-child {
  margin-bottom: 0;
}

.dynamic-item input,
.dynamic-item textarea,
.dynamic-item select {
  flex: 1;
  min-width: 0;
}

.dynamic-item textarea {
  min-height: 60px;
  font-family: var(--font-family-jura);
}

.dynamic-item button {
  padding: 0.5rem 0.75rem;
  background: var(--danger);
  color: var(--white-100);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.dynamic-item button:hover {
  background: #dc2626;
}

/* ============================================
 * OUTPUT BOX
 * ============================================ */
.output-box {
  background: var(--colour-grey-800);
  color: var(--white-90);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--scripts-border-color);
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 0.75rem;
}

/* ============================================
 * TESTER RESULTS
 * ============================================ */
.tester-results {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--colour-grey-700);
  border: 1px solid var(--scripts-border-color);
  border-radius: 10px;
}

.tester-results h4 {
  margin: 0 0 1rem 0;
  font-family: var(--font-family-jura);
  color: var(--colour-pink-400);
}

.tester-result-section {
  margin-bottom: 1rem;
}

.tester-result-section:last-child {
  margin-bottom: 0;
}

.tester-result-section strong {
  display: block;
  margin-bottom: 0.5rem;
  font-family: var(--font-family-jura);
  color: var(--white-80);
  font-size: var(--fontsize-body-sm);
}

.tester-result-section .output-box {
  margin-top: 0;
}

/* Batch Results */
.batch-result-item {
  background: var(--colour-grey-700);
  border: 1px solid var(--scripts-border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.batch-result-item.success {
  border-left: 4px solid var(--success);
}

.batch-result-item.no-trigger {
  border-left: 4px solid var(--white-40);
}

.batch-result-item.error {
  border-left: 4px solid var(--danger);
}

.batch-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.batch-result-number {
  font-family: var(--font-family-jura);
  font-weight: var(--font-weight-bold);
  color: var(--colour-pink-400);
}

.batch-result-status {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  background: var(--colour-grey-600);
}

.batch-result-message {
  font-family: var(--font-family-jura);
  font-style: italic;
  color: var(--white-70);
  font-size: var(--fontsize-body-ty);
  padding: 0.5rem;
  background: var(--colour-grey-800);
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.batch-result-details {
  display: none;
  margin-top: 0.75rem;
}

.batch-result-details.expanded {
  display: block;
}

/* ============================================
 * ANALYZER
 * ============================================ */
.analyzer-results {
  background: var(--colour-grey-800);
  border: 1px solid var(--scripts-border-color);
  border-radius: 10px;
  padding: 1.25rem;
  margin-top: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

.analyzer-section {
  margin-bottom: 1.25rem;
}

.analyzer-section:last-child {
  margin-bottom: 0;
}

.analyzer-section h4 {
  margin: 0 0 0.75rem 0;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  color: var(--white-90);
}

.analyzer-item {
  background: var(--colour-grey-700);
  border: 1px solid var(--scripts-border-color);
  border-radius: 8px;
  padding: 0.875rem;
  margin-bottom: 0.625rem;
}

.analyzer-item:last-child {
  margin-bottom: 0;
}

.analyzer-keyword {
  font-family: var(--font-family-jura);
  font-weight: var(--font-weight-bold);
  color: var(--colour-pink-400);
}

.analyzer-usage {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  color: var(--white-60);
  margin-top: 0.375rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--scripts-border-color);
}

.analyzer-warning {
  border-left: 3px solid var(--warning);
}

.analyzer-conflict {
  border-left: 3px solid var(--danger);
}

.analyzer-ok {
  border-left: 3px solid var(--success);
}

.analyzer-empty {
  font-family: var(--font-family-jura);
  color: var(--white-50);
  font-style: italic;
  text-align: center;
  padding: 1.5rem;
}

.analyzer-summary {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--colour-grey-700);
  border-radius: 8px;
}

.analyzer-stat {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
}

.analyzer-stat strong {
  color: var(--colour-pink-400);
}

/* ============================================
 * TOAST NOTIFICATIONS
 * ============================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  pointer-events: none;
}

.toast {
  background: var(--colour-grey-700);
  color: var(--white-100);
  padding: 1rem 1.5rem;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--scripts-border-color);
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
  text-align: center;
  max-width: 90vw;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.warning {
  border-left: 4px solid var(--warning);
}

/* ============================================
 * DYNAMIC ITEM INPUT STYLING
 * Ensures dark theme for dynamically added inputs
 * ============================================ */
.dynamic-item input,
.dynamic-item textarea,
.dynamic-item select,
.tab-panel input,
.tab-panel textarea,
.tab-panel select {
  background: var(--white-10, rgba(255, 255, 255, 0.1));
  color: var(--white-100, #fff);
  border: 1px solid var(--scripts-border-color, #40444b);
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.dynamic-item input:focus,
.dynamic-item textarea:focus,
.dynamic-item select:focus,
.tab-panel input:focus,
.tab-panel textarea:focus,
.tab-panel select:focus {
  border-color: #5865f2;
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
  outline: none;
}

.dynamic-item input::placeholder,
.dynamic-item textarea::placeholder {
  color: #72767d;
}

/* ============================================
 * MOBILE HAMBURGER MENU
 * ============================================ */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  background: var(--colour-grey-700);
  border: 1px solid var(--scripts-border-color);
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  color: var(--white-90);
  font-size: 1.5rem;
  line-height: 1;
  transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
  background: var(--colour-grey-600);
  color: var(--colour-pink-400);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.visible {
  opacity: 1;
}

/* ============================================
 * RESPONSIVE - Mobile Styles
 * ============================================ */
@media (max-width: 1024px) {
  .janitor-sidebar {
    width: 220px;
    min-width: 220px;
  }

  .janitor-main {
    max-width: calc(100vw - 220px);
    padding: 1.5rem 2rem;
  }
}

@media (max-width: 768px) {
  /* Mobile hamburger button visible */
  .mobile-menu-toggle {
    display: block;
  }

  /* Sidebar backdrop visible on mobile */
  .sidebar-backdrop {
    display: block;
    pointer-events: none;
  }

  .sidebar-backdrop.visible {
    pointer-events: auto;
  }

  .janitor-app {
    flex-direction: row;
  }

  /* Sidebar slides in from left */
  .janitor-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    min-width: 280px;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    border-right: 1px solid var(--scripts-border-color);
    border-bottom: none;
  }

  .janitor-sidebar.open {
    transform: translateX(0);
  }

  .janitor-sidebar-nav {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
    padding: 1rem 0;
    overflow-y: auto;
  }

  .janitor-nav-section {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .janitor-nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: var(--fontsize-body-ty);
  }

  .janitor-nav-item {
    padding: 0.75rem 1.5rem;
    font-size: var(--fontsize-body-sm);
    border-radius: 0;
    text-align: left;
  }

  .janitor-nav-item.active {
    border-left: 3px solid var(--colour-pink-500);
    border-bottom: none;
  }

  .janitor-main {
    width: 100%;
    max-width: 100%;
    padding: 1rem;
    padding-top: 4rem; /* Space for hamburger button */
  }

  .page-title {
    font-size: 1.5rem;
  }

  .page-subtitle {
    font-size: var(--fontsize-body-ty);
  }

  .tabs {
    flex-direction: column;
  }

  .tab-btn {
    width: 100%;
    text-align: left;
  }

  .onboarding-examples {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 1rem;
  }

  .dynamic-item {
    flex-direction: column;
    align-items: stretch;
  }

  .dynamic-item input,
  .dynamic-item textarea,
  .dynamic-item select {
    width: 100% !important;
    flex: none !important;
  }

  .dynamic-item button {
    width: 100%;
    padding: 0.75rem;
  }

  .btn {
    width: 100%;
    margin-right: 0;
    justify-content: center;
  }

  .order-item {
    cursor: default;
  }

  .drag-handle {
    display: none;
  }
}

@media (max-width: 768px) {
  /* Responsive switch sizes */
  .janitor-switch-label {
    font-size: 0.8rem;
  }

  .janitor-switch.sm {
    width: 2.25rem;
    height: 1.25rem;
  }

  .janitor-switch.md {
    width: 2.75rem;
    height: 1.5rem;
  }

  .janitor-switch.lg {
    width: 3.25rem;
    height: 1.875rem;
  }

  .janitor-switch.sm .janitor-switch-slider:before {
    height: 0.875rem;
    width: 0.875rem;
  }

  .janitor-switch.md .janitor-switch-slider:before {
    height: 1.125rem;
    width: 1.125rem;
  }

  .janitor-switch.lg .janitor-switch-slider:before {
    height: 1.375rem;
    width: 1.375rem;
  }

  .janitor-switch.sm .janitor-switch-input:checked + .janitor-switch-slider:before {
    transform: translate(0.9375rem, -50%);
  }

  .janitor-switch.md .janitor-switch-input:checked + .janitor-switch-slider:before {
    transform: translate(1.1875rem, -50%);
  }

  .janitor-switch.lg .janitor-switch-input:checked + .janitor-switch-slider:before {
    transform: translate(1.3125rem, -50%);
  }
}

@media (max-width: 480px) {
  .janitor-sidebar-header {
    padding: 1rem;
  }

  .janitor-sidebar-logo {
    max-width: 80px;
  }

  .card h3 {
    font-size: 1.125rem;
  }

  .output-box {
    font-size: 0.6875rem;
    padding: 0.75rem;
    max-height: 250px;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px;
  }

  .form-group textarea {
    min-height: 100px;
  }

  .janitor-switch-label {
    font-size: 0.75rem;
  }

  .janitor-switch-container {
    gap: 0.5rem;
  }

  .janitor-switch.sm {
    width: 2rem;
    height: 1.125rem;
  }

  .janitor-switch.md {
    width: 2.5rem;
    height: 1.375rem;
  }

  .janitor-switch.lg {
    width: 3rem;
    height: 1.75rem;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .janitor-switch-slider,
  .janitor-switch-slider:before {
    transition: none;
  }

  .janitor-modal-overlay,
  .janitor-modal-container {
    animation: none;
  }

  /* Disable smooth scrolling for reduced motion */
  html {
    scroll-behavior: auto;
  }
}

/* Shell wrapper for backwards compatibility */
.shell {
  max-width: 100%;
  margin: 0;
}

/* ============================================
 * JANITOR SMART CARD - Vertical Card Layout
 * ============================================ */
.janitor-card-entry {
  background: #2f3136;
  border: 1px solid var(--scripts-border-color);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.janitor-card-entry:last-child {
  margin-bottom: 0;
}

.card-header-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.card-header-grid .meta-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-header-grid .meta-field label {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  font-weight: var(--font-weight-semibold);
  color: var(--white-70);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-header-grid .janitor-input {
  width: 100%;
}

.btn-remove-icon {
  background: var(--danger);
  color: var(--white-100);
  border: none;
  border-radius: 6px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-remove-icon:hover {
  background: #dc2626;
  transform: scale(1.05);
}

.card-body {
  display: flex;
  flex-direction: column;
}

.card-body > label {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  font-weight: var(--font-weight-semibold);
  color: var(--white-70);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.field-subtext {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  color: var(--white-50);
  margin: 0 0 8px 0;
  font-style: italic;
}

.card-body .janitor-input.auto-expand {
  min-height: 150px;
  height: auto;
  resize: vertical;
}

/* Force larger starting size for card content textareas */
.janitor-card-entry .card-body textarea {
  min-height: 150px !important;
  max-height: 500px !important;  /* Stop growing at 500px */
  overflow-y: auto !important;   /* Show scrollbar when full */
  height: auto;
  resize: vertical;
}

.card-body > *:last-child {
  margin-bottom: 0;
}

/* Multi-field cards (e.g., Pacing with min/max inputs) */
.card-header-grid.multi-field {
  grid-template-columns: 1fr 1fr auto;
}

/* Keywords field for cards that need it */
.card-keywords {
  margin-bottom: 16px;
}

.card-keywords label {
  display: block;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  font-weight: var(--font-weight-semibold);
  color: var(--white-70);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

/* Responsive adjustments for Smart Cards */
@media (max-width: 768px) {
  .card-header-grid {
    grid-template-columns: 1fr auto !important;
    gap: 8px;
    align-items: flex-end !important;
  }

  .card-header-grid.multi-field {
    grid-template-columns: 1fr 1fr;
  }

  .btn-remove-icon {
    width: 36px !important;
    height: 36px !important;
  }
}

@media (max-width: 480px) {
  .janitor-card-entry {
    padding: 12px;
  }

  .card-header-grid.multi-field {
    grid-template-columns: 1fr;
  }
}

/* ============================================
 * VALIDATION ANIMATIONS
 * ============================================ */
@keyframes flash-green {
  0% { border-color: var(--success); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.4); }
  100% { border-color: var(--scripts-border-color); box-shadow: none; }
}

@keyframes flash-red {
  0% { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.4); }
  100% { border-color: var(--scripts-border-color); box-shadow: none; }
}

/* Apply to the whole card on success */
.janitor-card-entry.flash-green {
  animation: flash-green 0.6s ease-out;
}

/* Apply to specific inputs on error */
input.flash-red,
textarea.flash-red,
select.flash-red {
  animation: flash-red 0.6s ease-out;
}

/* ============================================
 * VISIBILITY UTILITY
 * ============================================ */
.hidden-module {
  display: none !important;
}

/* ============================================
 * SMART SIDEBAR STATES
 * ============================================ */
/* Base State (Disabled/Off) - Overwrites default if needed */
.janitor-nav-item {
  color: var(--white-40);
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
}

.janitor-nav-item:hover {
  color: var(--white-80);
  background: var(--white-opacity-5);
}

/* Enabled State (On but not currently viewing) */
.janitor-nav-item.module-enabled {
  color: var(--white-100);
  border-left-color: var(--white-40);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

/* Active State (Currently Viewing - overrides Enabled) */
.janitor-nav-item.active {
  color: var(--colour-pink-500) !important;
  border-left-color: var(--colour-pink-500) !important;
  background: linear-gradient(90deg, rgba(247, 134, 244, 0.15), transparent);
  text-shadow: none;
}

/* ============================================
 * HELP MODAL SYSTEM
 * ============================================ */
.janitor-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.janitor-modal-backdrop.open {
  display: flex;
  opacity: 1;
}

.janitor-modal-backdrop .janitor-modal-content {
  background: var(--colour-grey-800);
  border: 1px solid var(--colour-grey-600);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  margin: auto;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  position: relative;
}

.janitor-modal-backdrop .janitor-modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--colour-grey-600);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.janitor-modal-backdrop .janitor-modal-body {
  padding: 2rem;
  overflow-y: auto;
  font-family: 'Inter', var(--font-family-jura), sans-serif;
}

/* Guide Specific Typography inside Modal */
.janitor-modal-backdrop .janitor-modal-body h2 {
  font-family: var(--font-family-jura);
  font-size: 1.5rem;
  font-weight: var(--font-weight-semibold);
  color: var(--colour-pink-500);
  border-bottom: 1px solid var(--colour-grey-600);
  padding-bottom: 0.5rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.janitor-modal-backdrop .janitor-modal-body h2:first-child {
  margin-top: 0;
}

.janitor-modal-backdrop .janitor-modal-body h3 {
  font-family: var(--font-family-jura);
  font-size: 1.125rem;
  font-weight: var(--font-weight-semibold);
  color: var(--colour-purple-400);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.janitor-modal-backdrop .janitor-modal-body p {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  color: var(--white-80);
  line-height: 1.7;
  margin: 0.75rem 0;
}

.janitor-modal-backdrop .janitor-modal-body ul,
.janitor-modal-backdrop .janitor-modal-body ol {
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-sm);
  color: var(--white-80);
  line-height: 1.7;
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.janitor-modal-backdrop .janitor-modal-body li {
  margin: 0.5rem 0;
}

.janitor-modal-backdrop .janitor-modal-body li strong {
  color: var(--white-100);
}

.janitor-modal-backdrop .janitor-modal-body li em {
  color: var(--white-60);
  font-style: italic;
}

.janitor-modal-backdrop .janitor-modal-body code {
  background: var(--colour-grey-900);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--colour-pink-400);
  font-family: var(--font-family-jura), monospace;
  font-size: 0.9em;
}

/* Callout cards inside modal */
.janitor-modal-backdrop .guide-callout {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--colour-grey-700);
  border: 1px solid var(--scripts-border-color);
  border-radius: 8px;
  border-left: 3px solid var(--colour-purple-500);
}

.janitor-modal-backdrop .guide-callout strong {
  font-family: var(--font-family-jura);
  color: var(--colour-pink-400);
  display: block;
  margin-bottom: 0.5rem;
}

.janitor-modal-backdrop .guide-callout p {
  margin: 0;
  color: var(--white-70);
}

.janitor-modal-backdrop .guide-callout.warning {
  border-left-color: var(--colour-pink-500);
  background: linear-gradient(90deg, rgba(247, 134, 244, 0.08), var(--colour-grey-700));
}

/* Workflow list in modal */
.janitor-modal-backdrop .workflow-list {
  counter-reset: workflow;
  list-style: none;
  padding-left: 0;
}

.janitor-modal-backdrop .workflow-list li {
  counter-increment: workflow;
  position: relative;
  padding-left: 2.5rem;
  margin: 0.75rem 0;
}

.janitor-modal-backdrop .workflow-list li::before {
  content: counter(workflow);
  position: absolute;
  left: 0;
  width: 1.75rem;
  height: 1.75rem;
  background: linear-gradient(135deg, var(--colour-pink-600), var(--colour-purple-600));
  color: var(--white-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family-jura);
  font-size: var(--fontsize-body-ty);
  font-weight: var(--font-weight-bold);
  box-shadow: 0 0 8px rgba(247, 134, 244, 0.4);
}

/* --- High-Visibility Help Trigger --- */
.btn-help-trigger {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(247, 134, 244, 0.1); /* Subtle pink tint */
  border: 2px solid var(--colour-pink-500); /* Bright Pink Border */
  color: var(--colour-pink-500); /* Bright Pink Text */
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family-jura);
  box-shadow: 0 0 8px rgba(247, 134, 244, 0.3); /* Permanent Glow */
  z-index: 50;
}

.btn-help-trigger:hover {
  background: var(--colour-pink-500);
  color: var(--white-100);
  box-shadow: 0 0 15px rgba(247, 134, 244, 0.6);
  transform: scale(1.1);
}

/* Help button container in header */
.header-help-container {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

/* Modal close button */
.btn-modal-close {
  background: none;
  border: none;
  color: var(--white-60);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-modal-close:hover {
  background: var(--white-opacity-10);
  color: var(--white-100);
}

/* Print styles for Help Modal */
@media print {
  /* Hide the main app content when printing */
  .janitor-app {
    display: none !important;
  }

  /* Show only the modal content */
  .janitor-modal-backdrop {
    display: block !important;
    position: static !important;
    background: #fff !important;
    backdrop-filter: none !important;
    opacity: 1 !important;
  }

  .janitor-modal-backdrop .janitor-modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #fff !important;
    border-radius: 0 !important;
  }

  .janitor-modal-backdrop .janitor-modal-header {
    border-bottom: 2px solid #333 !important;
    background: #fff !important;
  }

  .janitor-modal-backdrop .janitor-modal-header h3 {
    color: #000 !important;
    font-size: 18pt;
  }

  .janitor-modal-backdrop .btn-modal-close {
    display: none !important;
  }

  .janitor-modal-backdrop .janitor-modal-body {
    background: #fff !important;
    padding: 1rem 0 !important;
  }

  .janitor-modal-backdrop .janitor-modal-body h2 {
    color: #000 !important;
    border-bottom-color: #333 !important;
    font-size: 16pt;
    page-break-after: avoid;
  }

  .janitor-modal-backdrop .janitor-modal-body h3 {
    color: #333 !important;
    font-size: 13pt;
    page-break-after: avoid;
  }

  .janitor-modal-backdrop .janitor-modal-body p,
  .janitor-modal-backdrop .janitor-modal-body li {
    color: #000 !important;
  }

  .janitor-modal-backdrop .janitor-modal-body li strong {
    color: #000 !important;
  }

  .janitor-modal-backdrop .janitor-modal-body li em {
    color: #555 !important;
  }

  .janitor-modal-backdrop .janitor-modal-body code {
    background: #f0f0f0 !important;
    color: #333 !important;
    border: 1px solid #ccc !important;
  }

  .janitor-modal-backdrop .guide-callout {
    background: #f9f9f9 !important;
    border: 1px solid #ccc !important;
    border-left: 3px solid #666 !important;
    page-break-inside: avoid;
  }

  .janitor-modal-backdrop .guide-callout strong {
    color: #000 !important;
  }

  .janitor-modal-backdrop .guide-callout p {
    color: #000 !important;
  }

  .janitor-modal-backdrop .workflow-list li::before {
    background: #333 !important;
    color: #fff !important;
    box-shadow: none !important;
  }
}

/* Mobile adjustments for help button */
@media (max-width: 768px) {
  .header-help-container {
    top: 1rem;
    right: 4rem; /* Move left to not interfere with hamburger */
  }

  .btn-help-trigger {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .janitor-modal-backdrop .janitor-modal-content {
    width: 95%;
    max-height: 85vh;
  }

  .janitor-modal-backdrop .janitor-modal-body {
    padding: 1.25rem;
  }
}
