/* ==========================================================================
   Adviters IDP • Document Intelligence Studio — Design System
   ========================================================================== */

:root {
  /* Color Tokens - Modern Dark Theme */
  --bg-app: #080c14;
  --bg-surface: #0e1526;
  --bg-surface-elevated: #162036;
  --bg-card: rgba(22, 32, 54, 0.72);
  --bg-card-hover: rgba(30, 43, 72, 0.85);

  --border-subtle: rgba(148, 163, 184, 0.12);
  --border-medium: rgba(148, 163, 184, 0.22);
  --border-focus: #6366f1;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.4);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.35);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.35);

  --danger: #f43f5e;
  --danger-bg: rgba(244, 63, 94, 0.12);
  --danger-border: rgba(244, 63, 94, 0.35);

  --purple: #a855f7;
  --purple-bg: rgba(168, 85, 247, 0.14);

  --blue: #38bdf8;
  --blue-bg: rgba(56, 189, 248, 0.14);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px var(--primary-glow);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ==========================================================================
   Header Bar
   ========================================================================== */

.app-header {
  min-height: 58px;
  height: auto;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 6px 18px;
  z-index: 20;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.4);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.badge-version {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.engine-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.engine-pill {
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.pill-dot.green {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.pill-dot.blue {
  background-color: var(--blue);
  box-shadow: 0 0 8px var(--blue);
}

.pill-dot.purple {
  background-color: var(--purple);
  box-shadow: 0 0 8px var(--purple);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header-config-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background-color: rgba(14, 21, 38, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px 10px;
}

.header-config-group .mode-select-container {
  background: transparent;
  border: none;
  padding: 0;
}

.header-group-divider {
  width: 1px;
  height: 18px;
  background-color: var(--border-subtle);
  flex-shrink: 0;
}

.header-primary-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-util-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-left: 4px;
  border-left: 1px solid var(--border-subtle);
}

.btn-compact {
  padding: 6px 12px !important;
  font-size: 12.5px !important;
  gap: 6px !important;
  white-space: nowrap;
}

.btn-icon-danger-hover:hover:not(:disabled) {
  color: #f87171 !important;
  border-color: rgba(244, 63, 94, 0.45) !important;
  background-color: rgba(244, 63, 94, 0.12) !important;
}

/* Switches */
.switch-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: var(--text-secondary);
}

.switch-container input {
  display: none;
}

.switch-slider {
  width: 36px;
  height: 20px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  position: relative;
  transition: all 0.2s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background-color: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-container input:checked+.switch-slider {
  background-color: var(--primary);
  border-color: var(--primary);
}

.switch-container input:checked+.switch-slider::before {
  transform: translateX(16px);
  background-color: #fff;
}

/* Buttons */
.btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--border-focus);
}

/* Dropdown Menu */
.dropdown-container {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 320px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  padding: 6px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 3px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: fadeInDown 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.14s ease;
  user-select: none;
}

.dropdown-item:hover {
  background-color: rgba(99, 102, 241, 0.18);
}

.dropdown-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.dropdown-item-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-sm {
  font-size: 12px;
  padding: 5px 10px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
}

.btn-icon:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-medium);
  background-color: rgba(255, 255, 255, 0.06);
}

.btn:disabled,
.btn-icon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-icon-sm {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: var(--radius-sm);
  background-color: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon-sm:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* ==========================================================================
   Workspace Split Grid
   ========================================================================== */

.workspace-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background-color: var(--bg-app);
}

.panel-document {
  border-right: 1px solid var(--border-subtle);
}

.panel-header {
  min-height: 44px;
  height: auto;
  padding: 6px 14px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  flex-shrink: 0;
}

/* ==========================================================================
   Document Viewer (Left Panel)
   ========================================================================== */

.viewer-toolbar .toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.toolbar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.toolbar-filename {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  max-width: 240px;
  min-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

.page-controls,
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-indicator,
.zoom-level {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 42px;
  text-align: center;
  white-space: nowrap;
}

/* ==========================================================================
   Layer & Inspection Toolbar (Original / OCR Synthetic / Overlay)
   ========================================================================== */

.layer-toolbar {
  min-height: 40px;
  height: auto;
  padding: 5px 14px;
  background-color: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  flex-shrink: 0;
  font-size: 12px;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.03);
}

.layer-tabs-group {
  display: inline-flex;
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.layer-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.layer-tab:hover:not(.disabled) {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.05);
}

.layer-tab.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 6px rgba(99, 102, 241, 0.45);
}

.layer-tab.disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}

.layer-options-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.layer-toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  transition: all 0.15s ease;
}

.layer-toggle-chip:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.layer-toggle-chip input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
}

.layer-toggle-chip.alert-chip input[type="checkbox"] {
  accent-color: #ef4444;
}

.layer-toggle-chip.alert-chip:has(input:checked) {
  border-color: rgba(239, 68, 68, 0.5);
  background-color: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.overlay-opacity-container {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 2px 8px;
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.opacity-slider {
  width: 65px;
  height: 4px;
  accent-color: var(--primary);
  cursor: pointer;
}

.opacity-value {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-primary);
  min-width: 26px;
}

.btn-xs {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  gap: 5px;
}

#btn-link-original {
  color: #818cf8;
  border-color: rgba(129, 140, 248, 0.4);
  background-color: rgba(99, 102, 241, 0.08);
}

#btn-link-original:hover {
  background-color: rgba(99, 102, 241, 0.18);
  color: #ffffff;
  border-color: #818cf8;
}

#btn-link-original.linked {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.4);
  background-color: rgba(16, 185, 129, 0.08);
}

.viewer-viewport {
  flex: 1;
  position: relative;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 36px 48px;
  box-sizing: border-box;
  background-color: #05080f;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 0);
  background-size: 20px 20px;
}

/* Empty Dropzone */
.empty-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: auto;
  max-width: 440px;
  padding: 40px 30px;
  border: 2px dashed rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-lg);
  background-color: rgba(14, 21, 38, 0.4);
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.empty-dropzone.dragover {
  border-color: var(--primary);
  background-color: rgba(99, 102, 241, 0.08);
  transform: scale(1.02);
}

.dropzone-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 16px;
}

.empty-dropzone h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-dropzone p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

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

/* Page Layer and Bounding Boxes */
.document-container {
  display: flex;
  justify-content: center;
  margin: 0 auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.page-layer-wrapper {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background-color: #ffffff;
}

#pdf-canvas,
#image-view {
  display: block;
  max-width: none;
  transition: opacity 0.15s ease;
}

#ocr-canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.boxes-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.boxes-overlay.hidden {
  display: none !important;
}

/* Low confidence only mode for boxes */
.boxes-overlay.low-conf-only .ocr-box:not(.low):not(.has-flag) {
  opacity: 0.08 !important;
  pointer-events: none;
}

.boxes-overlay.low-conf-only .ocr-box.low,
.boxes-overlay.low-conf-only .ocr-box.has-flag {
  opacity: 1 !important;
  border-width: 2px !important;
  border-color: #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.28) !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.8) !important;
  animation: pulse-low-conf 1.5s infinite;
}

@keyframes pulse-low-conf {
  0% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  }

  50% {
    transform: scale(1.02);
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.9);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  }
}

.ocr-box {
  position: absolute;
  border-radius: 2px;
  pointer-events: auto;
  cursor: pointer;
  transition: all 0.12s ease;
  box-sizing: border-box;
}

.ocr-box.high {
  border: 1px solid rgba(16, 185, 129, 0.35);
  background-color: rgba(16, 185, 129, 0.04);
}

.ocr-box.medium {
  border: 1px solid rgba(245, 158, 11, 0.45);
  background-color: rgba(245, 158, 11, 0.06);
}

