:root {
  --bg-primary: #0f172a;
  --bg-secondary: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-color: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.15);
  --success-color: #3b82f6;
  --success-glow: rgba(59, 130, 246, 0.15);
  --error-color: #ef4444;
  --warning-color: #d97706;
  --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 16px;
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-glass: rgba(15, 23, 42, 0.6);
  --input-bg: rgba(15, 23, 42, 0.5);
  --modal-overlay: rgba(0, 0, 0, 0.75);
  transition: background-color 0.3s ease, color 0.3s ease;
}

@keyframes garfieldPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7);
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
  }
  50% {
    transform: scale(1.18);
    box-shadow: 0 0 0 14px rgba(139, 92, 246, 0);
    filter: drop-shadow(0 0 18px rgba(139, 92, 246, 0.95));
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
  }
}

.garfield-btn-logo.pulsating-garfield {
  animation: garfieldPulse 1.2s infinite ease-in-out !important;
}

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --border-color: rgba(0, 0, 0, 0.15);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent-color: #4f46e5;
  --accent-glow: rgba(79, 70, 229, 0.15);
  --success-color: #3b82f6;
  --success-glow: rgba(59, 130, 246, 0.15);
  --error-color: #dc2626;
  --warning-color: #b45309;
  --card-bg: #ffffff;
  --card-glass: rgba(255, 255, 255, 0.95);
  --input-bg: #ffffff;
  --modal-overlay: rgba(15, 23, 42, 0.4);
}

@keyframes thumbnailPop {
  0% {
    opacity: 0;
    transform: scale(0.6) translateY(15px);
  }
  60% {
    opacity: 1;
    transform: scale(1.08) translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.new-thumbnail-anim {
  animation: thumbnailPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

html, body {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden !important;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  position: relative;
}

/* Layout */
.app-container {
  max-width: 1250px;
  height: 100vh;
  max-height: 100vh;
  margin: 0 auto;
  padding: 1rem 1.25rem 0.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
}

main.dashboard-layout {
  flex: 1 1 0px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
}

.header-hr {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 0 0 1.25rem 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.watcher-controls-top {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.watcher-controls-top.power-on-container {
  background: transparent !important;
  border-color: transparent !important;
}

.header-collapsible-item {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  max-width: 160px;
  opacity: 1;
  transition: max-width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease,
              margin 0.3s ease,
              padding 0.3s ease,
              border-width 0.3s ease;
  white-space: nowrap;
}

.header-collapsible-item.collapsed {
  max-width: 0 !important;
  opacity: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  border-width: 0 !important;
  pointer-events: none !important;
}

.watcher-controls-top .control-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.watcher-controls-top label {
  font-size: 0.8rem;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-muted);
}

.watcher-controls-top input,
.watcher-controls-top select {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.3s ease;
}

body.power-active #watcher-interval {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #10b981 !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.8), 0 0 4px rgba(16, 185, 129, 0.5) !important;
  font-weight: 700 !important;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 16px var(--accent-glow);
}

.logo-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--success-color), #059669);
  color: white;
  box-shadow: 0 4px 14px var(--success-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--success-glow);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--success-glow);
  color: var(--success-color);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-secondary:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.5);
}

.btn-text {
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
}

.btn-text:hover {
  color: var(--text-main);
}

