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

:root {
  /* Typography */
  --font-sans: 'Outfit', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'Fira Code', monospace;

  /* Colors */
  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --popover: #ffffff;
  --popover-foreground: #09090b;
  --primary: #6e56cf;
  --primary-foreground: #ffffff;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --accent: #f4f4f5;
  --accent-foreground: #18181b;
  --destructive: #ef4444;
  --destructive-foreground: #fafafa;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --ring: #6e56cf;
  --radius: 0.5rem;
  --primary-color: #6e56cf;
  --secondary-color: #7c66ce;
  --accent-color: #a18fff;
  --dark-color: #09090b;
  --light-color: #fafafa;
  --gray-color: #71717a;
  --light-gray: #f4f4f5;
  --light-bg: #f5f7fb;
  --heading-color: #09090b;
  --text-color: #374151;
  --success-color: #10b981;
  --border-radius: 0.5rem;
  --box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 2px 8px rgba(0,0,0,0.06);
  --box-shadow-lg: 0 4px 16px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --transition: all 0.15s ease;
  --section-padding-top: 100px;

  /* Overlay Z-Index Hierarchy (higher = on top)
   * Must match OVERLAY_Z_INDEX constants in span-core.js */
  --z-overlay-admin-keyword: 100;
  --z-overlay-ai-keyword: 110;
  --z-overlay-user-span: 120;
  --z-overlay-controls: 200;
  --z-overlay-tooltip: 300;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

/* Shadcn-style button */
.shadcn-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  height: 2.5rem;
  padding-left: 1rem;
  padding-right: 1rem;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  border: none;
}

.shadcn-button-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border: 1px solid var(--primary);
}

.shadcn-button-primary:hover {
  background-color: var(--secondary-color);
  color: var(--primary-foreground);
}

.shadcn-button-outline {
  background-color: transparent;
  color: var(--primary);
  border: 1px solid var(--border);
}

.shadcn-button-outline:hover {
  background-color: var(--secondary);
  color: var(--primary);
}

.shadcn-button:active {
  transform: scale(0.97);
}

.shadcn-button:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Annotation status indicator (navbar badge) */
.annotation-status-indicator {
  display: flex;
  align-items: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-badge.labeled {
  background-color: rgba(16, 185, 129, 0.12);
  color: #065f46;
}

.status-badge.labeled::before {
  background-color: #10b981;
}

.status-badge.unlabeled {
  background-color: rgba(245, 158, 11, 0.12);
  color: #92400e;
}

.status-badge.unlabeled::before {
  background-color: #f59e0b;
}

/* Skip to unannotated button hover states */
#jump-unannotated-btn:hover,
#jump-unannotated-prev-btn:hover {
  background-color: rgba(255, 255, 255, 0.35) !important;
}

/* Notification animations */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Card styling */
.shadcn-card {
  min-height: 250px;
  max-height: calc(100vh - 140px);
  background-color: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--box-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Content-type-aware card sizing */
.shadcn-card.media-annotation {
  min-height: 400px;
  max-height: calc(100vh - 160px);
}

.shadcn-card.text-annotation {
  min-height: 200px;
  max-height: calc(100vh - 200px);
}

.shadcn-card-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.shadcn-card-content {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0; /* Needed for flex child to respect overflow */
}

/* Required field validation */
.required-fields-error {
  display: none;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.required-fields-error i {
  margin-right: 0.35rem;
}

.annotation-form.required-unfilled {
  border: 2px solid #f87171;
  border-radius: 0.5rem;
  padding: 0.25rem;
}

/* Annotation form styling */
.annotation-form {
  min-width: 0; /* Allow forms to shrink in grid layout */
}

.annotation-form fieldset {
  padding: 0.25rem;
  margin: 0;
}

.annotation-form legend {
  font-weight: 600;
  color: var(--heading-color);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ai help */
.ai-help {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background-color: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
  margin-left: auto;
  overflow: visible;
}

/* Separator between AI buttons */
.ai-help > span {
  color: var(--border);
}

.ai-help-word {
  font-size: 1rem;
  margin: 0;
}

.ai-assistant-containter:hover {
  color: var(--primary);
  cursor: pointer;
}

.tooltip {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: white;
  padding: 0;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: none;
  min-width: 300px;
  max-width: 400px;
  overflow-wrap: break-word;
  word-wrap: break-word;
  white-space: normal;
  margin-top: 0.5rem;
  border: 1px solid #e5e7eb;
}

.tooltip.active {
  display: block;
}

/* Close button for tooltip */
.tooltip .tooltip-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  border-radius: 0.25rem;
  transition: background-color 0.15s, color 0.15s;
}

.tooltip .tooltip-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
  color: #1f2937;
}

.tooltip .assistant-content {
  padding: 1rem;
  padding-right: 2.5rem; /* Space for close button */
}

.ai-assistant-containter {
  display: flex;
}

.ai-assistant-img {
  display: flex;
  justify-content: center;
  align-items: center;
}

.ai-assistant-img img {
  width: 1rem;
  height: 1rem;
}

.bold {
  font-weight: bold;
}

/* Fieldset content styling */
.annotation-form fieldset label {
  color: var(--text-color);
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: block;
}

.annotation-form fieldset p,
.annotation-form fieldset div {
  color: var(--text-color);
  margin-bottom: 0.75rem;
}

/* Text content within fieldsets */
.annotation-form fieldset .text-content {
  color: var(--text-color);
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* Instructions and descriptions */
.annotation-form fieldset .instructions,
.annotation-form fieldset .description {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background-color: var(--muted);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
}

.none {
  display: none;
}

/* Override any schema-specific title classes to ensure readability */
.annotation-form fieldset legend,
.annotation-form fieldset .shadcn-radio-title,
.annotation-form fieldset .shadcn-likert-title,
.annotation-form fieldset .shadcn-slider-title,
.annotation-form fieldset .shadcn-multiselect-title,
.annotation-form fieldset .shadcn-text-title,
.annotation-form fieldset .shadcn-span-title,
.annotation-form fieldset .shadcn-multirate-title,
.annotation-form fieldset .shadcn-select-title,
.annotation-form fieldset .shadcn-number-title {
  color: var(--heading-color) !important;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

/* Ensure all text within fieldsets is readable */
.annotation-form fieldset * {
  color: inherit;
}

.annotation-form fieldset span,
.annotation-form fieldset strong,
.annotation-form fieldset b,
.annotation-form fieldset em,
.annotation-form fieldset i {
  color: var(--text-color) !important;
}

/* Form elements */
input[type="text"],
input[type="number"],
textarea,
select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  background-color: var(--background);
  color: var(--foreground);
  transition: var(--transition);
  font-size: 0.875rem;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(110, 86, 207, 0.25);
}

/* Radio and checkbox styling */
input[type="radio"],
input[type="checkbox"] {
  margin-right: 0.5rem;
}

input[type="radio"] + label,
input[type="checkbox"] + label {
  color: var(--text-color);
  font-weight: 400;
  cursor: pointer;
  margin-bottom: 0.25rem;
}

/* Slider styling */
input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--light-gray);
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

/* Span annotation styling */
.span_container {
  position: relative;
  display: inline-block;
  border-radius: var(--radius);
}

.span-highlight {
  position: relative;
  display: inline-block;
  border-radius: var(--radius);
  padding: 1px 2px;
  margin: 0 1px;
}

.span_label {
  position: absolute;
  top: -18px;
  left: 0;
  font-size: 10px;
  border-radius: 3px;
  padding: 2px 4px;
  color: #6e56cf;
  background-color: white;
  border: 1px solid #e4e4e7;
  z-index: 10;
  white-space: nowrap;
  font-weight: 500;
}

.span_close {
  position: absolute;
  top: -18px;
  right: 0;
  font-size: 12px;
  border-radius: 3px;
  padding: 2px 4px;
  cursor: pointer;
  color: var(--destructive);
  background-color: white;
  border: 1px solid var(--destructive);
  z-index: 10;
  font-weight: bold;
  line-height: 1;
  min-width: 16px;
  text-align: center;
}

.span_close:hover {
  background-color: var(--destructive);
  color: white;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

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

/* Error states */
.error-message {
  color: var(--destructive);
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--destructive);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin: 1rem 0;
}

/* Success states */
.success-message {
  color: var(--success-color);
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--success-color);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin: 1rem 0;
}

/* ===== SCHEMA-SPECIFIC STYLES ===== */

/* Likert Scale Styles */
.shadcn-likert-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow);
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: fit-content;
  max-width: 100%;
  font-family: ui-sans-serif, system-ui, sans-serif;
  position: relative;
}

.shadcn-likert-title {
  font-size: 1rem;
  font-weight: 500;
  color: black;
  text-align: left;
  width: 100%;
  margin-bottom: 0.25rem;
}