.ocr-box.low {
  border: 1px dashed rgba(244, 63, 94, 0.7);
  background-color: rgba(244, 63, 94, 0.1);
}

.ocr-box:hover {
  background-color: rgba(99, 102, 241, 0.22) !important;
  border: 1.5px solid var(--primary) !important;
  z-index: 10;
}

.ocr-box.active-box {
  background-color: rgba(99, 102, 241, 0.35) !important;
  border: 2px solid #818cf8 !important;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.75);
  z-index: 15;
  animation: pulseBox 1.6s infinite alternate;
}

@keyframes pulseBox {
  from {
    box-shadow: 0 0 6px rgba(99, 102, 241, 0.6);
  }

  to {
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.95);
  }
}

/* Inspection Beacon & Tag for small or low-confidence OCR targets */
.ocr-inspection-beacon {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  border: 2.5px solid #f43f5e;
  background: rgba(244, 63, 94, 0.22);
  transform: translate(-50%, -50%);
  z-index: 50;
  animation: beaconRadar 1.8s ease-out infinite;
}

@keyframes beaconRadar {
  0% {
    width: 16px;
    height: 16px;
    opacity: 1;
    box-shadow: 0 0 10px #f43f5e;
  }

  100% {
    width: 76px;
    height: 76px;
    opacity: 0;
    box-shadow: 0 0 28px rgba(244, 63, 94, 0);
  }
}

.ocr-inspection-tag {
  position: absolute;
  transform: translate(-50%, -100%);
  margin-top: -10px;
  background: #0f172a;
  border: 1px solid #818cf8;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
  z-index: 60;
  pointer-events: none;
  animation: fadeInDown 0.2s ease-out;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translate(-50%, -120%);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -100%);
  }
}

/* Semantic Card Highlight Pulse */
.card-highlight-pulse {
  outline: 2.5px solid #818cf8 !important;
  background-color: rgba(99, 102, 241, 0.18) !important;
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.5) !important;
  transition: all 0.3s ease;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.studio-toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 440px;
  padding: 12px 16px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.studio-toast.warning {
  border-left-color: var(--warning);
}

.studio-toast.info {
  border-left-color: var(--blue);
}

.studio-toast.success {
  border-left-color: var(--success);
}

.toast-icon {
  font-size: 15px;
  line-height: 1.2;
}

.toast-text {
  flex: 1;
}

@keyframes slideInToast {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Tooltip */
.ocr-tooltip {
  position: fixed;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-primary);
  pointer-events: none;
  z-index: 100;
  box-shadow: var(--shadow-md);
  max-width: 280px;
  white-space: pre-wrap;
  word-break: break-word;
}

.ocr-tooltip .tt-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Legend */
.viewer-legend {
  height: 36px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 12px;
  height: 8px;
  border-radius: 2px;
}

.legend-color.high {
  border: 1px solid var(--success);
  background-color: var(--success-bg);
}

.legend-color.medium {
  border: 1px solid var(--warning);
  background-color: var(--warning-bg);
}

.legend-color.low {
  border: 1px dashed var(--danger);
  background-color: var(--danger-bg);
}

.legend-color.active {
  border: 1.5px solid var(--primary);
  background-color: rgba(99, 102, 241, 0.4);
}

/* ==========================================================================
   Semantic Studio (Right Panel)
   ========================================================================== */

.semantic-header {
  background-color: var(--bg-surface);
}

.review-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.status-indicator-badge.needs_review {
  background-color: var(--warning-bg);
  border-color: var(--warning-border);
  color: #fbbf24;
}

.status-indicator-badge.needs_review .status-dot {
  background-color: var(--warning);
  box-shadow: 0 0 8px var(--warning);
}

.status-indicator-badge.auto_accepted {
  background-color: var(--success-bg);
  border-color: var(--success-border);
  color: #34d399;
}

.status-indicator-badge.auto_accepted .status-dot {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-indicator-badge.user-modified {
  background-color: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.45);
  color: #a5b4fc;
}

.status-indicator-badge.user-modified .status-dot {
  background-color: #818cf8;
  box-shadow: 0 0 8px #818cf8;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.validation-badge {
  font-size: 11px;
  color: var(--text-muted);
}

.semantic-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.semantic-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.semantic-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* Review Flags Alert */
.review-flags-container {
  background-color: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.review-flags-container.all-resolved {
  background-color: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
}

.review-flags-container.all-resolved .flags-header {
  color: #34d399;
}

.flags-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: #fcd34d;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  gap: 12px;
}

.flags-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.flags-header-icon {
  font-size: 15px;
}

.flags-actions-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.flags-filter-group {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.flags-filter-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: all 0.15s ease;
}

.flags-filter-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.flags-filter-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 600;
}

.flags-toggle-icon {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.flags-list {
  padding: 0 14px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flag-item {
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-primary);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border-top: 1px solid rgba(245, 158, 11, 0.15);
  cursor: pointer;
  transition: all 0.15s ease;
}

.flag-item:hover {
  background-color: rgba(245, 158, 11, 0.15);
}

.flag-item.is-resolved {
  background-color: rgba(16, 185, 129, 0.05);
  border-top-color: rgba(16, 185, 129, 0.2);
}

.flag-item.is-resolved:hover {
  background-color: rgba(16, 185, 129, 0.12);
}

.flag-item.is-resolved .flag-msg {
  color: var(--text-secondary);
}

.flag-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}

.flag-severity {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  flex-shrink: 0;
}

.flag-severity.high {
  background: var(--danger-bg);
  color: #f87171;
  border: 1px solid var(--danger-border);
}

.flag-severity.medium {
  background: var(--warning-bg);
  color: #fbbf24;
  border: 1px solid var(--warning-border);
}

.flag-severity.low {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.flag-status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.flag-status-badge.resolved {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.flag-note-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

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

.btn-resolve-flag {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-resolve-flag:hover {
  background: rgba(16, 185, 129, 0.25);
  color: #ffffff;
  border-color: #34d399;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.btn-edit-flag {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-edit-flag:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.flag-units {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.flag-unit-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  transition: all 0.12s ease;
}

.flag-item:hover .flag-unit-badge {
  background-color: rgba(56, 189, 248, 0.28);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

/* Modal Flag Resolution Details */
.flag-modal-detail-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flag-modal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flag-modal-field-name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.flag-modal-msg-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.flag-modal-units-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.chip-flag-quick {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chip-flag-quick:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text-primary);
}

/* Section Cards */
.sections-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 24px;
}

.section-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.section-card:hover {
  border-color: var(--border-medium);
  background-color: var(--bg-card-hover);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title svg {
  color: var(--primary);
}

.section-counter {
  font-size: 11px;
  color: var(--text-muted);
  background-color: rgba(255, 255, 255, 0.04);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Contact */
.candidate-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 2px;
}

.candidate-headline {
  font-size: 13px;
  font-weight: 500;
  color: #818cf8;
  margin-bottom: 12px;
}

.contact-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  font-size: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.contact-row {
  display: flex;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-label {
  color: var(--text-muted);
  font-weight: 500;
  min-width: 60px;
}

.contact-value {
  color: var(--text-secondary);
}

.links-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.link-badge {
  font-size: 11px;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1px solid rgba(99, 102, 241, 0.25);
  transition: all 0.15s ease;
}

.link-badge:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
}

/* Profile Summary */
.profile-summary-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Timeline Experience */
.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  padding-left: 14px;
}

.timeline-container::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 4px;
  width: 2px;
  background-color: var(--border-subtle);
}

.timeline-item {
  position: relative;
  padding-left: 12px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 5px;
  left: -14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary);
  border: 2px solid var(--bg-app);
}