/* Cards */
.card {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

body.power-active .card {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 20px var(--success-glow), 0 8px 32px rgba(0, 0, 0, 0.35);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Dashboard Layout */
.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex-grow: 1;
  width: 100%;
}

/* Single Unified Panel containing both Thumbnails and Processing Drop Zone */
.thumbnails-panel {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  align-items: stretch;
  min-height: 440px;
  width: 100%;
}

.thumbnails-panel .thumb-col {
  width: 270px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.thumbnails-panel .processing-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Status metrics */
.status-indicator {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-indicator.online {
  background-color: var(--success-glow);
  color: var(--success-color);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-indicator.working {
  background-color: var(--accent-glow);
  color: var(--accent-color);
  border: 1px solid rgba(99, 102, 241, 0.3);
  animation: pulse 1.5s infinite;
}

.status-indicator.offline {
  background-color: rgba(239, 68, 68, 0.15);
  color: var(--error-color);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1.5rem;
}

.metric {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  transition: color 0.3s ease;
}

body.power-active #next-sync-countdown {
  color: var(--warning-color);
}

/* Forms */
.config-form {
  display: flex;
  flex-direction: row;
  gap: 20px;
  width: 100%;
}

.config-form > div {
  flex: 1 1 0px;
  min-width: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

input, select {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select option {
  background: #0f172a;
  color: #f8fafc;
}

small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Console Panel */
.console-panel {
  display: flex;
  flex-direction: column;
}

.card-console {
  flex-grow: 1;
  height: 100%;
  padding: 0.6rem 1rem;
  gap: 0.4rem;
}

.console-body {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  border-radius: 10px;
  padding: 0.4rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.81rem;
  line-height: 1.35;
  flex-grow: 1;
  min-height: 240px;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: #1e293b;
}

.log-line {
  word-break: break-all;
}

.log-line.system-msg {
  color: #6d28d9;
  font-weight: 600;
}

.log-line.info-msg {
  color: #334155;
}

.log-line.success-msg {
  color: #047857;
  font-weight: 600;
}

.log-line.error-msg {
  color: #b91c1c;
  font-weight: 600;
}

.log-line.warning-msg {
  color: #b45309;
  font-weight: 600;
}

/* Footer */
.app-footer {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  border-top: none;
  background: transparent;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  flex: 0 0 auto;
}

/* Animations */
@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.spinner-icon {
  width: 18px;
  height: 18px;
}

.btn-primary.loading .spinner-icon {
  animation: spin 1s linear infinite;
}

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

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.7);
}

/* Explicit Category List Prominent Scrollbar */
#categories-crud-list::-webkit-scrollbar {
  width: 8px;
}
#categories-crud-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
}
#categories-crud-list::-webkit-scrollbar-thumb {
  background: #3b82f6 !important;
  border-radius: 4px;
}
#categories-crud-list::-webkit-scrollbar-thumb:hover {
  background: #2563eb !important;
}

/* Switch toggle styling */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.08);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-color);
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-main);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

input:checked + .slider {
  background-color: var(--success-color);
  border-color: rgba(59, 130, 246, 0.5);
}

.switch-purple input:checked + .slider {
  background-color: #8b5cf6 !important;
  border-color: rgba(139, 92, 246, 0.5) !important;
}

.switch-purple input:focus + .slider {
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25) !important;
}

/* Uniform Dashboard Radio Button & Pulse Ring Centering */
.radio-pulse-wrapper {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 16px !important;
  height: 16px !important;
  vertical-align: middle !important;
  overflow: visible !important;
}

.radio-pulse-wrapper input[type="radio"] {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
  border: 2px solid var(--border-color) !important;
  background-color: var(--bg-primary) !important;
  outline: none !important;
  cursor: pointer !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  position: relative !important;
  z-index: 2 !important;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.radio-pulse-wrapper input[type="radio"]:checked {
  border-color: #3b82f6 !important;
  background-color: #3b82f6 !important;
  box-shadow: inset 0 0 0 2.5px #ffffff !important;
}

.radio-pulse-wrapper input[type="radio"].sending-active {
  border-color: #8b5cf6 !important;
}

.radio-pulse-wrapper input[type="radio"].sending-active:checked {
  background-color: #8b5cf6 !important;
  box-shadow: inset 0 0 0 2.5px #ffffff !important;
}

/* Sub-Pixel Centered Overlay Pulse Ring (z-index 5 renders ABOVE radio input) */
.radio-pulse-wrapper .radio-pulse-ring {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
  border: 2px solid #8b5cf6 !important;
  transform: translate(-50%, -50%) scale(1) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: 5 !important;
  box-sizing: border-box !important;
}

.radio-pulse-wrapper.is-sending .radio-pulse-ring {
  animation: centeredRadioPulse 1.8s cubic-bezier(0, 0, 0.2, 1) infinite !important;
}

@keyframes centeredRadioPulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.95;
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.8);
  }
  60% {
    transform: translate(-50%, -50%) scale(1.75);
    opacity: 0.4;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
  }
  100% {
    transform: translate(-50%, -50%) scale(2.4);
    opacity: 0;
    box-shadow: 0 0 0px rgba(139, 92, 246, 0);
  }
}