.shadcn-likert-scale {
  display: flex;
  align-items: flex-start;  /* Align to top so endpoints match track position */
  justify-content: space-between;
  width: 100%;
}

.shadcn-likert-endpoint {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  font-size: 0.875rem;
  line-height: 1.25rem;  /* Match button height for vertical alignment */
  color: var(--muted-foreground);
  padding: 0 0.5rem;
  max-width: 30%;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.shadcn-likert-options {
  display: flex;
  flex: 1;
  justify-content: space-between;
  align-items: flex-start;  /* Align options to top so track math works correctly */
  position: relative;
  padding: 0 0.5rem;
  gap: 0.5rem;
}

.shadcn-likert-track {
  position: absolute;
  height: 2px;
  background-color: var(--border);
  left: 0.5rem;
  right: 0.5rem;
  top: 0.625rem;  /* Half of button height (1.25rem / 2) - positions track at button center */
  transform: translateY(-50%);
  z-index: 0;
}

.shadcn-likert-option {
  display: flex;
  flex-direction: column;  /* Stack button and label vertically */
  align-items: center;
  justify-content: flex-start;  /* Align to top */
  position: relative;
  z-index: 1;
}

.shadcn-likert-input {
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
}

.shadcn-likert-button {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background-color: var(--secondary);
  border: 2px solid var(--border);
  margin-bottom: 0;
  cursor: pointer;
  transition: var(--transition);
}

.shadcn-likert-input:checked + .shadcn-likert-button {
  background-color: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 0 0 3px rgba(110, 86, 207, 0.2);
}

.shadcn-likert-input:focus + .shadcn-likert-button {
  box-shadow: 0 0 0 3px rgba(110, 86, 207, 0.2);
}

.shadcn-likert-input:hover + .shadcn-likert-button {
  border-color: var(--primary);
}

.shadcn-likert-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
  text-align: center;
}

.shadcn-likert-input:checked ~ .shadcn-likert-label {
  color: var(--primary);
  font-weight: 500;
}

.shadcn-likert-bad-text {
  display: flex;
  align-items: center;
  margin-top: 0.75rem;
  padding: 0.5rem 0;
}

.shadcn-likert-bad-text-label {
  margin-left: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-color);
  word-wrap: break-word;
  overflow-wrap: break-word;
  flex: 1;
}

/* Multiselect Styles */
.shadcn-multiselect-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow);
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: fit-content;
  max-width: 100%;
  font-family: ui-sans-serif, system-ui, sans-serif;
  position: relative;
}

.shadcn-multiselect-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--heading-color);
  margin-bottom: 0.5rem;
  text-align: left;
  width: 100%;
}

.shadcn-multiselect-grid {
  display: grid;
  gap: 0.25rem;
}

.shadcn-multiselect-item {
  display: flex;
  align-items: center;
}

.shadcn-multiselect-checkbox {
  appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
  background-color: var(--background);
  cursor: pointer;
  margin-right: 0.75rem;
  transition: var(--transition);
  position: relative;
}

.shadcn-multiselect-checkbox:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.shadcn-multiselect-checkbox:checked::after {
  content: "";
  position: absolute;
  width: 0.3rem;
  height: 0.5rem;
  border: solid white;
  border-width: 0 2px 2px 0;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
}

.shadcn-multiselect-checkbox:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.shadcn-multiselect-checkbox:hover:not(:checked) {
  border-color: var(--primary);
}

.shadcn-multiselect-label {
  font-size: 0.875rem;
  color: var(--foreground);
}

/* Unified keybinding badge used by all schema types */
.keybinding-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.25rem;
  padding: 0.1rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 500;
  font-family: var(--font-mono);
  background-color: var(--muted);
  border-radius: 0.25rem;
  color: var(--muted-foreground);
  min-width: 1.2em;
  text-align: center;
  text-transform: uppercase;
}

/* Backward-compat alias */
.shadcn-multiselect-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.25rem;
  padding: 0.1rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 500;
  font-family: var(--font-mono);
  background-color: var(--muted);
  border-radius: 0.25rem;
  color: var(--muted-foreground);
  min-width: 1.2em;
  text-align: center;
  text-transform: uppercase;
}

.shadcn-multiselect-free-response {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.shadcn-multiselect-free-input {
  flex: 1;
  height: 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  padding: 0 0.75rem;
  font-size: 0.875rem;
  margin-left: 0.5rem;
  transition: var(--transition);
}

.shadcn-multiselect-free-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

/* Radio Styles */
.shadcn-radio-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow);
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: fit-content;
  max-width: 100%;
  font-family: ui-sans-serif, system-ui, sans-serif;
  position: relative;
}

.shadcn-radio-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--heading-color);
  margin-bottom: 0.5rem;
  text-align: left;
  width: 100%;
}

.shadcn-radio-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem;
  width: 100%;
}

.shadcn-radio-options.horizontal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.shadcn-radio-option {
  display: flex;
  align-items: center;
}

.shadcn-radio-option.horizontal {
  margin-right: 1.5rem;
}

.shadcn-radio-input {
  appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background-color: var(--background);
  cursor: pointer;
  margin-right: 0.5rem;
  transition: var(--transition);
  position: relative;
}

.shadcn-radio-input:checked {
  border-color: var(--primary);
}

.shadcn-radio-input:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: var(--primary);
}

.shadcn-radio-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

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

.shadcn-radio-label {
  font-size: 0.875rem;
  color: var(--foreground);
  cursor: pointer;
}

.shadcn-radio-free-response {
  display: flex;
  align-items: center;
  margin-top: 1rem;
  width: 100%;
}

.shadcn-radio-free-input {
  width: 100%;
  max-width: 300px;
  margin-left: 0.5rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background-color: var(--background);
  font-size: 0.875rem;
  color: var(--foreground);
  transition: var(--transition);
}

.shadcn-radio-free-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.shadcn-radio-free-input:hover {
  border-color: var(--primary);
}

/* Slider Styles */
.shadcn-slider-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.shadcn-slider-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--heading-color);
  margin-bottom: 0.5rem;
  text-align: left;
  width: 100%;
}

.shadcn-slider-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 1rem;
  padding: 0.5rem 0;
}

.shadcn-slider-label {
  flex: 0 0 auto;
  width: 2.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.shadcn-slider-track {
  flex: 1;
  position: relative;
  height: 1.5rem;
}

.shadcn-slider-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 0.25rem;
  background: var(--border);
  border-radius: 1rem;
  outline: none;
  cursor: pointer;
}

.shadcn-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  background-color: var(--primary);
  border-radius: 50%;
  border: 2px solid var(--background);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: var(--transition);
}

.shadcn-slider-input::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  background-color: var(--primary);
  border-radius: 50%;
  border: 2px solid var(--background);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: var(--transition);
}

.shadcn-slider-input:focus {
  outline: none;
}

.shadcn-slider-input:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(110, 86, 207, 0.25);
}

.shadcn-slider-input:focus::-moz-range-thumb {
  box-shadow: 0 0 0 4px rgba(110, 86, 207, 0.25);
}

/* Span Styles */
.shadcn-span-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  font-family: ui-sans-serif, system-ui, sans-serif;
  position: relative;
}

.shadcn-span-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--heading-color);
  margin-bottom: 0.5rem;
  text-align: left;
  width: 100%;
}

.shadcn-span-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  width: 100%;
}

.shadcn-span-option {
  display: flex;
  align-items: center;
}

.shadcn-span-checkbox {
  appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border);
  background-color: var(--background);
  cursor: pointer;
  margin-right: 0.5rem;
  transition: var(--transition);
  position: relative;
}

.shadcn-span-checkbox:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.shadcn-span-checkbox:checked::after {
  content: "";
  position: absolute;
  width: 0.3rem;
  height: 0.5rem;
  border: solid white;
  border-width: 0 2px 2px 0;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
}

.shadcn-span-checkbox:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.shadcn-span-checkbox:hover {
  border-color: var(--primary);
}

.shadcn-span-label {
  font-size: 0.875rem;
  color: var(--foreground);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.shadcn-span-label span {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  display: inline-block;
}

.shadcn-span-bad-text {
  margin-top: 1rem;
}

/* Text Styles */
.shadcn-text-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  font-family: ui-sans-serif, system-ui, sans-serif;
  position: relative;
}

.shadcn-text-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--heading-color);
  margin-bottom: 1rem;
  text-align: left;
  width: 100%;
}

.shadcn-text-input {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background-color: var(--background);
  padding: 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  transition: var(--transition);
}

.shadcn-text-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

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

.shadcn-text-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Textbox Styles */
.shadcn-textbox-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow);
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;  /* Stretch children to fill width */
  width: 100%;  /* Fill container width by default */
  box-sizing: border-box;
  font-family: ui-sans-serif, system-ui, sans-serif;
  position: relative;
}