.job-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.job-role {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.job-period {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.job-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.job-employer {
  font-size: 13px;
  font-weight: 500;
  color: #38bdf8;
}

.origin-pill {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.origin-pill.local {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.origin-pill.gemini {
  background: var(--purple-bg);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.origin-pill.hybrid {
  background: var(--success-bg);
  color: #34d399;
  border: 1px solid var(--success-border);
}

.origin-pill.manual {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.job-responsibilities {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.job-responsibilities li {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  position: relative;
  padding-left: 14px;
  border-radius: var(--radius-sm);
  padding: 3px 6px 3px 16px;
  transition: background-color 0.12s ease;
}

.job-responsibilities li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--text-muted);
}

.job-responsibilities li:hover {
  background-color: rgba(99, 102, 241, 0.15);
  color: #fff;
}

/* Cards Grid (Education, Projects, Awards) */
.cards-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  background-color: rgba(14, 21, 38, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.item-card:hover {
  border-color: var(--border-focus);
  background-color: rgba(99, 102, 241, 0.08);
  transform: translateX(2px);
}

.item-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2px;
}

.item-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.item-card-date {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.item-card-sub {
  font-size: 12px;
  color: #38bdf8;
}

.item-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.5;
}

/* Chips Cloud (Skills, Languages) */
.chips-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--border-focus);
  background-color: rgba(99, 102, 241, 0.15);
  color: #fff;
  transform: translateY(-1px);
}

.chip-sub {
  font-size: 10px;
  color: var(--text-muted);
  background-color: rgba(0, 0, 0, 0.25);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

/* Alert Card: Unassigned */
.alert-card {
  border-color: var(--warning-border);
  background-color: rgba(245, 158, 11, 0.05);
}

.text-warning {
  color: #fbbf24 !important;
}

.unassigned-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unassigned-item {
  font-size: 12px;
  padding: 6px 10px;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.unassigned-item:hover {
  background-color: rgba(245, 158, 11, 0.15);
}

.unassigned-reason {
  font-size: 10px;
  color: var(--warning);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(8, 12, 20, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px auto;
}

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

.loading-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

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

/* ==========================================================================
   JSON Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 820px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

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

.modal-title {
  font-size: 15px;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background-color: #05080f;
}

.json-code {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: #38bdf8;
  white-space: pre-wrap;
  word-break: break-all;
}

.modal-dialog.modal-dialog-sm {
  max-width: 500px;
  height: auto;
  min-height: 180px;
}

.modal-dialog.modal-dialog-md {
  max-width: 580px;
  height: auto;
  max-height: 85vh;
}

.modal-dialog.modal-dialog-split {
  max-width: 1080px;
  width: 92vw;
  height: 86vh;
  max-height: 86vh;
}

.modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-section-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background-color: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  width: fit-content;
}

.modal-section-badge.section-exp {
  background-color: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.modal-section-badge.section-edu {
  background-color: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.35);
  color: #c084fc;
}

.modal-section-badge.section-skills {
  background-color: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.35);
  color: #34d399;
}

.modal-section-badge.section-lang {
  background-color: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fbbf24;
}

.modal-section-badge.section-proj {
  background-color: rgba(244, 114, 182, 0.12);
  border-color: rgba(244, 114, 182, 0.35);
  color: #f472b6;
}

.modal-section-badge.section-cert {
  background-color: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

.modal-section-badge.section-award {
  background-color: rgba(250, 204, 21, 0.12);
  border-color: rgba(250, 204, 21, 0.35);
  color: #facc15;
}

.modal-section-badge.section-interest {
  background-color: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.35);
  color: #c084fc;
}

.modal-section-label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.preview-section-target {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background-color: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
}

.edit-form-section-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(14, 21, 38, 0.75);
  border: 1px solid var(--border-subtle);
  margin-bottom: 12px;
}

.edit-form-section-banner .banner-icon {
  font-size: 16px;
  line-height: 1.2;
}

.edit-form-section-banner .banner-title {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}

.edit-form-section-banner .banner-title strong {
  color: #ffffff;
}

.edit-form-section-banner .banner-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  line-height: 1.3;
}

.modal-split-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  overflow: hidden;
  background-color: var(--bg-surface);
}

.modal-preview-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-subtle);
  background-color: #05080f;
  overflow: hidden;
  height: 100%;
}

.preview-pane-toolbar {
  padding: 8px 14px;
  background-color: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.preview-pane-title {
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon-xs {
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  transition: all 0.12s ease;
}

.btn-icon-xs:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  border-color: var(--primary);
}

.preview-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-zoom-controls {
  display: flex;
  align-items: center;
  gap: 3px;
  background-color: rgba(0, 0, 0, 0.25);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.preview-zoom-indicator {
  font-family: var(--font-mono);
  font-size: 10px;
  min-width: 34px;
  text-align: center;
  color: var(--text-secondary);
}

.preview-page-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.preview-page-indicator {
  font-family: var(--font-mono);
  font-size: 11px;
}

.preview-canvas-wrapper {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  cursor: grab;
  user-select: none;
}

.preview-canvas-wrapper.is-panning {
  cursor: grabbing !important;
}

.preview-pan-container {
  position: relative;
  display: inline-block;
  margin: auto;
}

#edit-preview-canvas {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  display: block;
}

#edit-preview-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.preview-empty-state {
  margin: auto;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  padding: 24px;
  text-align: center;
}

.modal-form-pane {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background-color: var(--bg-surface);
}

.preview-doc-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background-color: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}

@media (max-width: 860px) {
  .modal-split-body {
    grid-template-columns: 1fr;
    grid-template-rows: 240px 1fr;
  }

  .modal-preview-pane {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
}

/* ==========================================================================
   Editing Mode Styles & Controls
   ========================================================================== */

#btn-edit-mode.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.45);
}

.section-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-add-item {
  display: none;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border-color: rgba(99, 102, 241, 0.4);
  color: #818cf8;
  background-color: rgba(99, 102, 241, 0.08);
  transition: all 0.15s ease;
}

.btn-add-item:hover {
  background-color: rgba(99, 102, 241, 0.2);
  color: #fff;
  border-color: #818cf8;
}

/* Show add item buttons when in edit mode */
.editing-active .btn-add-item {
  display: inline-flex;
}

/* Chip Remove Button */
.chip-remove-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: rgba(244, 63, 94, 0.2);
  color: #f43f5e;
  font-size: 10px;
  margin-left: 2px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.chip-remove-btn:hover {
  background-color: #f43f5e;
  color: #fff;
  transform: scale(1.15);
}

.editing-active .chip-remove-btn {
  display: inline-flex;
}

/* Card Action Buttons (Edit / Delete) */
.item-card-actions {
  display: none;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.editing-active .item-card-actions {
  display: flex;
}

.item-card-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12px;
  transition: all 0.12s ease;
}

.item-card-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.1);
}

.item-card-btn.delete:hover {
  color: #f43f5e;
  background-color: rgba(244, 63, 94, 0.15);
}

/* Inline Editable Fields */
.editing-active [contenteditable="true"] {
  outline: 1px dashed rgba(99, 102, 241, 0.4);
  background-color: rgba(99, 102, 241, 0.04);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  cursor: text;
  transition: all 0.15s ease;
}

.editing-active [contenteditable="true"]:hover {
  outline: 1px dashed var(--primary);
  background-color: rgba(99, 102, 241, 0.08);
}

.editing-active [contenteditable="true"]:focus {
  outline: 2px solid var(--primary);
  background-color: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

/* Modal Form Styles */
.edit-form-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

.form-select {
  cursor: pointer;
}

.empty-section-notice {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.35);
}

/* ==========================================================================
   DuckDB CV Search & Query Modal Styles
   ========================================================================== */

/* DuckDB Modal Dialog with prominent border and shadow */
.search-modal-dialog {
  width: 96%;
  max-width: 1020px;
  height: 88vh;
  max-height: 880px;
  background-color: var(--bg-surface);
  border: 2px solid #38bdf8;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), 0 24px 50px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 501;
}

.search-modal-header {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border-medium);
  background-color: var(--bg-surface-elevated);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-modal-body {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  overflow-y: auto;
  background-color: var(--bg-surface);
}

.badge-duckdb {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
}

.search-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.search-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.search-tab.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  font-weight: 600;
  border-bottom: 2px solid #38bdf8;
}

.search-panel-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  width: 100%;
  box-sizing: border-box;
}

.search-sql-textarea {
  width: 100% !important;
  box-sizing: border-box;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  min-height: 110px;
  max-height: 320px;
  resize: vertical;
  background-color: #060913;
  color: #38bdf8;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: block;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-sql-textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.chip-skill-quick {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.12s ease;
}

.chip-skill-quick:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

.search-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.search-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.search-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.search-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.search-card-headline {
  font-size: 12px;
  color: #38bdf8;
  margin-top: 2px;
}

.search-card-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.search-match-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.search-skills-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.search-skill-tag {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
}

.sql-result-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.sql-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: var(--font-mono);
}