.switch-blue input:focus + .slider {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25) !important;
}

.switch-blue input:checked + .slider {
  background-color: #3b82f6 !important;
  border-color: rgba(59, 130, 246, 0.5) !important;
}

input:focus + .slider {
  box-shadow: 0 0 0 2px var(--success-glow);
}


/* Live Push Pulse Animation & Shimmer */
.pulse-ring-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #3b82f6;
  display: inline-block;
}

.pulse-ring-dot::after {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #3b82f6;
  animation: pulsePing 2s cubic-bezier(0, 0, 0.2, 1) infinite;
  opacity: 0;
}

@keyframes pulsePing {
  0% {
    transform: scale(0.5);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.4);
    opacity: 0.4;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

@keyframes metricFlowGlow {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.sending-active-shimmer {
  background: linear-gradient(90deg, transparent 0%, rgba(59, 130, 246, 0.07) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: metricFlowGlow 3.5s infinite linear;
}

/* Radio Control Button Live Pulse Glow Animation (Purple & Pixel-Perfect Centered) */
input[type="radio"].radio-live-pulse-active {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 14px !important;
  height: 14px !important;
  border-radius: 50% !important;
  border: 2px solid #8b5cf6 !important;
  background-color: #ffffff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  outline: none !important;
  cursor: pointer !important;
  vertical-align: middle !important;
  margin: 0 4px 0 0 !important;
  box-sizing: border-box !important;
}

input[type="radio"].radio-live-pulse-active:checked {
  background-color: #8b5cf6 !important;
  box-shadow: inset 0 0 0 2px #ffffff !important;
}

input[type="radio"].radio-live-pulse-active::after {
  content: '' !important;
  position: absolute !important;
  top: -3px !important;
  left: -3px !important;
  width: 20px !important;
  height: 20px !important;
  border-radius: 50% !important;
  border: 2px solid #8b5cf6 !important;
  animation: radioPulseGlow 1.8s cubic-bezier(0, 0, 0.2, 1) infinite !important;
  pointer-events: none !important;
  box-sizing: border-box !important;
}

@keyframes radioPulseGlow {
  0% {
    transform: scale(0.65);
    opacity: 0.95;
  }
  60% {
    transform: scale(1.3);
    opacity: 0.35;
  }
  100% {
    transform: scale(1.75);
    opacity: 0;
  }
}

input:checked + .slider:before {
  transform: translateX(22px);
  background-color: white;
}

.slider.round {
  border-radius: 22px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Small button styling */
.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
  gap: 0.35rem;
}

/* Hide number input stepper arrows */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
}

/* Modal configuration popup */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

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

.modal-overlay .card-config {
  width: 90%;
  max-width: 500px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Validation Loading Overlay */
.validation-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius);
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.validation-loading-overlay.show {
  display: flex;
}

/* Spinner */
.loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.08);
  border-left-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text-main);
}

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