/* Ensure fieldset inside textbox fills width (override browser default min-width: min-content) */
.shadcn-textbox-container fieldset {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.shadcn-textbox-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--heading-color);
  margin-bottom: 0.5rem;
  text-align: left;
  width: 100%;
}

.shadcn-textbox-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
  width: 100%;
}

.shadcn-textbox-label {
  font-size: 0.875rem;
  color: var(--foreground);
  margin-bottom: 0.5rem;
  display: inline-block;
}

.shadcn-textbox-input {
  width: 100%;
  box-sizing: border-box;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background-color: var(--background);
  padding: 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  transition: var(--transition);
  height: 2.5rem;
}

.shadcn-textbox-textarea {
  min-height: 6rem;
  resize: vertical;
  height: auto;  /* Override fixed height from .shadcn-textbox-input */
}

.shadcn-textbox-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

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

/* Remove bottom margin from last items in schema containers to fix excessive whitespace */
.shadcn-radio-options > .shadcn-radio-option:last-child,
.shadcn-multiselect-grid > .shadcn-multiselect-item:last-child,
.shadcn-likert-options > .shadcn-likert-option:last-child,
.shadcn-textbox-item:last-child {
  margin-bottom: 0;
}

/* Remove bottom margin from container elements themselves */
.shadcn-radio-options,
.shadcn-multiselect-grid,
.shadcn-likert-scale,
.shadcn-textbox-items {
  margin-bottom: 0;
}

/* Number Styles */
.shadcn-number-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  font-family: ui-sans-serif, system-ui, sans-serif;
  position: relative;
}

.shadcn-number-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--heading-color);
  margin-bottom: 1rem;
  text-align: left;
  width: 100%;
}

.shadcn-number-input {
  display: flex;
  align-items: center;
  width: 100%;
}

.shadcn-number-field {
  height: 2.5rem;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--input);
  background-color: var(--background);
  padding: 0 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  transition: var(--transition);
}

.shadcn-number-field:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.shadcn-number-field:hover {
  border-color: var(--primary);
}

/* Multirate Styles */
.shadcn-multirate-container {
  font-family: ui-sans-serif, system-ui, sans-serif;
  margin: 1rem auto;
  max-width: 100%;
  overflow-x: auto;
  color: #374151;
}

.shadcn-multirate-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #f3f4f6;
}

.shadcn-multirate-table {
  border-collapse: collapse;
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.shadcn-multirate-table th,
.shadcn-multirate-table td {
  padding: 0.75rem 1rem;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.875rem;
}

.shadcn-multirate-table th {
  background-color: #f9fafb;
  font-weight: 500;
  color: #6b7280;
}

.shadcn-multirate-table thead th:first-child,
.shadcn-multirate-table tbody td:first-child {
  text-align: left;
  font-weight: 500;
  min-width: 180px;
  max-width: 300px;
}

.shadcn-multirate-table tbody tr:hover {
  background-color: #f9fafb;
}

.shadcn-multirate-radio {
  appearance: none;
  -webkit-appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background-color: #fff;
  cursor: pointer;
  margin: 0 auto;
  vertical-align: middle;
  position: relative;
  transition: all 0.2s ease;
}

.shadcn-multirate-radio:checked {
  border-color: #3b82f6;
  background-color: #3b82f6;
}

.shadcn-multirate-radio:checked::after {
  content: "";
  position: absolute;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: white;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.shadcn-multirate-radio:hover:not(:checked) {
  border-color: #3b82f6;
}

.shadcn-multirate-radio:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.shadcn-radio-cell {
  text-align: center;
}

/* Common Tooltip Styles */
[data-toggle="tooltip"] {
  position: relative;
  cursor: help;
}

/* Fieldset schema width override */
fieldset[schema] {
  width: fit-content;
  max-width: 100%;
  overflow: visible;
}

/* Responsive design */
@media (max-width: 768px) {
  .shadcn-card {
    min-height: 200px;
    max-height: calc(100vh - 160px);
  }

  .shadcn-card.media-annotation {
    min-height: 300px;
    max-height: calc(100vh - 140px);
  }

  .navbar-brand {
    font-size: 1rem !important;
  }

  .shadcn-multirate-table th,
  .shadcn-multirate-table td {
    padding: 0.5rem;
    font-size: 0.75rem;
  }

  .shadcn-multirate-table thead th:first-child,
  .shadcn-multirate-table tbody td:first-child {
    min-width: 120px;
  }
}

/* Print styling */
@media print {
  .shadcn-multirate-container {
    margin: 0;
    width: 100%;
  }

  .shadcn-multirate-table {
    border: 1px solid #000;
  }

  .shadcn-multirate-table th,
  .shadcn-multirate-table td {
    border-bottom: 1px solid #000;
  }

  .shadcn-multirate-radio {
    border: 2px solid #000;
  }

  .shadcn-multirate-radio:checked {
    background-color: #000;
  }
}

.annotation-span {
  position: relative;
  display: inline;
  border-radius: 4px;
  padding: 2px 4px;
  margin: 0 1px;
  cursor: pointer;
  transition: all 0.2s;
  background-color: #ffeaa7;
  line-height: 1.2em;
  vertical-align: baseline;
}

/* Overlap styling for spans that overlap with others */
.annotation-span.span-overlap {
  position: relative;
  display: inline-block;
  line-height: var(--overlap-height, 1.2em);
  /* Use padding instead of margin to maintain text baseline */
  padding-top: calc(var(--overlap-offset, 0em) * 0.5);
  padding-bottom: calc(var(--overlap-offset, 0em) * 0.5);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  /* Ensure text stays at baseline */
  vertical-align: baseline;
}

/* Specific depth-based styling */
.annotation-span.overlap-depth-1 {
  background-color: rgba(255, 234, 167, 0.8);
  border-color: rgba(255, 193, 7, 0.3);
}

.annotation-span.overlap-depth-2 {
  background-color: rgba(255, 234, 167, 0.9);
  border-color: rgba(255, 193, 7, 0.5);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.annotation-span.overlap-depth-3 {
  background-color: rgba(255, 234, 167, 1);
  border-color: rgba(255, 193, 7, 0.7);
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.2);
}

.annotation-span.overlap-depth-4 {
  background-color: rgba(255, 234, 167, 1);
  border-color: rgba(255, 193, 7, 0.9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Ensure text container can handle overlapping elements */
#instance-text {
  position: relative;
  line-height: 1.4em;
  min-height: 2em;
  overflow: visible;
  padding-top: 28px; /* Space for span controls above first line */
}

/* Span overlays container must allow controls to render above */
#span-overlays {
  overflow: visible !important;
}

/* Adjust label positioning for overlapping spans - use absolute positioning */
.annotation-span.span-overlap .span-label {
  position: absolute;
  top: -25px;
  left: 0;
  z-index: calc(10 + var(--overlap-depth, 0));
}

/* Adjust delete button positioning for overlapping spans - use absolute positioning */
.annotation-span.span-overlap .span-delete-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: calc(15 + var(--overlap-depth, 0));
}
.span-delete-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  z-index: 15;
  transition: all 0.2s;
}
.span-delete-btn:hover {
  background: #c82333;
  transform: scale(1.1);
}
.annotation-span:hover .span-delete-btn {
  display: flex;
}
.span-label {
  position: absolute;
  top: -25px;
  left: 0;
  background: #333;
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  white-space: nowrap;
  display: none;
  z-index: 10;
  pointer-events: none;
}
.annotation-span:hover .span-label {
  display: block;
}

/* Overlay spans should allow text selection to pass through */
.annotation-span.overlay-span {
  pointer-events: none;
}

/* But allow pointer events on the span itself for hovering */
.annotation-span.overlay-span:hover {
  pointer-events: auto;
}

/* Overlay span labels should always be visible */
.annotation-span.overlay-span .span-label {
  display: block !important;
  pointer-events: auto;
}

/* Overlay span delete buttons should always be clickable */
.annotation-span.overlay-span .span-delete-btn {
  pointer-events: auto;
}

fieldset[schema] {
  width: fit-content;
  max-width: 100%;
  overflow: visible;
}

.slider {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  font-family: ui-sans-serif, system-ui, sans-serif;
  position: relative;
}

/* Container styles */
.custom-slider-container {
  position: relative;
  width: 100%;
  padding: 20px 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin-top: 3.5rem;
}

/* Hide the actual input but keep it in the DOM for form submission */
.custom-slider-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  margin: 0;
  cursor: pointer;
  z-index: 3; /* Keep above other elements for interaction */
}

/* Custom track */
.custom-slider-track {
  position: relative;
  width: 100%;
  height: 4px;
  background-color: #e5e7eb;
  border-radius: 2px;
}

/* Active portion of track */
.custom-slider-track-active {
  position: absolute;
  height: 100%;
  background-color: var(--primary);
  border-radius: 2px;
  left: 0;
}