.sql-result-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.sql-result-table td {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  white-space: nowrap;
}

.sql-result-table tr:hover td {
  background-color: rgba(56, 189, 248, 0.05);
}

.btn-load-sql-row {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-load-sql-row:hover {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.35);
}

.chip-sql-quick {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.12s ease;
}

.chip-sql-quick:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

/* ==========================================================================
   Confirmation / Data Loss Prevention Modal
   ========================================================================== */
.confirm-modal-backdrop {
  z-index: 600 !important;
}

.confirm-modal-dialog {
  max-width: 500px;
  width: 92%;
  background-color: var(--bg-surface);
  border: 2px solid #f59e0b;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35), 0 25px 50px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeInDown 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.confirm-modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-medium);
  background-color: var(--bg-surface-elevated);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.confirm-modal-body {
  padding: 20px;
  background-color: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.confirm-message-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-primary);
}

.confirm-message-text strong {
  color: #38bdf8;
}

.confirm-submessage-text {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border-left: 3px solid #f59e0b;
}

.confirm-modal-footer {
  padding: 12px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-elevated);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border-color: #d97706;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.btn-warning:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5);
  transform: translateY(-1px);
}

.btn-outline-danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  transition: all 0.15s ease;
}

.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.btn-delete-sql-row {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s ease;
}

.btn-delete-sql-row:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* ==========================================================================
   OCR SMART FILL & TEXT SELECTION TO EDITOR (PREMIUM FEATURE)
   ========================================================================== */

/* Toggle Chip in Modal Toolbar */
.preview-toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-full, 9999px);
  padding: 2px 10px;
  font-size: 11px;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.preview-toggle-chip:hover {
  border-color: #38bdf8;
  color: #f1f5f9;
  background: rgba(56, 189, 248, 0.12);
}

.preview-toggle-chip input[type="checkbox"] {
  accent-color: #38bdf8;
  cursor: pointer;
  width: 12px;
  height: 12px;
}

/* Edit Preview Boxes Overlay */
.edit-boxes-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.edit-boxes-overlay.hidden {
  display: none !important;
}

/* Individual Interactive OCR Box inside Modal */
.edit-ocr-box {
  position: absolute;
  border-radius: 2px;
  pointer-events: auto;
  cursor: copy;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.1s ease;
  border: 1px dashed rgba(56, 189, 248, 0.45);
  background-color: rgba(56, 189, 248, 0.05);
  box-sizing: border-box;
}

.edit-ocr-box.high {
  border-color: rgba(56, 189, 248, 0.4);
  background-color: rgba(56, 189, 248, 0.04);
}

.edit-ocr-box.medium {
  border-color: rgba(245, 158, 11, 0.5);
  background-color: rgba(245, 158, 11, 0.06);
}

.edit-ocr-box.low {
  border-color: rgba(244, 63, 94, 0.6);
  background-color: rgba(244, 63, 94, 0.08);
}

.edit-ocr-box:hover {
  background-color: rgba(56, 189, 248, 0.28) !important;
  border: 1.5px solid #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.65);
  z-index: 30;
  transform: scale(1.02);
}

.edit-ocr-box.selected-box {
  background-color: rgba(99, 102, 241, 0.4) !important;
  border: 2px solid #818cf8 !important;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.85);
  z-index: 35;
}

/* Source Box Transfer Flash Animation */
@keyframes ocrBoxFlashAnim {
  0% {
    background-color: rgba(56, 189, 248, 0.95);
    border-color: #ffffff;
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.9);
    transform: scale(1.08);
  }

  100% {
    background-color: rgba(56, 189, 248, 0.05);
    border-color: rgba(56, 189, 248, 0.45);
    box-shadow: none;
    transform: scale(1);
  }
}

.edit-ocr-box.flash-source {
  animation: ocrBoxFlashAnim 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 40;
}

/* Active Target Field Bar in Modal Form Pane */
.ocr-capture-target-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 14px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.75) 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.2s ease-out;
}

.ocr-target-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.ocr-target-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #38bdf8;
  box-shadow: 0 0 10px #38bdf8;
  animation: targetPulse 1.6s infinite ease-in-out;
}

@keyframes targetPulse {

  0%,
  100% {
    transform: scale(0.9);
    opacity: 0.8;
    box-shadow: 0 0 6px #38bdf8;
  }

  50% {
    transform: scale(1.25);
    opacity: 1;
    box-shadow: 0 0 14px #38bdf8;
  }
}

.ocr-target-label {
  color: var(--text-secondary, #94a3b8);
  font-weight: 500;
}

.ocr-target-name {
  color: #38bdf8;
  font-weight: 700;
  padding: 2px 10px;
  background: rgba(56, 189, 248, 0.14);
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  letter-spacing: 0.2px;
}

.ocr-target-hint {
  font-size: 11px;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 4px;
}

.ocr-target-hint kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 10px;
  color: var(--text-primary, #f1f5f9);
}

/* Highlight Active Input Element */
.form-input.is-active-ocr-target,
.form-textarea.is-active-ocr-target {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25), 0 2px 10px rgba(0, 0, 0, 0.3) !important;
  background-color: rgba(56, 189, 248, 0.03) !important;
  transition: all 0.2s ease;
}

/* Success Glow Animation on Target Input when text is transferred */
@keyframes targetSuccessGlowAnim {
  0% {
    background-color: rgba(16, 185, 129, 0.28);
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.45), 0 0 24px rgba(16, 185, 129, 0.5);
  }

  100% {
    background-color: rgba(56, 189, 248, 0.03);
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
  }
}

.target-transfer-success {
  animation: targetSuccessGlowAnim 0.7s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Floating Action Pill for Multi-box / Lasso Selection */
.ocr-floating-transfer-pill {
  position: absolute;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 9999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 16px rgba(56, 189, 248, 0.3);
  animation: pillFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  pointer-events: auto;
}

@keyframes pillFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pill-preview-snippet {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #f8fafc;
  font-weight: 500;
  padding-right: 4px;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.pill-actions-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill-btn {
  border: none;
  border-radius: 9999px;
  padding: 4px 11px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pill-btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff;
}

.pill-btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
}

.pill-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.pill-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.pill-btn-ghost {
  background: transparent;
  color: #94a3b8;
}

.pill-btn-ghost:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* Lasso Selection Box */
.edit-lasso-selection {
  position: absolute;
  border: 1.5px dashed #38bdf8;
  background-color: rgba(56, 189, 248, 0.2);
  pointer-events: none;
  z-index: 50;
  border-radius: 2px;
}

/* Tooltip for OCR Boxes in Modal */
.edit-ocr-tooltip {
  position: absolute;
  z-index: 1050;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-sm, 6px);
  padding: 6px 10px;
  color: #f1f5f9;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  max-width: 280px;
  animation: fadeIn 0.12s ease-out;
}