/* Info / Workflow Demographic Modal Styles */
.card-info {
  width: 95%;
  max-width: 950px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: modalFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.info-intro {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.workflow-steps {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1rem;
}

.workflow-step {
  flex: 1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.workflow-step:hover {
  transform: translateY(-4px);
  border-color: var(--accent-color);
  background: rgba(99, 102, 241, 0.05);
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-color), #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.step-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.step-content p {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.workflow-arrow {
  color: var(--text-muted);
  font-size: 1.5rem;
  align-self: center;
  opacity: 0.5;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .workflow-steps {
    flex-direction: column;
    gap: 1.5rem;
    align-items: stretch;
  }
  .workflow-arrow {
    transform: rotate(90deg);
    margin: 0;
    align-self: center;
  }
}

/* Validation Indicator Icons */
.val-indicator {
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: scale(0.8);
}
.val-indicator.success,
.tab-check-mark,
.env-val-indicator {
  opacity: 1;
  color: #10b981 !important;
  transform: scale(1);
}
.val-indicator.error {
  opacity: 1;
  color: var(--error-color);
  transform: scale(1);
}

/* Workflow Step Enhancements */
.step-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.step-icon {
  width: 24px;
  height: 24px;
  color: var(--accent-color);
  opacity: 0.85;
}

.step-detail {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.75rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.step-detail strong {
  color: var(--text-muted);
}

.step-detail-val {
  color: var(--text-main);
  word-break: break-all;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.step-link {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  display: inline-block;
}


.form-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.config-tab-btn {
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.2s ease, border-color 0.2s ease;
}

.config-tab-btn:hover {
  transform: translateY(-2px) scale(1.03);
  color: #3b82f6 !important;
}

.config-tab-btn:active {
  transform: translateY(0) scale(0.98);
}

input, select, textarea {
  caret-color: #10b981;
  animation: cursorPulse 1.2s ease-in-out infinite alternate;
}

@keyframes cursorPulse {
  from {
    caret-color: #10b981;
  }
  to {
    caret-color: #059669;
  }
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select {
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  caret-color: #10b981;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #10b981 !important;
}

.config-modal-body,
.config-tab-content {
  padding-left: 2.75rem !important; /* +20px horizontal padding */
  padding-right: 2.75rem !important; /* +20px horizontal padding */
}

.config-modal-body input[type="text"],
.config-modal-body input[type="email"],
.config-modal-body input[type="password"],
.config-modal-body input[type="number"],
.config-modal-body select,
.config-tab-content input[type="text"],
.config-tab-content input[type="email"],
.config-tab-content input[type="password"],
.config-tab-content input[type="number"],
.config-tab-content select {
  max-width: 90% !important; /* reduced width by 10% */
}

.field-validated,
input.field-validated,
select.field-validated {
  background-color: rgba(59, 130, 246, 0.12) !important;
  border-color: #3b82f6 !important;
  color: var(--text-main) !important;
}

.form-actions {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 0.75rem !important;
  width: 100% !important;
  margin: 0 auto !important;
}

[data-theme="light"] .logo-text h1,
[data-theme="light"] #org-name-text,
[data-theme="light"] #status-org-name,
[data-theme="light"] #org-name {
  color: #000000 !important;
  background: none !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: #000000 !important;
}

.config-tab-btn {
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              margin 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.2s ease,
              border-color 0.2s ease !important;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
}

.config-tab-btn.tab-hidden {
  opacity: 0 !important;
  max-width: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  transform: scaleX(0.8) translateY(-4px);
  pointer-events: none !important;
}

.config-tab-btn.tab-visible {
  opacity: 1 !important;
  max-width: 150px !important;
  transform: scaleX(1) translateY(0);
}

/* Button hover effects — subtle shift for enabled, nothing for disabled */
.btn {
  transition: transform 0.15s ease;
}

.btn:not(:disabled):hover {
  transform: translateY(-2px);
}

.btn:not(:disabled):active {
  transform: translateY(0);
}

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

.btn:disabled:hover {
  transform: none;
}

/* ============================================================
   Extraction sidebar panel (preview modal)
   ============================================================ */
.extraction-panel {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  padding: 1rem;
  overflow-y: auto;
  gap: 0.5rem;
  animation: slideInRight 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.extraction-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  flex-shrink: 0;
}

/* Container for all chips grouped by field */
.extraction-chips-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  overflow-y: auto;
}

.chip-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.chip-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Individual data chip */
.data-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  border: 1.5px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-main);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.1s;
  word-break: break-word;
  white-space: normal;
  text-align: left;
  width: 100%;
}

.data-chip:hover {
  border-color: var(--accent-color);
  background: var(--accent-glow);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.data-chip.selected {
  border-color: var(--success-color);
  background: var(--success-glow);
  color: var(--success-color);
  box-shadow: 0 2px 8px var(--success-glow);
}

.data-chip.risk-chip {
  border-color: rgba(239,68,68,0.35);
  color: var(--error-color);
  background: rgba(239,68,68,0.05);
}

.data-chip.risk-chip:hover {
  border-color: var(--error-color);
  background: rgba(239,68,68,0.12);
}

.data-chip.risk-chip.selected {
  border-color: var(--error-color);
  background: rgba(239,68,68,0.18);
  box-shadow: 0 2px 8px rgba(239,68,68,0.2);
}

/* Copy confirmation flash on chip */
@keyframes chipFlash {
  0%   { opacity: 1; }
  40%  { opacity: 0.4; }
  100% { opacity: 1; }
}
.data-chip.copied {
  animation: chipFlash 0.4s ease;
}

/* ============================================================
   GEMINI INSTRUCTIONS PANEL
   ============================================================ */
.gemini-instr-panel {
  margin: 0 0 1.25rem 0;
  border-radius: 14px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(99, 102, 241, 0.04);
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.gemini-instr-panel:focus-within {
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

/* Toggle / header button */
.gemini-instr-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  color: var(--text-main);
  transition: background 0.2s;
}

.gemini-instr-toggle:hover {
  background: rgba(99, 102, 241, 0.06);
}

.gemini-instr-toggle-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.gemini-instr-icon {
  width: 18px;
  height: 18px;
  color: var(--accent-color);
  flex-shrink: 0;
}

.gemini-instr-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.gemini-instr-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.gemini-instr-toggle-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Chevron */
.gemini-instr-chevron {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.gemini-instr-panel.collapsed .gemini-instr-chevron {
  transform: rotate(180deg);
}

/* Char counter */
.gemini-instr-char-count {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.2s;
}

.gemini-instr-char-count.near-limit {
  color: var(--warning-color);
}

.gemini-instr-char-count.at-limit {
  color: var(--error-color);
  font-weight: 700;
}

/* Saved badge */
.gemini-instr-saved-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--success-color);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 99px;
  padding: 2px 8px;
  animation: savedFadeIn 0.3s ease;
  white-space: nowrap;
}

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

/* Body accordion */
.gemini-instr-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.gemini-instr-panel.collapsed .gemini-instr-body {
  grid-template-rows: 0fr;
}

.gemini-instr-body-inner {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Textarea */
.gemini-instr-textarea {
  width: 100%;
  min-height: 110px;
  max-height: 340px;
  resize: vertical;
  padding: 0.85rem 1.1rem;
  border: none;
  border-top: 1px solid rgba(99, 102, 241, 0.15);
  background: transparent;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  line-height: 1.6;
  outline: none;
  transition: background 0.2s;
  caret-color: var(--accent-color);
}

.gemini-instr-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
  font-style: italic;
}

.gemini-instr-textarea:focus {
  background: rgba(99, 102, 241, 0.04);
}

/* Footer row */
.gemini-instr-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 1.1rem 0.65rem;
  border-top: 1px solid rgba(99, 102, 241, 0.1);
}

.gemini-instr-hint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Light-mode overrides */
[data-theme="light"] .gemini-instr-panel {
  background: rgba(79, 70, 229, 0.03);
  border-color: rgba(79, 70, 229, 0.2);
}

[data-theme="light"] .gemini-instr-textarea {
  color: #0f172a;
}

/* ============================================================
   DRAG & DROP ZONE
   ============================================================ */
.doc-drop-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 1rem;
  min-height: 160px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: transparent;
  overflow: hidden;
  cursor: default;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s, transform 0.25s;
  padding: 2rem 1rem;
}