/* Custom thumb */
.custom-slider-thumb {
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: var(--primary);
  border-radius: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 2;
  cursor: grab;
  transition: transform 0.1s, box-shadow 0.1s;
  color: white;
}

.custom-slider-thumb.dragging {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  cursor: grabbing;
}

/* Tick container */
.custom-slider-ticks {
  position: relative;
  width: 100%;
  height: 30px;
  margin-top: 12px;
}

/* Tick mark styles */
.custom-slider-tick {
  position: absolute;
  transform: translateX(-50%);
}

.custom-slider-tick-mark {
  width: 1px;
  height: 8px;
  background-color: #ccc;
}

.custom-slider-tick-mark.major {
  height: 12px;
  background-color: #999;
  width: 2px;
}

.custom-slider-tick-label {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}

/* Slider title/legend */
.custom-slider-title {
  margin-bottom: 12px;
  font-weight: 500;
}

.custom-slider-container.focus {
  outline: 2px solid #7c3aed;
  border-radius: 4px;
}

.custom-slider-thumb {
  position: relative;
}

.annotation-form fieldset .slider-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.2s ease;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
}

.slider-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -4px;
  border: 4px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.8);
}

.custom-slider-thumb.dragging .slider-tooltip {
  opacity: 1;
}

.select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  font-family: ui-sans-serif, system-ui, sans-serif;
  position: relative;
}


/* ==================== AI SUGGESTION STYLES ==================== */

/* AI suggested label highlighting */
.ai-suggested-option {
  position: relative;
  border: 2px solid #f59e0b !important;
  background-color: rgba(245, 158, 11, 0.1) !important;
  border-radius: var(--radius);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
  animation: ai-pulse 2s ease-in-out infinite;
}

.ai-suggested-label {
  position: relative;
  font-weight: 600 !important;
  color: #92400e !important;
}

.ai-suggested {
  outline: 2px solid #f59e0b !important;
  outline-offset: 2px;
}

/* AI suggestion indicator (sparkle emoji) */
.ai-suggestion-indicator {
  font-size: 0.9em;
  vertical-align: middle;
  animation: ai-sparkle 1.5s ease-in-out infinite;
}

/* Pulse animation for highlighted options */
@keyframes ai-pulse {
  0%, 100% {
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
  }
  50% {
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.5);
  }
}

/* Sparkle animation for the indicator */
@keyframes ai-sparkle {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.2);
  }
}


/* ==================== OPTION HIGHLIGHTING STYLES ==================== */
/* LLM-based option highlighting: dims less-likely options */

/* Container indicator when AI highlighting is active (visual indicator removed) */
.ai-highlighting-active {
  /* Class kept for JavaScript state tracking but no visual styling */
}