.edit-ocr-tooltip .tt-action {
  color: #38bdf8;
  font-weight: 600;
  font-size: 11px;
  margin-top: 4px;
  display: block;
}

/* OCR Transfer Toast Notification */
.ocr-transfer-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #10b981;
  color: #f1f5f9;
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 18px rgba(16, 185, 129, 0.3);
  z-index: 10000;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ocr-transfer-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.ocr-transfer-toast .toast-icon {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

/* Cursor feedback when there is an active OCR target */
.has-active-ocr-target #page-layer-wrapper,
.has-active-ocr-target #edit-pan-container,
.has-active-ocr-target #pdf-canvas,
.has-active-ocr-target #ocr-canvas,
.has-active-ocr-target #image-view,
.has-active-ocr-target #edit-preview-canvas,
.has-active-ocr-target #edit-preview-img,
.has-active-ocr-target .ocr-box,
.has-active-ocr-target .edit-ocr-box {
  cursor: copy !important;
}

/* Make contact rows appear clickable when hovering or in edit mode */
.editing-active .contact-row,
.editing-active .candidate-name,
.editing-active .candidate-headline,
.editing-active .profile-summary-text,
.contact-row:hover {
  cursor: pointer;
}
.contact-row:hover .contact-label {
  color: #38bdf8;
}

/* Active target styling for contenteditable fields (Contact, Headline, Profile) */
.contact-value.is-active-ocr-target,
.candidate-name.is-active-ocr-target,
.candidate-headline.is-active-ocr-target,
.profile-summary-text.is-active-ocr-target {
  border-radius: 4px;
  box-shadow: 0 0 0 2px #38bdf8, 0 0 12px rgba(56, 189, 248, 0.35) !important;
  background-color: rgba(56, 189, 248, 0.14) !important;
  color: #ffffff !important;
  padding: 2px 8px;
  display: inline-block;
  outline: none;
  transition: all 0.2s ease;
}

/* ==========================================================================
   PDF Mode Selector & Reprocess OCR Controls
   ========================================================================== */
.mode-select-container {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  transition: border-color 0.18s ease;
}

.mode-select-container:hover {
  border-color: var(--border-focus);
}

.mode-select-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.mode-select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}

.mode-select option {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.engine-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.2px;
}

.badge-digital {
  background-color: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-ocr {
  background-color: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-reprocess-ocr {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #f59e0b;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  animation: pulseHighlight 2s infinite ease-in-out;
}

.btn-reprocess-ocr:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  color: #fbbf24;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

@keyframes pulseHighlight {
  0%, 100% {
    border-color: rgba(245, 158, 11, 0.45);
  }
  50% {
    border-color: rgba(245, 158, 11, 0.85);
  }
}

/* ==========================================================================
   Synchronized Observation <-> OCR Box <-> Semantic Card Visual Link
   ========================================================================== */
.flag-item.active-flag {
  border-color: rgba(129, 140, 248, 0.85) !important;
  background-color: rgba(99, 102, 241, 0.14) !important;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.45), 0 4px 14px rgba(99, 102, 241, 0.2);
}

.section-card.section-card-linked {
  border-color: rgba(129, 140, 248, 0.65) !important;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.35), 0 0 20px rgba(99, 102, 241, 0.16);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.chip-highlight-pulse {
  border-color: #818cf8 !important;
  background-color: rgba(99, 102, 241, 0.28) !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.8), 0 0 16px rgba(99, 102, 241, 0.55);
  transform: scale(1.06);
  transition: all 0.2s ease;
}

.semantic-linked-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #e0e7ff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(79, 70, 229, 0.25));
  border: 1px solid rgba(129, 140, 248, 0.65);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.35);
  white-space: nowrap;
  animation: fadeInBadge 0.2s ease-out;
}

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

/* ==========================================================================
   Responsive Layout & Laptop Screen Optimization
   ========================================================================== */

/* Standard laptops (1366px, 1440px, or 1080p with 125% Windows scaling) */
@media (max-width: 1520px) {
  .engine-pills {
    display: none;
  }

  .brand-subtitle {
    display: none;
  }

  .app-header {
    padding: 6px 14px;
    gap: 8px 12px;
  }

  .header-actions {
    gap: 8px;
  }

  .viewer-viewport {
    padding: 18px 20px;
  }

  .semantic-body {
    padding: 14px 16px;
  }
}

/* Compact laptop windows & 1280px displays */
@media (max-width: 1240px) {
  .mode-select-label {
    display: none;
  }

  .validation-badge {
    display: none;
  }

  .toolbar-title {
    display: none;
  }

  .toolbar-filename {
    max-width: 160px;
  }

  .btn-compact {
    padding: 5px 10px !important;
    font-size: 12px !important;
  }

  .empty-dropzone {
    padding: 28px 20px;
  }

  .dropzone-actions {
    flex-wrap: wrap;
    justify-content: center;
  }

  .contact-details {
    grid-template-columns: 1fr;
  }
}

/* Narrow windows / split-screen / tablets (< 980px) */
@media (max-width: 980px) {
  body,
  #app-root {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .panel-document {
    border-right: none;
    border-bottom: 1px solid var(--border-medium);
    min-height: 520px;
    max-height: 75vh;
  }

  .panel-semantic {
    height: auto;
    min-height: 500px;
    overflow: visible;
  }

  .semantic-body {
    overflow-y: visible;
  }
}

/* ==========================================================================
   Floating Review & Return-to-Top Dock
   ========================================================================== */

.panel-semantic {
  position: relative;
}

.floating-review-dock {
  position: absolute;
  bottom: 18px;
  right: 22px;
  z-index: 85;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(129, 140, 248, 0.45);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.65), 0 0 16px rgba(99, 102, 241, 0.25);
  animation: fadeInBadge 0.18s ease-out;
}

.dock-active-flag-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dock-obs-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  white-space: nowrap;
}

.dock-obs-badge.high {
  background: rgba(244, 63, 94, 0.16);
  color: #f87171;
  border-color: rgba(244, 63, 94, 0.35);
}

.dock-obs-badge.low {
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
}

.dock-obs-badge.is-resolved {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.dock-divider {
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
  margin: 0 2px;
}

.dock-btn {
  border: 1px solid transparent;
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dock-btn-nav {
  width: 24px;
  height: 24px;
  padding: 0;
  justify-content: center;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.dock-btn-nav:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #ffffff;
  border-color: #818cf8;
}

.dock-btn-resolve {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.dock-btn-resolve:hover {
  background: rgba(16, 185, 129, 0.3);
  color: #ffffff;
  border-color: #10b981;
}

.dock-btn-resolve.resolved {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.dock-btn-top {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.dock-btn-top:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  transform: translateY(-1px);
}

.badge-inline-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 23, 42, 0.55);
  color: #f8fafc;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 9999px;
  cursor: pointer;
  margin-left: 4px;
  transition: all 0.14s ease;
}

.badge-inline-btn.resolve {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(52, 211, 153, 0.6);
  color: #d1fae5;
}

.badge-inline-btn.resolve:hover {
  background: #10b981;
  color: #ffffff;
}

.badge-inline-btn.top:hover {
  background: #6366f1;
  border-color: #a5b4fc;
  color: #ffffff;
}

.dock-obs-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 2px 6px 2px 2px;
  border-radius: 9999px;
  transition: background-color 0.15s ease;
}

.dock-obs-trigger:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.dock-obs-snippet {
  font-size: 11px;
  color: var(--text-secondary);
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1240px) {
  .dock-obs-snippet {
    max-width: 95px;
  }
}

.dock-obs-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 48px);
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(129, 140, 248, 0.55);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.75), 0 0 20px rgba(99, 102, 241, 0.28);
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  z-index: 95;
}