@keyframes purplePulse {
  0% {
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.75), 0 0 3px rgba(139, 92, 246, 0.5);
    border-color: #8b5cf6 !important;
  }
  100% {
    box-shadow: 0 0 24px rgba(139, 92, 246, 0.95), 0 0 10px rgba(168, 85, 247, 0.75);
    border-color: #c084fc !important;
  }
}

.doc-thumb-card.unprocessed-purple-glow {
  border: 2px solid #8b5cf6 !important;
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.8), 0 0 4px rgba(139, 92, 246, 0.5) !important;
  animation: purplePulse 1.8s infinite alternate !important;
}

/* Hover-activated garbage can delete icon on document thumbnails */
.delete-doc-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(15, 23, 42, 0.65) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease, transform 0.15s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0;
}

.doc-thumb-card:hover .delete-doc-btn {
  opacity: 1;
}

.delete-doc-btn:hover {
  background: rgba(239, 68, 68, 0.9) !important;
  border-color: rgba(239, 68, 68, 1) !important;
  transform: scale(1.1);
}

#dashboard-webhook-url,
#dashboard-webhook-secret {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 2px solid #10b981 !important;
  border-radius: 8px;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#dashboard-webhook-url:focus,
#dashboard-webhook-secret:focus {
  border-color: #059669 !important;
  box-shadow: 0 0 0 3.5px rgba(16, 185, 129, 0.25) !important;
  outline: none;
}