/* Dimmed non-highlighted options */
.option-dimmed {
  opacity: var(--dim-opacity, 0.4);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Brighten on hover to allow selection */
.option-dimmed:hover {
  opacity: 0.7;
  transform: scale(1.01);
}

/* Highlighted options remain fully visible */
.option-highlighted {
  opacity: 1;
  position: relative;
  transition: opacity 0.2s ease;
}

/* Optional: subtle background highlight for highlighted options */
.option-highlighted.shadcn-radio-option,
.option-highlighted.shadcn-checkbox-option,
.option-highlighted.option-item {
  background-color: rgba(245, 158, 11, 0.05);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Ensure dimmed options are still clickable */
.option-dimmed input,
.option-dimmed label {
  cursor: pointer;
}


/* AI span overlay styles (for keyword highlighting) */
/* AI keyword overlay styles (AI-suggested highlights) */
.span-overlay-ai {
  pointer-events: none;
  z-index: var(--z-overlay-ai-keyword);
}

.span-overlay-ai .span-highlight-segment {
  pointer-events: auto;
  cursor: help;
}

/* Admin keyword highlight overlay styles */
.keyword-highlight-overlay {
  pointer-events: none;
  z-index: var(--z-overlay-admin-keyword);
}

.keyword-highlight-overlay .span-highlight-segment {
  pointer-events: auto;
  cursor: help;
  /* Keyword highlights use dashed border to distinguish from AI suggestions */
  border-style: dashed !important;
}

/* User-created span overlay styles */
.span-overlay-pure {
  z-index: var(--z-overlay-user-span);
}

/* Span controls (label + delete button) */
.span-controls {
  z-index: var(--z-overlay-controls);
}

/* Overlay tooltip */
.overlay-tooltip {
  z-index: var(--z-overlay-tooltip);
}

/* Tooltip styling for AI suggestions */
.tooltip.hint-tooltip {
  background-color: #fef3c7;
  color: #1f2937;
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  padding: 0;
  max-width: 100%;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tooltip.hint-tooltip .tooltip-close {
  color: #92400e;
}

.tooltip.hint-tooltip .tooltip-close:hover {
  background-color: rgba(245, 158, 11, 0.2);
}

.tooltip.hint-tooltip .hint-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tooltip.hint-tooltip .content-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tooltip.hint-tooltip .content-item .label {
  font-weight: 600;
  color: #92400e;
  font-size: 11px;
  text-transform: uppercase;
}

.tooltip.hint-tooltip .content-item .value {
  color: #1f2937;
}

.tooltip.hint-tooltip .content-item .value.suggestion {
  font-weight: 600;
  color: #78350f;
  background-color: rgba(254, 243, 199, 0.8);
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
}

/* Keyword tooltip styling */
.tooltip.keyword-tooltip {
  background-color: rgba(59, 130, 246, 0.95);
  color: white;
  border: 1px solid #3b82f6;
}

/* Rationale tooltip styling */
.tooltip.rationale-tooltip {
  background-color: #faf5ff;
  color: #1f2937;
  border: 1px solid #8b5cf6;
  padding: 0;
  max-width: 100%;
}

.tooltip.rationale-tooltip .tooltip-close {
  color: #5b21b6;
}

.tooltip.rationale-tooltip .tooltip-close:hover {
  background-color: rgba(139, 92, 246, 0.2);
}

.tooltip.rationale-tooltip .rationale-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tooltip.rationale-tooltip .rationale-header {
  font-weight: 600;
  color: #5b21b6;
  font-size: 12px;
  text-transform: uppercase;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 8px;
}

.tooltip.rationale-tooltip .rationale-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background-color: #f9fafb;
  border-radius: 6px;
  border-left: 3px solid #8b5cf6;
}

.tooltip.rationale-tooltip .rationale-label {
  font-weight: 600;
  color: #5b21b6;
  font-size: 13px;
}

.tooltip.rationale-tooltip .rationale-reasoning {
  color: #374151;
  font-size: 13px;
  line-height: 1.5;
}

/* =====================================================
   Dialogue / Multi-turn Annotation Styles
   ===================================================== */

/* =====================================================
   DIALOGUE/CONVERSATION ANNOTATION STYLES
   ===================================================== */

/* Base dialogue turn styling */
.dialogue-turn {
  padding: 12px 16px;
  margin: 6px 0;
  border-radius: 8px;
  line-height: 1.6;
  transition: background-color 0.2s ease;
}

/* Speaker name styling */
.dialogue-speaker {
  font-weight: 600;
  margin-right: 4px;
}

/* Alternating turn shading for readability */
.dialogue-turn-even {
  background-color: #f8fafc;
  border-left: 4px solid var(--primary, #6366f1);
}

.dialogue-turn-odd {
  background-color: #ffffff;
  border-left: 4px solid #e2e8f0;
}

/* Hover effect on dialogue turns */
.dialogue-turn:hover {
  background-color: #f1f5f9;
}

/* Speaker color palette - 6 distinct colors for speaker names */
.dialogue-speaker.speaker-color-0 { color: #4f46e5; } /* Indigo */
.dialogue-speaker.speaker-color-1 { color: #db2777; } /* Pink */
.dialogue-speaker.speaker-color-2 { color: #0d9488; } /* Teal */
.dialogue-speaker.speaker-color-3 { color: #d97706; } /* Amber */
.dialogue-speaker.speaker-color-4 { color: #7c3aed; } /* Violet */
.dialogue-speaker.speaker-color-5 { color: #0891b2; } /* Cyan */

/* Match left border color to speaker */
.dialogue-turn[data-speaker-index="0"] { border-left-color: #6366f1; }
.dialogue-turn[data-speaker-index="1"] { border-left-color: #ec4899; }
.dialogue-turn[data-speaker-index="2"] { border-left-color: #14b8a6; }
.dialogue-turn[data-speaker-index="3"] { border-left-color: #f59e0b; }
.dialogue-turn[data-speaker-index="4"] { border-left-color: #8b5cf6; }
.dialogue-turn[data-speaker-index="5"] { border-left-color: #06b6d4; }

/* Dark mode support for dialogue */
@media (prefers-color-scheme: dark) {
  .dialogue-turn.turn-even,
  .dialogue-turn-even {
    background-color: rgba(255, 255, 255, 0.05);
  }

  .dialogue-turn.turn-odd,
  .dialogue-turn-odd {
    background-color: transparent;
    border-left-color: #334155;
  }

  .dialogue-turn:hover {
    background-color: rgba(255, 255, 255, 0.08);
  }

  /* Lighter speaker colors for dark mode */
  .dialogue-speaker.speaker-color-0 { color: #818cf8; }
  .dialogue-speaker.speaker-color-1 { color: #f472b6; }
  .dialogue-speaker.speaker-color-2 { color: #2dd4bf; }
  .dialogue-speaker.speaker-color-3 { color: #fbbf24; }
  .dialogue-speaker.speaker-color-4 { color: #a78bfa; }
  .dialogue-speaker.speaker-color-5 { color: #22d3ee; }
}

/* Pairwise comparison layout */
.pairwise-container {
  display: flex;
  gap: 20px;
  width: 100%;
}

.pairwise-cell {
  flex: 1;
  padding: 16px;
  background-color: var(--card, #ffffff);
  border: 1px solid var(--border, #e4e4e7);
  border-radius: 8px;
  box-shadow: var(--box-shadow, 0 1px 3px 0 rgb(0 0 0 / 0.1));
}

.pairwise-cell:first-child {
  border-left: 3px solid #3b82f6;
}

.pairwise-cell:last-child {
  border-left: 3px solid #10b981;
}

/* For more than 2 items in comparison */
.pairwise-cell:nth-child(3) {
  border-left: 3px solid #f59e0b;
}

.pairwise-cell:nth-child(4) {
  border-left: 3px solid #ef4444;
}

/* =========================================
   Instance Display Styles
   ========================================= */

/* Main container for instance display */
.instance-display-container {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.instance-display-container.layout-horizontal {
  flex-direction: row;
  flex-wrap: wrap;
}

.instance-display-container.layout-vertical {
  flex-direction: column;
}

/* Individual display field container */
.display-field {
  margin-bottom: 16px;
  padding: 16px;
  background-color: var(--card, #ffffff);
  border: 1px solid var(--border, #e4e4e7);
  border-radius: 8px;
}

.layout-horizontal .display-field {
  flex: 1;
  min-width: 200px;
}

/* Display field label */
.display-field-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--muted-foreground, #71717a);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Display field content */
.display-field-content {
  line-height: 1.6;
}

/* Text display styles */
.display-type-text .text-display-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.display-type-text .text-display-content.preserve-whitespace {
  white-space: pre-wrap;
}

.display-type-text .text-placeholder {
  color: var(--muted-foreground, #71717a);
  font-style: italic;
}

/* Span target text styling */
.span-target-field {
  position: relative;
}

/* Visual indicator for span-target fields */
.display-field[data-span-target="true"] {
  border-left: 3px solid var(--primary, #6e56cf);
  padding-left: 12px;
}

.display-field[data-span-target="true"] .display-field-label::after {
  content: " (click label, then highlight text)";
  font-size: 0.75rem;
  font-weight: normal;
  color: var(--muted-foreground, #71717a);
  font-style: italic;
}

.span-target-field .text-display-content.span-target-text {
  /* Padding-top provides room for span labels that appear above highlighted text */
  padding-top: 24px;
  position: relative;
}

.span-target-field .text-content {
  position: relative;
  z-index: 1;
}

.span-target-field .span-overlays {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 2;
}

/* Resizable display field container */
.display-field-resizable {
  resize: vertical;
  overflow: auto;
  min-height: 100px;
  max-height: 80vh;
}

.display-field-resizable .display-field-content {
  height: 100%;
  overflow: auto;
}

/* Resize handle indicator */
.display-field-resizable::after {
  content: "";
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, transparent 50%, var(--border, #e4e4e7) 50%);
  pointer-events: none;
  opacity: 0.7;
  border-radius: 0 0 4px 0;
}

/* Resizable PDF and document displays */
.display-field-resizable .pdf-display,
.display-field-resizable .document-display {
  height: 100%;
  max-height: none;
  overflow: auto;
}

/* Ensure canvas containers adapt to resize */
.display-field-resizable .pdf-canvas-container,
.display-field-resizable .pdf-pages-container {
  height: calc(100% - 80px); /* Account for controls */
  overflow: auto;
}

/* Collapsible text container */
.collapsible-text-container {
  position: relative;
}

.collapsible-text-container .collapsible-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.collapsible-text-container .collapsible-label {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}

.collapsible-text-container .collapsible-toggle {
  font-size: 0.75rem;
  padding: 2px 8px;
}

.collapsible-text-container .collapse-text-show,
.collapsible-text-container .collapse-text-hide {
  display: none;
}

.collapsible-text-container .collapsible-toggle[aria-expanded="true"] .collapse-text-hide {
  display: inline;
}

.collapsible-text-container .collapsible-toggle[aria-expanded="false"] .collapse-text-show {
  display: inline;
}

/* Image display styles */
.display-type-image {
  text-align: center;
}

.display-type-image .image-container,
.display-type-image .image-zoom-container {
  display: inline-block;
  position: relative;
  max-width: 100%;
}

.display-type-image .display-image {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  transition: transform 0.2s ease;
}

.display-type-image .display-image.zoomable-image {
  cursor: zoom-in;
}

/* Image zoom controls */
.image-zoom-controls {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.image-zoom-container:hover .image-zoom-controls {
  opacity: 1;
}

.image-zoom-controls button {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

/* Image placeholder and error */
.display-type-image .image-placeholder,
.display-type-image .image-error {
  padding: 32px;
  text-align: center;
  color: var(--muted-foreground, #71717a);
  background: var(--muted, #f4f4f5);
  border-radius: 4px;
}

.display-type-image .image-error {
  color: var(--destructive, #ef4444);
  background: #fef2f2;
}

/* Display error message */
.display-error {
  padding: 16px;
  color: var(--destructive, #ef4444);
  background: #fef2f2;
  border: 1px solid var(--destructive, #ef4444);
  border-radius: 4px;
}

/* Video display styles */
.display-type-video {
  text-align: center;
}

.display-type-video .video-container {
  display: inline-block;
  max-width: 100%;
}

.display-type-video .display-video {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.display-type-video .video-placeholder,
.display-type-video .video-error {
  padding: 32px;
  text-align: center;
  color: var(--muted-foreground, #71717a);
  background: var(--muted, #f4f4f5);
  border-radius: 4px;
}

.display-type-video .video-error {
  color: var(--destructive, #ef4444);
  background: #fef2f2;
}

/* Audio display styles */
.display-type-audio .audio-container {
  width: 100%;
}

.display-type-audio .display-audio {
  width: 100%;
}

.display-type-audio .audio-waveform {
  margin-bottom: 8px;
  background: var(--muted, #f4f4f5);
  border-radius: 4px;
  padding: 8px;
}

.display-type-audio .waveform-canvas {
  width: 100%;
  height: 80px;
}

.display-type-audio .audio-placeholder,
.display-type-audio .audio-error {
  padding: 16px;
  text-align: center;
  color: var(--muted-foreground, #71717a);
  background: var(--muted, #f4f4f5);
  border-radius: 4px;
}

.display-type-audio .audio-error {
  color: var(--destructive, #ef4444);
  background: #fef2f2;
}

/* Dialogue display styles */
.display-type-dialogue .dialogue-display-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.display-type-dialogue .dialogue-turn {
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e4e4e7);
}

.display-type-dialogue .dialogue-turn.turn-even {
  background: #f8f9fa;
}

.display-type-dialogue .dialogue-turn.turn-odd {
  background: var(--card, #ffffff);
}

/* Speaker-based colors */
.display-type-dialogue .dialogue-turn.speaker-0 {
  border-left: 3px solid #3b82f6;
}

.display-type-dialogue .dialogue-turn.speaker-1 {
  border-left: 3px solid #10b981;
}

.display-type-dialogue .dialogue-turn.speaker-2 {
  border-left: 3px solid #f59e0b;
}

.display-type-dialogue .dialogue-turn.speaker-3 {
  border-left: 3px solid #ef4444;
}

.display-type-dialogue .dialogue-turn.speaker-4 {
  border-left: 3px solid #8b5cf6;
}

.display-type-dialogue .dialogue-speaker {
  font-weight: 600;
  color: var(--foreground, #09090b);
  margin-right: 8px;
}

.display-type-dialogue .dialogue-text {
  color: var(--text-color, #374151);
  line-height: 1.6;
}

.display-type-dialogue .turn-number {
  color: var(--muted-foreground, #71717a);
  font-size: 0.75rem;
  margin-right: 8px;
}

.display-type-dialogue .dialogue-placeholder {
  padding: 16px;
  text-align: center;
  color: var(--muted-foreground, #71717a);
  background: var(--muted, #f4f4f5);
  border-radius: 4px;
  font-style: italic;
}

/* =====================================================
   PER-TURN RATING STYLES
   ===================================================== */

.per-turn-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.ptr-values {
  display: flex;
  gap: 4px;
}

.ptr-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  background: white;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.ptr-value:hover {
  border-color: #8b5cf6;
  color: #8b5cf6;
}

.ptr-value.ptr-selected {
  background: #8b5cf6;
  border-color: #7c3aed;
  color: white;
}

.ptr-label {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
}

/* Multi-dimension per-turn rating group */
.per-turn-rating-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.per-turn-rating-group .per-turn-rating {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.ptr-schema-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  min-width: 80px;
}

/* Dark mode per-turn ratings */
@media (prefers-color-scheme: dark) {
  .per-turn-rating {
    border-top-color: rgba(255, 255, 255, 0.1);
  }

  .per-turn-rating-group {
    border-top-color: rgba(255, 255, 255, 0.1);
  }

  .ptr-schema-label {
    color: #94a3b8;
  }

  .ptr-value {
    border-color: #475569;
    background: #1e293b;
    color: #64748b;
  }

  .ptr-value:hover {
    border-color: #a78bfa;
    color: #a78bfa;
  }

  .ptr-value.ptr-selected {
    background: #7c3aed;
    border-color: #6d28d9;
    color: white;
  }

  .ptr-label {
    color: #64748b;
  }
}

/* Pairwise display styles */
.display-type-pairwise .pairwise-display-content {
  display: flex;
  flex-direction: row;
  gap: 16px;
  flex-wrap: wrap;
}

.display-type-pairwise .pairwise-display-content.vertical-on-mobile {
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .display-type-pairwise .pairwise-display-content.vertical-on-mobile {
    flex-direction: column;
  }

  .display-type-pairwise .pairwise-display-content.vertical-on-mobile .pairwise-cell {
    width: 100% !important;
    flex: 0 0 100% !important;
  }
}

.display-type-pairwise .pairwise-cell {
  padding: 16px;
  background-color: var(--card, #ffffff);
  border: 1px solid var(--border, #e4e4e7);
  border-radius: 8px;
  box-shadow: var(--box-shadow, 0 1px 3px 0 rgb(0 0 0 / 0.1));
}

.display-type-pairwise .pairwise-cell:first-child {
  border-left: 3px solid #3b82f6;
}

.display-type-pairwise .pairwise-cell:nth-child(2) {
  border-left: 3px solid #10b981;
}

.display-type-pairwise .pairwise-cell:nth-child(3) {
  border-left: 3px solid #f59e0b;
}

.display-type-pairwise .pairwise-cell:nth-child(4) {
  border-left: 3px solid #ef4444;
}

.display-type-pairwise .pairwise-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--muted-foreground, #71717a);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.display-type-pairwise .pairwise-content {
  line-height: 1.6;
}

.display-type-pairwise .pairwise-empty {
  color: var(--muted-foreground, #71717a);
  font-style: italic;
}

.display-type-pairwise .pairwise-list {
  margin: 0;
  padding-left: 20px;
}

.display-type-pairwise .pairwise-placeholder {
  padding: 16px;
  text-align: center;
  color: var(--muted-foreground, #71717a);
  background: var(--muted, #f4f4f5);
  border-radius: 4px;
  font-style: italic;
}

/* ========================================
   PAIRWISE ANNOTATION SCHEMA STYLES
   ======================================== */

/* Pairwise annotation form container */
/* Pairwise items display container - created by JS */
.pairwise-items-display-container {
  margin-bottom: 1.5rem;
}

/* ========================================
   ANNOTATION FORM LAYOUT SYSTEM
   ======================================== */

/* CSS Custom Properties for Layout Configuration */
:root {
  --layout-columns: 2;
  --layout-gap: 1rem;
  --layout-row-gap: var(--layout-gap);
  --layout-align: start;
  --layout-content-align: left;
  --group-bg-odd: #fafafa;
  --group-bg-even: #f8f9fc;
  --group-padding: 0.5rem 0.75rem;
  --form-padding: 0.375rem 0.5rem;
}

/* Main Layout Container */
.annotation-forms-layout {
  display: grid;
  grid-template-columns: repeat(var(--layout-columns), 1fr);
  gap: var(--layout-row-gap) var(--layout-gap);
  align-items: var(--layout-align);
}

/* Legacy grid-based layout for annotation forms (backwards compatibility) */
.annotation-forms-grid {
  display: grid;
  grid-template-columns: repeat(var(--layout-columns, 2), 1fr);
  gap: var(--layout-gap, 1rem);
  align-items: var(--layout-align, start);
}

/* Column Spans (1-6) for both layout containers */
.annotation-forms-layout .annotation-form[data-grid-columns="1"],
.annotation-forms-grid .annotation-form[data-grid-columns="1"] {
  grid-column: span 1;
}

.annotation-forms-layout .annotation-form[data-grid-columns="2"],
.annotation-forms-grid .annotation-form[data-grid-columns="2"] {
  grid-column: span 2;
}

.annotation-forms-layout .annotation-form[data-grid-columns="3"],
.annotation-forms-grid .annotation-form[data-grid-columns="3"] {
  grid-column: span 3;
}

.annotation-forms-layout .annotation-form[data-grid-columns="4"],
.annotation-forms-grid .annotation-form[data-grid-columns="4"] {
  grid-column: span 4;
}

.annotation-forms-layout .annotation-form[data-grid-columns="5"],
.annotation-forms-grid .annotation-form[data-grid-columns="5"] {
  grid-column: span 5;
}

.annotation-forms-layout .annotation-form[data-grid-columns="6"],
.annotation-forms-grid .annotation-form[data-grid-columns="6"] {
  grid-column: span 6;
}

/* Row Spans (2-4) */
.annotation-forms-layout .annotation-form[data-grid-rows="2"],
.annotation-forms-grid .annotation-form[data-grid-rows="2"] {
  grid-row: span 2;
}

.annotation-forms-layout .annotation-form[data-grid-rows="3"],
.annotation-forms-grid .annotation-form[data-grid-rows="3"] {
  grid-row: span 3;
}

.annotation-forms-layout .annotation-form[data-grid-rows="4"],
.annotation-forms-grid .annotation-form[data-grid-rows="4"] {
  grid-row: span 4;
}

/* Min/Max Width via CSS Custom Properties */
.annotation-forms-layout .annotation-form,
.annotation-forms-grid .annotation-form {
  min-width: var(--form-min-width, 0);
  max-width: var(--form-max-width, none);
}

/* Self Alignment Overrides */
.annotation-forms-layout .annotation-form[data-align-self="start"],
.annotation-forms-grid .annotation-form[data-align-self="start"] {
  align-self: start;
}

.annotation-forms-layout .annotation-form[data-align-self="center"],
.annotation-forms-grid .annotation-form[data-align-self="center"] {
  align-self: center;
}

.annotation-forms-layout .annotation-form[data-align-self="end"],
.annotation-forms-grid .annotation-form[data-align-self="end"] {
  align-self: end;
}

.annotation-forms-layout .annotation-form[data-align-self="stretch"],
.annotation-forms-grid .annotation-form[data-align-self="stretch"] {
  align-self: stretch;
}

/* CSS Order Support (for explicit ordering) */
.annotation-forms-layout .annotation-form[data-grid-order],
.annotation-forms-grid .annotation-form[data-grid-order] {
  /* Order value is set via JavaScript */
}

/* ========================================
   ANNOTATION FORM GROUPS
   ======================================== */

.annotation-form-group {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--group-padding);
  background-color: var(--card);
  margin-bottom: 0.25rem;
}

/* Subtle alternating background colors for visual distinction */
.annotation-form-group:nth-child(odd) {
  background-color: var(--group-bg-odd);
}

.annotation-form-group:nth-child(even) {
  background-color: var(--group-bg-even);
}

/* Per-group custom background color (set via inline style) */
.annotation-form-group[style*="--group-bg:"] {
  background-color: var(--group-bg) !important;
}

/* Main content display area (text/image/video to annotate) always white */
#task_layout,
#task_layout.shadcn-card,
.instance-text-container,
#instance-text {
  background-color: #ffffff !important;
}

.annotation-form-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.375rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.annotation-form-group-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--heading-color);
  margin: 0;
}

.annotation-form-group-description {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  margin: 0.125rem 0 0 0;
}

.annotation-form-group-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  transition: var(--transition);
}

.annotation-form-group-toggle:hover {
  background-color: var(--secondary);
  color: var(--foreground);
}

.annotation-form-group-toggle i {
  transition: transform 0.2s ease;
}

.annotation-form-group.collapsed .annotation-form-group-toggle i {
  transform: rotate(-90deg);
}

.annotation-form-group-content {
  display: grid;
  grid-template-columns: repeat(var(--layout-columns, 2), 1fr);
  gap: var(--layout-gap, 0.75rem);
  width: 100%;
  align-items: start; /* Don't stretch forms vertically */
}

/* Forms inside groups should fill their grid cells horizontally but not stretch vertically */
.annotation-form-group-content .annotation-form,
.annotation-forms-layout .annotation-form {
  width: 100%;
  box-sizing: border-box;
  /* Keep forms at their natural height - don't stretch to fill grid row */
}

/* Reduce padding in forms within layout containers */
.annotation-forms-layout .shadcn-radio-container,
.annotation-forms-layout .shadcn-multiselect-container,
.annotation-forms-layout .shadcn-likert-container,
.annotation-forms-layout .shadcn-textbox-container,
.annotation-form-group-content .shadcn-radio-container,
.annotation-form-group-content .shadcn-multiselect-container,
.annotation-form-group-content .shadcn-likert-container,
.annotation-form-group-content .shadcn-textbox-container {
  padding: var(--form-padding);
  width: 100%;
  box-sizing: border-box;
  align-items: flex-start;  /* Don't center content vertically in layout mode */
}

/* Minimal fieldset padding within layout containers - container already has padding */
.annotation-forms-layout fieldset,
.annotation-form-group-content fieldset {
  padding: 0.125rem 0;  /* Reduced from 0.25rem 0.5rem to avoid double padding */
  margin: 0;
  text-align: var(--layout-content-align);
}

/* Ensure radio and multiselect options are left-aligned */
.annotation-form-group-content .shadcn-radio-options,
.annotation-form-group-content .shadcn-multiselect-grid,
.annotation-forms-layout .shadcn-radio-options,
.annotation-forms-layout .shadcn-multiselect-grid {
  align-items: flex-start;
  width: 100%;
}

.annotation-form-group.collapsed .annotation-form-group-content {
  display: none;
}

/* Pairwise forms wrapper - legacy flex fallback */
.pairwise-forms-wrapper {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  align-items: start;
}

.annotation-form.pairwise {
  margin-bottom: 0;
  padding: 0.75rem;
  background-color: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.annotation-form.pairwise fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

/* Hide "Text to Annotate" when pairwise items display is present */
.pairwise-has-items ~ #instance-text,
body.has-pairwise-display #instance-text {
  display: none;
}

/* Pairwise question title (compact) */
.pairwise-question {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--foreground);
  margin-bottom: 0.5rem;
  padding: 0;
}

/* Pairwise annotations container - compact layout */
.pairwise-annotations-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

/* Side-by-side item display boxes - shown ONCE at top */
.pairwise-items-display {
  display: flex;
  gap: 24px;
  margin-bottom: 1.5rem;
}

.pairwise-item-wrapper {
  flex: 1;
  min-width: 0;
}

.pairwise-item-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
}

.pairwise-item-box {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: 100px;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.6;
  color: var(--foreground);
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Binary mode: Compact selection tiles */
.pairwise-selection-container {
  display: inline-flex;
  gap: 12px;
  margin: 8px 0;
  justify-content: flex-start;
  vertical-align: middle;
}

.pairwise-tile {
  flex: 0 0 auto;
  min-width: 80px;
  max-width: 150px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background-color: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pairwise-tile:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pairwise-tile:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(110, 86, 207, 0.2);
}

.pairwise-tile.selected {
  border-color: var(--primary);
  background-color: rgba(110, 86, 207, 0.05);
  box-shadow: 0 0 0 3px rgba(110, 86, 207, 0.15);
}

.pairwise-tile.selected::after {
  content: '\2713';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background-color: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.pairwise-tile-label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--foreground);
}

.pairwise-tile-shortcut {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  background-color: var(--muted);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Extra options (tie/neither buttons) - inline with selection tiles */
.pairwise-extra-options {
  display: inline-flex;
  gap: 12px;
  margin-left: 12px;
  vertical-align: middle;
}

.pairwise-tie-btn,
.pairwise-neither-btn {
  padding: 10px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  cursor: pointer;
  color: var(--foreground);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.pairwise-tie-btn:hover,
.pairwise-neither-btn:hover {
  background: var(--muted);
  border-color: var(--primary);
}

.pairwise-tie-btn:focus,
.pairwise-neither-btn:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(110, 86, 207, 0.2);
}

.pairwise-tie-btn.selected,
.pairwise-neither-btn.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Scale mode: Rating slider widget - compact */
.pairwise-scale-widget {
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background-color: var(--muted);
  border-radius: var(--radius);
  max-width: 600px;
}

.pairwise-scale-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 12px;
}

.pairwise-scale-label-min {
  text-align: left;
}

.pairwise-scale-label-center {
  text-align: center;
}

.pairwise-scale-label-max {
  text-align: right;
}

.pairwise-scale-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #c4c4c8;  /* Darker gray for visible track */
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.pairwise-scale-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s ease;
}

.pairwise-scale-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.pairwise-scale-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pairwise-scale-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 8px;
  background: #c4c4c8;
  border-radius: 4px;
}

.pairwise-scale-slider::-moz-range-track {
  width: 100%;
  height: 8px;
  background: #c4c4c8;
  border-radius: 4px;
}

.pairwise-scale-value-display {
  margin-top: 8px;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--primary);
}

.pairwise-scale-ticks {
  position: relative;
  width: 100%;
  height: 20px;
  margin-top: 4px;
}

.pairwise-scale-tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.9rem;
  color: var(--muted-foreground);
}

.pairwise-scale-tick.center {
  font-weight: 600;
  color: var(--foreground);
}

/* ========================================
   RESPONSIVE LAYOUT BREAKPOINTS
   ======================================== */

/* Mobile breakpoint (default 480px) - Collapse to single column */
@media (max-width: 480px) {
  .annotation-forms-layout,
  .annotation-forms-grid {
    --layout-columns: 1 !important;
  }

  .annotation-forms-layout .annotation-form[data-grid-columns],
  .annotation-forms-grid .annotation-form[data-grid-columns] {
    grid-column: span 1 !important;
  }

  .annotation-form-group-content {
    grid-template-columns: 1fr !important;
  }
}

/* Tablet breakpoint (default 768px) - Halve column spans > 2 */
@media (min-width: 481px) and (max-width: 768px) {
  .annotation-forms-layout .annotation-form[data-grid-columns="3"],
  .annotation-forms-layout .annotation-form[data-grid-columns="4"],
  .annotation-forms-layout .annotation-form[data-grid-columns="5"],
  .annotation-forms-layout .annotation-form[data-grid-columns="6"],
  .annotation-forms-grid .annotation-form[data-grid-columns="3"],
  .annotation-forms-grid .annotation-form[data-grid-columns="4"],
  .annotation-forms-grid .annotation-form[data-grid-columns="5"],
  .annotation-forms-grid .annotation-form[data-grid-columns="6"] {
    grid-column: span 2;
  }
}

/* Responsive: Stack items vertically on tablet and mobile */
@media (max-width: 768px) {
  .annotation-forms-grid,
  .annotation-forms-layout,
  .pairwise-forms-wrapper {
    grid-template-columns: 1fr;
  }

  .annotation-forms-grid .annotation-form[data-grid-columns="2"],
  .annotation-forms-layout .annotation-form[data-grid-columns="2"] {
    grid-column: span 1;
  }

  .pairwise-items-display {
    flex-direction: column;
  }

  .pairwise-selection-container {
    flex-direction: column;
  }

  .pairwise-extra-options {
    display: flex;
    margin-left: 0;
    margin-top: 8px;
  }

  .annotation-form.pairwise {
    max-width: 100%;
    display: block;
  }

  .annotation-form-group-content {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   SEGMENTATION MASK STYLES
   ======================================== */

/* Mask canvas overlay for segmentation - extends image-annotation.css */
.mask-canvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 10;
}

.mask-canvas.active {
  pointer-events: auto;
  cursor: crosshair;
}

/* Brush size slider group - extends image-annotation.css */
.brush-size-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brush-size-group input[type="range"] {
  width: 80px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e9ecef;
  border-radius: 3px;
  outline: none;
}

.brush-size-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0d6efd;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.brush-size-group input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0d6efd;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.brush-size-group .brush-size-value {
  font-size: 13px;
  color: #495057;
  min-width: 24px;
  text-align: right;
}

/* ========================================
   BWS (Best-Worst Scaling) Styles
   ======================================== */

.bws-items-display {
  margin-bottom: 16px;
}

.bws-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bws-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.bws-item-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  min-width: 24px;
  flex-shrink: 0;
}

.bws-item-text {
  font-size: 0.95rem;
  color: var(--foreground);
  line-height: 1.5;
}

.bws-description {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.bws-selection-section {
  margin-bottom: 12px;
}

.bws-selection-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--foreground);
}

.bws-best-label {
  color: #16a34a;
}

.bws-worst-label {
  color: #dc2626;
}

.bws-selection-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bws-tile {
  flex: 0 0 auto;
  min-width: 60px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  background-color: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.bws-tile:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bws-tile:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(110, 86, 207, 0.2);
}

.bws-best-tile:hover {
  border-color: #16a34a;
}

.bws-worst-tile:hover {
  border-color: #dc2626;
}

.bws-best-tile.selected {
  border-color: #16a34a;
  background-color: rgba(22, 163, 74, 0.08);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.bws-worst-tile.selected {
  border-color: #dc2626;
  background-color: rgba(220, 38, 38, 0.08);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.bws-tile-label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--foreground);
}

.bws-tile-shortcut {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  background-color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
}

.bws-validation-error {
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 8px;
  padding: 6px 12px;
  background-color: rgba(220, 38, 38, 0.06);
  border-radius: var(--radius);
  border: 1px solid rgba(220, 38, 38, 0.2);
}


/* =====================================================
   POTATO DESIGN SYSTEM - Layout & Navigation
   ===================================================== */

/* ===== NAVBAR ===== */

.potato-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background-color: var(--primary-color);
  padding: 0 1rem;
  height: 52px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.potato-navbar .navbar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  width: 100%;
  gap: 1rem;
}

.potato-navbar .navbar-brand {
  flex-shrink: 0;
}

.potato-navbar .navbar-brand .task-name {
  font-weight: 700;
  color: var(--light-color);
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.potato-navbar .navbar-brand .header-logo {
  height: 32px;
  width: auto;
  margin-right: 8px;
  vertical-align: middle;
}

.potato-navbar .navbar-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 0.75rem;
}

.potato-navbar .navbar-divider {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.potato-navbar .progress-section {
  color: var(--light-color);
  font-size: 0.8rem;
  white-space: nowrap;
}

.potato-navbar .progress-section .progress-label {
  opacity: 0.65;
  margin-right: 0.25rem;
}

.potato-navbar .nav-controls {
  display: flex;
  gap: 3px;
}

.potato-navbar .nav-control-btn {
  height: 28px;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255,255,255,0.1);
  color: var(--light-color);
  border: 1px solid rgba(255,255,255,0.12);
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 0.7rem;
}

.potato-navbar .nav-control-btn:hover {
  background: rgba(255,255,255,0.22);
}

.potato-navbar .goto-section {
  display: flex;
  align-items: center;
  gap: 3px;
}

.potato-navbar .goto-section input {
  width: 48px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: var(--light-color);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  text-align: center;
  padding: 0 4px;
}

.potato-navbar .goto-section input::placeholder {
  color: rgba(255,255,255,0.35);
}

.potato-navbar .goto-section input:focus {
  outline: none;
  border-color: rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.14);
}

.potato-navbar .goto-btn {
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.88);
  color: var(--primary-color);
  border: none;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s ease;
}

.potato-navbar .goto-btn:hover {
  background: white;
}

.potato-navbar .navbar-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.potato-navbar .user-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.1);
  padding: 0.3rem 0.6rem 0.3rem 0.75rem;
  border-radius: 999px;
  color: var(--light-color);
  font-size: 0.8rem;
}

.potato-navbar .user-pill .username {
  font-weight: 500;
}

.potato-navbar .logout-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  background: rgba(255,255,255,0.88);
  color: var(--primary-color);
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

.potato-navbar .logout-btn:hover {
  background: white;
  color: var(--primary-color);
}

.potato-navbar .adjudicate-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  background: rgba(255,255,255,0.15);
  color: var(--light-color);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.15);
  transition: background 0.15s ease;
}

.potato-navbar .adjudicate-btn:hover {
  background: rgba(255,255,255,0.25);
  color: white;
}

/* ===== NAVIGATION BUTTONS ===== */

.potato-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
}

/* ===== FOOTER ===== */

.potato-footer {
  padding: 0.75rem 0;
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted-foreground);
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}

.potato-footer a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.potato-footer a:hover {
  color: var(--secondary-color);
}

.potato-footer .footer-sep {
  display: inline-block;
  margin: 0 0.5rem;
  color: var(--border);
}

/* ===== STANDALONE PAGES (login, done, error) ===== */

.potato-page-center {
  min-height: 100vh;
  background: var(--light-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.potato-page-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--box-shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 2rem;
}

.potato-page-card-wide {
  max-width: 560px;
}

.potato-page-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.potato-page-icon i {
  font-size: 1.5rem;
}

.potato-page-icon-success {
  background: rgba(16, 185, 129, 0.1);
}

.potato-page-icon-success i {
  color: var(--success-color);
}

.potato-page-icon-error {
  background: rgba(239, 68, 68, 0.08);
}

.potato-page-icon-error i {
  color: var(--destructive);
}

.potato-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--heading-color);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.potato-page-subtitle {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* ===== FORM STYLES FOR STANDALONE PAGES ===== */

.potato-form-group {
  margin-bottom: 1.15rem;
}

.potato-form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 0.3rem;
}

.potato-form-input {
  width: 100%;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  color: var(--foreground);
  background: var(--background);
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.potato-form-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(110, 86, 207, 0.12);
}

.potato-form-input::placeholder {
  color: var(--muted-foreground);
}

.potato-form-submit {
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s ease;
}

.potato-form-submit:hover {
  background: var(--secondary-color);
}

.potato-form-submit:active {
  transform: scale(0.98);
}

/* Login page tabs */
.potato-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin: -0.5rem -0.5rem 1.5rem;
  padding: 0 0.5rem;
}

.potato-tab {
  padding: 0.75rem 1rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--muted-foreground);
  border: none;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  background: none;
  font-family: var(--font-sans);
}

.potato-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.potato-tab:hover:not(.active) {
  color: var(--foreground);
}

/* Alert styles for standalone pages */
.potato-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.potato-alert-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--destructive);
}

.potato-alert-success {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #065f46;
}

.potato-alert-info {
  background: rgba(110, 86, 207, 0.06);
  border: 1px solid rgba(110, 86, 207, 0.15);
  color: var(--primary);
}

/* ===== SCHEMA CONTAINER CONSISTENCY ===== */

/* Ensure consistent font across all annotation forms */
.annotation-form {
  font-family: var(--font-sans);
}

/* Annotation forms: responsive multi-column flow */
#annotation-forms {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#annotation-forms > .annotation_schema {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
}

/* Fit-content schemas flow side-by-side; full-width schemas break the row */
#annotation-forms .shadcn-radio-container,
#annotation-forms .shadcn-multiselect-container,
#annotation-forms .shadcn-likert-container {
  width: fit-content;
  max-width: 100%;
  align-items: flex-start;
}

/* These schemas need full width (textareas, span overlays, etc.) */
#annotation-forms .shadcn-textbox-container,
#annotation-forms .shadcn-span-container,
#annotation-forms .shadcn-number-container,
#annotation-forms .shadcn-select-container {
  width: 100%;
}

/* ===== ANIMATION UTILITIES ===== */

@keyframes potato-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.potato-fade-in {
  animation: potato-fade-in 0.25s ease-out;
}

@keyframes potato-status-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ===== ANNOTATION INSTRUCTIONS BANNER ===== */

.annotation-instructions-banner {
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}

.annotation-instructions-banner summary {
  padding: 0.625rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  background: var(--secondary);
  color: var(--secondary-foreground);
  user-select: none;
}

.annotation-instructions-banner summary:hover {
  background: var(--accent);
}

.annotation-instructions-content {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--foreground);
}

.annotation-instructions-content h4 {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.annotation-instructions-content h4:first-child {
  margin-top: 0;
}

.annotation-instructions-content ul,
.annotation-instructions-content ol {
  margin: 0.25rem 0 0.5rem 1.25rem;
  padding: 0;
}

.annotation-instructions-content li {
  margin-bottom: 0.2rem;
}

.annotation-instructions-content code {
  background: var(--muted);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.8rem;
}

.annotation-instructions-content strong {
  color: var(--primary);
}

/* ===== RESPONSIVE NAVBAR ===== */

@media (max-width: 900px) {
  .potato-navbar .navbar-center {
    gap: 0.5rem;
  }

  .potato-navbar .goto-section {
    display: none;
  }
}

@media (max-width: 700px) {
  .potato-navbar {
    height: auto;
    padding: 0.5rem 0.75rem;
  }

  .potato-navbar .navbar-inner {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .potato-navbar .navbar-center {
    order: 3;
    flex-basis: 100%;
    justify-content: center;
  }

  .potato-nav .shadcn-button {
    font-size: 0.8rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    height: 2.25rem;
  }
}