.dock-obs-popover.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  cursor: pointer;
}

.dock-obs-popover.is-visible:hover {
  border-color: #818cf8;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.8), 0 0 24px rgba(129, 140, 248, 0.42);
}

.dock-popover-hint {
  font-size: 10.5px;
  color: #a5b4fc;
  padding-top: 4px;
  border-top: 1px dashed rgba(129, 140, 248, 0.25);
  display: flex;
  align-items: center;
  gap: 4px;
}

.dock-popover-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dock-popover-field {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #a5b4fc;
  font-weight: 500;
}

.dock-popover-counter {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-muted);
}

.dock-popover-message {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-primary);
  font-weight: 500;
}

.dock-popover-note {
  font-size: 11.5px;
  line-height: 1.4;
  color: #34d399;
  background: rgba(16, 185, 129, 0.1);
  border: 1px dashed rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
}

.dock-popover-units {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
}

.dock-popover-units .flag-unit-badge {
  cursor: pointer;
}

/* ==========================================================================
   Light Theme Overrides (html.light / [data-theme="light"])
   ========================================================================== */

html.light,
[data-theme="light"] {
  --bg-app: #eef2f6;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;

  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #4f46e5;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.22);

  --success: #059669;
  --success-bg: #ecfdf5;
  --success-border: #6ee7b7;

  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fcd34d;

  --danger: #e11d48;
  --danger-bg: #fff1f2;
  --danger-border: #fda4af;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.07);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 14px 32px rgba(15, 23, 42, 0.16);
}