.doc-drop-zone.drop-over {
  border-color: rgba(99, 102, 241, 0.9);
  background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.18) 0%, rgba(139, 92, 246, 0.08) 60%, transparent 100%);
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.3), inset 0 0 30px rgba(99, 102, 241, 0.1);
  transform: scale(1.01);
}

/* Pulsing rings */
.drop-zone-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(99, 102, 241, 0.15);
  pointer-events: none;
  animation: ringPulse 3s ease-in-out infinite;
}

.drop-zone-ring-1 { width: 200px; height: 200px; animation-delay: 0s; }
.drop-zone-ring-2 { width: 340px; height: 340px; animation-delay: 0.7s; }
.drop-zone-ring-3 { width: 480px; height: 480px; animation-delay: 1.4s; }

@keyframes ringPulse {
  0%, 100% { opacity: 0.2; transform: scale(0.95); }
  50%       { opacity: 0.6; transform: scale(1.05); }
}

.doc-drop-zone.drop-over .drop-zone-ring {
  border-color: rgba(99, 102, 241, 0.5);
  animation-duration: 0.8s;
}

/* Upload icon */
.drop-zone-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}

.doc-drop-zone.drop-over .drop-zone-icon-wrap {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.7);
  transform: scale(1.12) translateY(-4px);
}

.drop-zone-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-color);
  transition: color 0.3s;
}

.doc-drop-zone.drop-over .drop-zone-icon {
  color: #818cf8;
  animation: uploadBounce 0.5s ease-in-out infinite alternate;
}

@keyframes uploadBounce {
  from { transform: translateY(0); }
  to   { transform: translateY(-5px); }
}

/* Text label */
.drop-zone-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  z-index: 2;
  text-align: center;
}

.drop-zone-headline {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  transition: color 0.3s;
}

.doc-drop-zone.drop-over .drop-zone-headline {
  color: #818cf8;
}

.drop-zone-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 340px;
  line-height: 1.4;
}

/* Particle burst container */
.drop-zone-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}

.drop-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #818cf8;
  animation: particleFly 0.7s ease-out forwards;
}

@keyframes particleFly {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

/* Dragging thumbnail feedback */
.doc-thumb-card.dragging {
  opacity: 0.45;
  transform: scale(0.9);
  box-shadow: 0 0 0 2px var(--accent-color);
}

/* ============================================================
   PROCESSING DIALOG
   ============================================================ */
.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: procOverlayIn 0.25s ease;
}

.processing-overlay.open {
  display: flex;
}

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

.processing-dialog {
  background: var(--bg-secondary);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 20px;
  padding: 1.75rem;
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 0 60px rgba(99, 102, 241, 0.2), 0 25px 50px rgba(0, 0, 0, 0.5);
  animation: procDialogIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes procDialogIn {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Dialog header */
.processing-dialog-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.processing-logo-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.processing-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  position: relative;
  z-index: 1;
}

.processing-logo-glow {
  position: absolute;
  inset: -4px;
  border-radius: 14px;
  background: conic-gradient(from 0deg, #6366f1, #8b5cf6, #10b981, #6366f1);
  animation: logoSpin 2.5s linear infinite;
  z-index: 0;
  filter: blur(6px);
  opacity: 0.7;
}

@keyframes logoSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.processing-dialog-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.processing-dialog-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
}

.processing-close-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}

.processing-close-btn:hover { color: var(--text-main); }

/* File name chip */
.proc-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Stages (Concise 5-Step Horizontal Grid) */
.proc-stages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
  gap: 0.35rem;
  width: 100%;
}

.proc-stage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.25s ease;
}

.proc-stage.active {
  border-color: rgba(99, 102, 241, 0.6);
  background: rgba(99, 102, 241, 0.12);
}

.proc-stage.done {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.08);
}

.proc-stage.error {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
}

.proc-stage-icon {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.proc-stage-label {
  flex: 1;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.25s;
}

.proc-stage.active .proc-stage-label { color: var(--text-main); }
.proc-stage.done  .proc-stage-label { color: var(--success-color); }
.proc-stage.error .proc-stage-label { color: var(--error-color); }

.proc-stage-status {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.proc-stage.active .proc-stage-status { color: #818cf8; }
.proc-stage.done  .proc-stage-status { color: var(--success-color); }
.proc-stage.error .proc-stage-status { color: var(--error-color); }

/* Spinner for active stage */
.proc-stage-spinner {
  width: 11px;
  height: 11px;
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-left-color: #818cf8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* Progress bar */
.proc-progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}

.proc-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #10b981);
  background-size: 200% 100%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  animation: progressShimmer 2s linear infinite;
}

@keyframes progressShimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* Results section */
.proc-results {
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.06);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: modalFadeIn 0.35s ease;
}

.proc-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.proc-results-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(139, 92, 246, 0.18);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.4);
  font-weight: 700;
}

.proc-results-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.proc-result-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  font-size: 0.74rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  animation: chipPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.proc-result-chip:hover {
  border-color: var(--accent-color);
  background: var(--accent-glow);
  transform: translateY(-1px);
}

@keyframes chipPopIn {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

.proc-result-chip-label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* Actions row */
.proc-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  animation: modalFadeIn 0.3s ease;
}

/* Error state */
.proc-error {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  animation: modalFadeIn 0.3s ease;
}

.proc-error p {
  font-size: 0.9rem;
  color: var(--error-color);
  margin: 0;
}

/* ── Collapsible Stats Section ─────────────────────────────────────── */
.callout-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.callout-toggle-btn:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.5);
  color: var(--text-main);
}

.callout-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}
.callout-panel.callout-open {
  max-height: 120px;
  opacity: 1;
  margin: 18px 0 10px 0;
  padding: 0;
}