/* Header & Global Buttons in Light Mode */
html.light .app-header {
  background-color: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

html.light .badge-version {
  background: #eef2ff;
  color: #3730a3;
  border-color: #a5b4fc;
  font-weight: 700;
}

html.light .engine-pill {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

html.light .header-config-group {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

html.light .switch-slider {
  background-color: #cbd5e1;
  border-color: #94a3b8;
}

html.light .switch-slider::before {
  background-color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25);
}

html.light .btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  border-color: #3730a3;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

html.light .btn-primary:hover {
  background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.4);
}

html.light .btn-secondary {
  background-color: #ffffff;
  border: 1.5px solid #94a3b8;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

html.light .btn-secondary:hover {
  background-color: #f1f5f9;
  border-color: #4f46e5;
  color: #312e81;
}

html.light .btn-success {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: #065f46;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.28);
}

html.light .btn-success:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  color: #ffffff;
}

html.light .btn-icon {
  background-color: #ffffff;
  border: 1.5px solid #94a3b8;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

html.light .btn-icon:hover:not(:disabled) {
  background-color: #eef2ff;
  border-color: #4f46e5;
  color: #312e81;
}

html.light .btn-icon-danger-hover:hover:not(:disabled) {
  color: #be123c !important;
  border-color: #f43f5e !important;
  background-color: #ffe4e6 !important;
}

html.light .btn-icon-sm {
  background-color: #ffffff;
  border: 1px solid #94a3b8;
  color: #1e293b;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

html.light .btn-icon-sm:hover {
  background-color: #eef2ff;
  border-color: #4f46e5;
  color: #312e81;
}

html.light .dropdown-menu {
  background-color: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

html.light .dropdown-item:hover {
  background-color: #eef2ff;
}

/* Document Viewer & Layer Toolbar in Light Mode */
html.light .panel-header {
  background-color: #ffffff;
  border-bottom-color: #cbd5e1;
}

html.light .layer-toolbar {
  background-color: #f8fafc;
  border-bottom-color: #cbd5e1;
  box-shadow: none;
}

html.light .layer-tabs-group {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
  padding: 3px;
}

html.light .layer-tab {
  color: #334155;
  font-weight: 600;
}

html.light .layer-tab:hover:not(.disabled):not(.active) {
  background-color: rgba(255, 255, 255, 0.8);
  color: #0f172a;
}

html.light .layer-tab.active {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(79, 70, 229, 0.35);
}

html.light .layer-toggle-chip {
  background-color: #ffffff;
  border: 1px solid #94a3b8;
  color: #1e293b;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

html.light .layer-toggle-chip:hover {
  background-color: #eef2ff;
  border-color: #4f46e5;
  color: #312e81;
}

html.light .layer-toggle-chip.alert-chip:has(input:checked) {
  background-color: #fff1f2;
  color: #be123c;
  border-color: #f43f5e;
  box-shadow: 0 1px 4px rgba(225, 29, 72, 0.15);
}

html.light .overlay-opacity-container {
  background-color: #ffffff;
  border-color: #94a3b8;
  color: #1e293b;
}

html.light #btn-link-original {
  background-color: #eef2ff;
  border: 1px solid #818cf8;
  color: #3730a3;
  font-weight: 600;
}

html.light #btn-link-original:hover {
  background-color: #4f46e5;
  border-color: #4338ca;
  color: #ffffff;
}

html.light #btn-link-original.linked {
  background-color: #ecfdf5;
  border-color: #34d399;
  color: #047857;
}

html.light .badge-digital {
  background-color: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

html.light .badge-ocr {
  background-color: #d1fae5;
  color: #047857;
  border-color: #6ee7b7;
}

html.light .btn-reprocess-ocr {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #b45309;
  font-weight: 700;
}

html.light .btn-reprocess-ocr:hover {
  background: #d97706;
  border-color: #b45309;
  color: #ffffff;
}

html.light .viewer-viewport {
  background-color: #dfe6ef;
  background-image: radial-gradient(rgba(15, 23, 42, 0.12) 1px, transparent 0);
}

html.light .empty-dropzone {
  background-color: #ffffff;
  border-color: #94a3b8;
  box-shadow: var(--shadow-md);
}

html.light .document-container {
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.1);
}

html.light .viewer-legend {
  background-color: #ffffff;
  border-top-color: #cbd5e1;
  color: #334155;
}

/* Semantic Studio Cards & Editing Controls in Light Mode */
html.light .section-card {
  background-color: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

html.light .section-card:hover {
  border-color: #94a3b8;
  background-color: #ffffff;
}

html.light .section-counter {
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-weight: 600;
}

html.light .btn-add-item {
  background-color: #eef2ff;
  border: 1px solid #818cf8;
  color: #3730a3;
  font-weight: 600;
}

html.light .btn-add-item:hover {
  background-color: #4f46e5;
  border-color: #4338ca;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

html.light .candidate-name {
  color: #0f172a;
}

html.light .candidate-headline {
  color: #4338ca;
  font-weight: 600;
}

html.light .link-badge {
  background: #eef2ff;
  color: #3730a3;
  border-color: #a5b4fc;
  font-weight: 600;
}

html.light .link-badge:hover {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4338ca;
}

html.light .contact-row:hover .contact-label {
  color: #0284c7;
}

html.light .contact-value.is-active-ocr-target,
html.light .candidate-name.is-active-ocr-target,
html.light .candidate-headline.is-active-ocr-target,
html.light .profile-summary-text.is-active-ocr-target {
  background-color: #e0f2fe !important;
  color: #0f172a !important;
  box-shadow: 0 0 0 2px #0284c7, 0 2px 8px rgba(2, 132, 199, 0.2) !important;
}

html.light .job-employer,
html.light .item-card-sub,
html.light .search-card-headline {
  color: #0369a1;
  font-weight: 600;
}

html.light .origin-pill.local {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

html.light .origin-pill.gemini {
  background: #f3e8ff;
  color: #6b21a8;
  border-color: #d8b4fe;
}

html.light .origin-pill.hybrid {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
}

html.light .origin-pill.manual {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

html.light .item-card {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

html.light .item-card:hover {
  background-color: #eef2ff;
  border-color: #6366f1;
}

html.light .item-card-btn {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 2px 6px;
}

html.light .item-card-btn:hover {
  background-color: #eef2ff;
  border-color: #4f46e5;
  color: #312e81;
}

html.light .item-card-btn.delete:hover {
  background-color: #ffe4e6;
  border-color: #f43f5e;
  color: #be123c;
}

html.light .chip {
  background-color: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
  font-weight: 500;
}

html.light .chip:hover {
  background-color: #eef2ff;
  color: #312e81;
  border-color: #4f46e5;
}

html.light .chip-sub {
  background-color: #e2e8f0;
  color: #334155;
  font-weight: 600;
}

html.light .chip-remove-btn {
  background-color: #ffe4e6;
  color: #be123c;
  border: 1px solid #fda4af;
}

html.light .chip-remove-btn:hover {
  background-color: #e11d48;
  color: #ffffff;
}

html.light .job-responsibilities li:hover {
  background-color: #eef2ff;
  color: #0f172a;
}

html.light .alert-card {
  background-color: #fffbeb;
  border-color: #fcd34d;
}

html.light .text-warning {
  color: #b45309 !important;
}

html.light .unassigned-item {
  background-color: #ffffff;
  border: 1px solid #fde68a;
  color: #0f172a;
}

html.light .unassigned-item:hover {
  background-color: #fef3c7;
  border-color: #f59e0b;
}

html.light .unassigned-reason {
  color: #b45309;
  font-weight: 600;
}

/* Review Flags & Observations in Light Mode */
html.light .status-indicator-badge {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

html.light .status-indicator-badge.needs_review {
  background-color: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

html.light .status-indicator-badge.auto_accepted {
  background-color: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

html.light .status-indicator-badge.user-modified {
  background-color: #eef2ff;
  border-color: #6366f1;
  color: #3730a3;
}

html.light .review-flags-container {
  background-color: #fffbeb;
  border-color: #f59e0b;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.08);
}

html.light .review-flags-container.all-resolved {
  background-color: #ecfdf5;
  border-color: #10b981;
}

html.light .flags-header {
  color: #92400e;
}

html.light .review-flags-container.all-resolved .flags-header {
  color: #065f46;
}

html.light .flags-filter-group {
  background: rgba(255, 255, 255, 0.75);
  border-color: #fcd34d;
}

html.light .flags-filter-btn {
  color: #78350f;
  font-weight: 600;
}

html.light .flags-filter-btn:hover {
  background: rgba(245, 158, 11, 0.15);
  color: #451a03;
}

html.light .flags-filter-btn.active {
  background: #d97706;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(180, 83, 9, 0.3);
}

html.light .flag-item {
  border-top-color: rgba(217, 119, 6, 0.22);
}

html.light .flag-item:hover {
  background-color: rgba(245, 158, 11, 0.14);
}

html.light .flag-item.active-flag {
  background-color: #eef2ff !important;
  border-color: #4f46e5 !important;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.3), 0 4px 10px rgba(79, 70, 229, 0.12);
}

html.light .flag-severity.high {
  background: #ffe4e6;
  color: #be123c;
  border-color: #fda4af;
}

html.light .flag-severity.medium {
  background: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
}

html.light .flag-severity.low {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

html.light .flag-status-badge.resolved {
  background-color: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
}

html.light .flag-note-pill {
  background: #ffffff;
  border: 1px dashed #94a3b8;
  color: #334155;
}

html.light .flag-unit-badge {
  color: #0369a1;
  background-color: #e0f2fe;
  border-color: #7dd3fc;
}

html.light .flag-item:hover .flag-unit-badge {
  background-color: #0284c7;
  border-color: #0369a1;
  color: #ffffff;
}

html.light .btn-resolve-flag {
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #34d399;
  font-weight: 700;
}

html.light .btn-resolve-flag:hover {
  background: #059669;
  color: #ffffff;
  border-color: #047857;
}

html.light .btn-edit-flag {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #94a3b8;
  font-weight: 600;
}

html.light .btn-edit-flag:hover {
  background: #eef2ff;
  color: #312e81;
  border-color: #4f46e5;
}

html.light .semantic-linked-badge {
  color: #312e81;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-color: #818cf8;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

html.light .badge-inline-btn {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #818cf8;
  font-weight: 700;
}

html.light .badge-inline-btn.resolve {
  background: #d1fae5;
  color: #065f46;
  border-color: #34d399;
}

html.light .badge-inline-btn.resolve:hover {
  background: #059669;
  color: #ffffff;
}

/* Floating Review Dock & Popover in Light Mode */
html.light .floating-review-dock {
  background: rgba(255, 255, 255, 0.98);
  border-color: #818cf8;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(79, 70, 229, 0.15);
}

html.light .dock-obs-trigger:hover {
  background-color: #f1f5f9;
}

html.light .dock-obs-badge {
  color: #92400e;
  background: #fef3c7;
  border-color: #f59e0b;
}

html.light .dock-obs-badge.high {
  color: #be123c;
  background: #ffe4e6;
  border-color: #fda4af;
}

html.light .dock-obs-badge.low {
  color: #0369a1;
  background: #e0f2fe;
  border-color: #7dd3fc;
}

html.light .dock-obs-badge.is-resolved {
  color: #065f46;
  background: #d1fae5;
  border-color: #6ee7b7;
}

html.light .dock-btn-nav {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #94a3b8;
  font-weight: 700;
}

html.light .dock-btn-nav:hover {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4338ca;
}

html.light .dock-btn-resolve {
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #34d399;
  font-weight: 700;
}

html.light .dock-btn-resolve:hover {
  background: #059669;
  color: #ffffff;
  border-color: #047857;
}

html.light .dock-btn-resolve.resolved {
  background: #f1f5f9;
  color: #334155;
  border-color: #94a3b8;
}

html.light .dock-obs-popover {
  background: #ffffff;
  border: 1.5px solid #6366f1;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(79, 70, 229, 0.15);
}

html.light .dock-popover-field {
  color: #4338ca;
  font-weight: 600;
}

html.light .dock-popover-note {
  color: #065f46;
  background: #ecfdf5;
  border-color: #6ee7b7;
}

html.light .dock-popover-hint {
  color: #4338ca;
  font-weight: 600;
}

/* ==========================================================================
   Edit Modal (#edit-modal) & General Modals in Light Mode
   ========================================================================== */
html.light .modal-backdrop {
  background-color: rgba(15, 23, 42, 0.55);
}

html.light .modal-dialog {
  background-color: #ffffff;
  border: 1px solid #94a3b8;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

html.light .modal-header,
html.light .modal-footer {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

html.light .modal-title {
  color: #0f172a;
  font-weight: 700;
}

html.light .modal-body {
  background-color: #f8fafc;
}

html.light .json-code {
  color: #0f172a;
}

/* Edit Modal Section Badges & Document Reference Tag */
html.light .preview-doc-tag {
  background-color: #eef2ff;
  border: 1px solid #818cf8;
  color: #3730a3;
  font-weight: 600;
}

html.light .modal-section-badge {
  background-color: #eef2ff;
  border: 1px solid #818cf8;
  color: #3730a3;
  font-weight: 600;
}

html.light .modal-section-badge.section-exp,
html.light .modal-section-badge.section-cert {
  background-color: #e0f2fe;
  border-color: #38bdf8;
  color: #0369a1;
}

html.light .modal-section-badge.section-edu,
html.light .modal-section-badge.section-interest {
  background-color: #f3e8ff;
  border-color: #c084fc;
  color: #6b21a8;
}

html.light .modal-section-badge.section-skills {
  background-color: #d1fae5;
  border-color: #34d399;
  color: #065f46;
}

html.light .modal-section-badge.section-lang,
html.light .modal-section-badge.section-award {
  background-color: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

html.light .modal-section-badge.section-proj {
  background-color: #fce7f3;
  border-color: #f472b6;
  color: #9d174d;
}

html.light .modal-section-label {
  color: #475569;
  font-weight: 600;
}

/* Edit Modal Left Preview Pane & Toolbar Controls */
html.light .modal-preview-pane {
  background-color: #dfe6ef;
  border-right: 1px solid #cbd5e1;
}

html.light .preview-pane-toolbar {
  background-color: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  color: #334155;
}

html.light .preview-pane-title {
  color: #0f172a;
  font-weight: 600;
}

html.light .preview-section-target {
  background-color: #e0e7ff;
  border: 1px solid #818cf8;
  color: #312e81;
  font-weight: 600;
}

html.light .preview-toggle-chip {
  background: #ffffff;
  border: 1.5px solid #64748b;
  color: #0f172a;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

html.light .preview-toggle-chip:hover {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0369a1;
}

html.light .preview-toggle-chip input[type="checkbox"] {
  accent-color: #0284c7;
}

html.light .preview-zoom-controls {
  background-color: #e2e8f0;
  border: 1px solid #94a3b8;
  padding: 2px 5px;
}

html.light .preview-zoom-indicator,
html.light .preview-page-indicator {
  color: #0f172a;
  font-weight: 700;
}

html.light .btn-icon-xs {
  background-color: #ffffff;
  border: 1px solid #64748b;
  color: #0f172a;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

html.light .btn-icon-xs:hover {
  background-color: #4f46e5;
  border-color: #3730a3;
  color: #ffffff;
}

html.light #edit-preview-canvas,
html.light #edit-preview-img {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18), 0 0 0 1px #cbd5e1;
}

/* Edit Modal Right Form Pane, Target Bar, Inputs & Floating Transfer Pill */
html.light .modal-form-pane {
  background-color: #ffffff;
}

html.light .edit-form-section-banner {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

html.light .edit-form-section-banner .banner-title strong {
  color: #312e81;
}

html.light .ocr-capture-target-bar {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #38bdf8;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.1);
}

html.light .ocr-target-label {
  color: #0f172a;
  font-weight: 600;
}

html.light .ocr-target-name {
  background: #ffffff;
  color: #0369a1;
  border-color: #0284c7;
}

html.light .ocr-target-hint {
  color: #334155;
}

html.light .ocr-target-hint kbd {
  background: #ffffff;
  border: 1px solid #64748b;
  color: #0f172a;
  font-weight: 700;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.1);
}

html.light .form-label {
  color: #1e293b;
  font-weight: 600;
}

html.light .form-input,
html.light .form-textarea,
html.light .form-select {
  background-color: #ffffff;
  border: 1.5px solid #94a3b8;
  color: #0f172a;
}

html.light .form-input::placeholder,
html.light .form-textarea::placeholder {
  color: #64748b;
}

html.light .form-input:focus,
html.light .form-textarea:focus,
html.light .form-select:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

html.light .form-input.is-active-ocr-target,
html.light .form-textarea.is-active-ocr-target {
  border-color: #0284c7 !important;
  background-color: #f0f9ff !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2), 0 2px 6px rgba(15, 23, 42, 0.06) !important;
}

html.light .ocr-floating-transfer-pill {
  background: rgba(255, 255, 255, 0.98);
  border: 1.5px solid #0284c7;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(2, 132, 199, 0.15);
}

html.light .pill-preview-snippet {
  color: #0f172a;
  border-right: 1px solid #cbd5e1;
  font-weight: 600;
}

html.light .pill-btn-secondary {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #64748b;
  font-weight: 700;
}

html.light .pill-btn-secondary:hover {
  background: #e2e8f0;
  border-color: #334155;
  color: #0f172a;
}

html.light .pill-btn-ghost {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #94a3b8;
  font-weight: 600;
}

html.light .pill-btn-ghost:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #475569;
}

html.light .edit-ocr-tooltip {
  background: rgba(255, 255, 255, 0.98);
  border-color: #0284c7;
  color: #0f172a;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

html.light .edit-ocr-tooltip .tt-action {
  color: #0369a1;
}

html.light .ocr-transfer-toast {
  background: #ffffff;
  border: 1.5px solid #059669;
  color: #0f172a;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
}

/* Flag Resolution Modal, DuckDB Search Modal & Confirm Modal in Light Mode */
html.light .flag-modal-detail-card {
  background: #f8fafc;
  border-color: #cbd5e1;
}

html.light .chip-flag-quick {
  background: #f8fafc;
  border: 1px solid #94a3b8;
  color: #1e293b;
  font-weight: 500;
}

html.light .chip-flag-quick:hover {
  background: #eef2ff;
  border-color: #4f46e5;
  color: #312e81;
}

html.light #btn-reopen-flag {
  background: #fff1f2 !important;
  color: #be123c !important;
  border-color: #f43f5e !important;
  font-weight: 600;
}

html.light #btn-reopen-flag:hover {
  background: #e11d48 !important;
  color: #ffffff !important;
}

html.light #flag-modal-history {
  background: #f0f9ff !important;
  border-left-color: #0284c7 !important;
  color: #1e293b !important;
}

html.light .search-modal-dialog {
  border-color: #0284c7;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

html.light .badge-duckdb {
  background: #fef3c7;
  color: #92400e;
  border-color: #f59e0b;
}

html.light .search-tab {
  color: #475569;
  font-weight: 600;
}

html.light .search-tab:hover {
  background: #f1f5f9;
  color: #0f172a;
}

html.light .search-tab.active {
  color: #0369a1;
  background: #e0f2fe;
  border-bottom: 2px solid #0284c7;
}

html.light .search-panel-box {
  background: #f8fafc;
  border-color: #cbd5e1;
}

html.light .search-sql-textarea {
  background-color: #ffffff;
  border-color: #94a3b8;
  color: #0f172a;
}

html.light .chip-skill-quick,
html.light .chip-sql-quick {
  background: #ffffff;
  border: 1px solid #94a3b8;
  color: #1e293b;
  font-weight: 600;
}

html.light .chip-skill-quick:hover,
html.light .chip-sql-quick:hover {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #0284c7;
}

html.light .search-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

html.light .search-card:hover {
  border-color: #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.12);
}

html.light .search-match-badge {
  background: #d1fae5;
  color: #065f46;
  border-color: #6ee7b7;
}

html.light .search-skill-tag {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
  font-weight: 500;
}

html.light .sql-result-table td {
  border-bottom-color: #e2e8f0;
}

html.light .btn-load-sql-row {
  background: #e0f2fe;
  border: 1px solid #0284c7;
  color: #0369a1;
  font-weight: 700;
}

html.light .btn-load-sql-row:hover {
  background: #0284c7;
  color: #ffffff;
}

html.light .btn-outline-danger,
html.light .btn-delete-sql-row {
  background: #fff1f2;
  border: 1px solid #f43f5e;
  color: #be123c;
  font-weight: 600;
}

html.light .btn-outline-danger:hover,
html.light .btn-delete-sql-row:hover {
  background: #e11d48;
  border-color: #be123c;
  color: #ffffff;
}

html.light .confirm-modal-dialog {
  border-color: #d97706;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

html.light .confirm-message-text strong {
  color: #0369a1;
}

html.light .confirm-submessage-text {
  background: #fffbeb;
  color: #78350f;
  border-left-color: #d97706;
}

html.light .loading-overlay {
  background-color: rgba(241, 245, 249, 0.85);
}