/* ── Compact Stage Pipeline Overrides ────────────────────────────── */
.proc-stages {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.2rem;
  transition: opacity 0.4s ease;
}
.proc-stages .proc-stage {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  font-size: 0.65rem;
  color: var(--text-muted);
  transition: all 0.2s ease;
}
.proc-stages .proc-stage.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.2);
}
.proc-stages .proc-stage.done {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
  font-weight: 500;
}
.proc-stages .proc-stage.error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}
.proc-stages .proc-stage-label {
  font-size: 0.64rem;
  font-weight: 500;
}
.proc-stages .proc-stage-icon {
  font-size: 0.65rem;
}
.proc-stages .proc-stage-status {
  font-size: 0.65rem;
}
.proc-stages .proc-stage-spinner {
  width: 8px;
  height: 8px;
  border: 1.5px solid rgba(99, 102, 241, 0.3);
  border-top-color: #818cf8;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

#proc-progress-container {
  height: 3px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 999px !important;
  overflow: hidden;
  margin-top: 0.35rem;
  transition: opacity 0.4s ease;
}

/* Drop-over highlight for Processing Log panel */
.console-panel.drop-over,
#execution-logs-section.drop-over,
#system-logs-section.drop-over {
  border-color: rgba(99, 102, 241, 0.9) !important;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.4), inset 0 0 15px rgba(99, 102, 241, 0.15) !important;
  transform: scale(1.008);
  transition: all 0.2s ease;
}

.card-input-clear-btn {
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

div:hover > .card-input-clear-btn {
  opacity: 0.6;
}

.card-input-clear-btn:hover {
  opacity: 1 !important;
  color: #ef4444 !important;
}

/* Processing Spinner Animations */
@keyframes spin-outer-ring {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

@keyframes pulse-bc-shield {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.08); opacity: 1; filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.6)); }
}

/* Document Laser Scan Effect (Left-to-Right sweep) */
.doc-scan-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, transparent, #8b5cf6, #38bdf8, #8b5cf6, transparent);
  box-shadow: 0 0 15px #8b5cf6, 0 0 25px #38bdf8;
  animation: scanLineSweep 2.2s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

@keyframes scanLineSweep {
  0% { left: 3%; opacity: 0.2; }
  50% { opacity: 1; }
  100% { left: 95%; opacity: 0.2; }
}

.doc-scan-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 6px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(139, 92, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.doc-scan-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a855f7;
  box-shadow: 0 0 10px #a855f7;
  animation: scanDotPulse 1.2s ease-in-out infinite alternate;
}

@keyframes scanDotPulse {
  0% { transform: scale(0.85); opacity: 0.6; }
  100% { transform: scale(1.25); opacity: 1; }
}

/* Hide scrollbars on Dashboard tab outer layout */
#config-tab-dashboard {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
#config-tab-dashboard::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Custom Visible Scrollbar for Metrics Being Sent container */
#dashboard-metrics-section,
#dashboard-available-metrics-list {
  scrollbar-width: thin !important;
  scrollbar-color: rgba(139, 92, 246, 0.45) rgba(0, 0, 0, 0.05) !important;
  -ms-overflow-style: auto !important;
}

#dashboard-metrics-section::-webkit-scrollbar,
#dashboard-available-metrics-list::-webkit-scrollbar {
  display: block !important;
  width: 6px !important;
}

#dashboard-metrics-section::-webkit-scrollbar-track,
#dashboard-available-metrics-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05) !important;
  border-radius: 4px !important;
}

#dashboard-metrics-section::-webkit-scrollbar-thumb,
#dashboard-available-metrics-list::-webkit-scrollbar-thumb {
  background-color: rgba(139, 92, 246, 0.45) !important;
  border-radius: 4px !important;
}

#dashboard-metrics-section::-webkit-scrollbar-thumb:hover,
#dashboard-available-metrics-list::-webkit-scrollbar-thumb:hover {
  background-color: rgba(139, 92, 246, 0.8) !important;
}

@keyframes sendingPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
  }
  70% {
    transform: scale(1.2);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

.sending-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2563eb;
  display: inline-block;
  animation: sendingPulse 1.6s infinite ease-in-out;
}

