/* RowelAi Unified UI — Shared Styles
   Extracted from agent inline styles (identical across all 4 agents) */

/* ===== Typography ===== */
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; }
h1,h2,h3,h4 { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; letter-spacing: -0.03em; }

/* ===== Brand color overrides (emerald palette) ===== */
.bg-brand-50{background-color:#ecfdf5!important}.bg-brand-100{background-color:#d1fae5!important}.bg-brand-200{background-color:#a7f3d0!important}.bg-brand-300{background-color:#6ee7b7!important}.bg-brand-400{background-color:#34d399!important}.bg-brand-500{background-color:#10b981!important}.bg-brand-600{background-color:#059669!important}.bg-brand-700{background-color:#047857!important}.bg-brand-800{background-color:#065f46!important}.bg-brand-900{background-color:#064e3b!important}.bg-brand-950{background-color:#022c22!important}
.text-brand-50{color:#ecfdf5!important}.text-brand-100{color:#d1fae5!important}.text-brand-200{color:#a7f3d0!important}.text-brand-300{color:#6ee7b7!important}.text-brand-400{color:#34d399!important}.text-brand-500{color:#10b981!important}.text-brand-600{color:#059669!important}.text-brand-700{color:#047857!important}.text-brand-800{color:#065f46!important}.text-brand-900{color:#064e3b!important}
.border-brand-100{border-color:#d1fae5!important}.border-brand-200{border-color:#a7f3d0!important}.border-brand-300{border-color:#6ee7b7!important}.border-brand-400{border-color:#34d399!important}.border-brand-500{border-color:#10b981!important}.border-brand-600{border-color:#059669!important}.border-brand-700{border-color:#047857!important}
.ring-brand-400{--tw-ring-color:#34d399!important}.focus\:ring-brand-400:focus{--tw-ring-color:#34d399!important}
.hover\:bg-brand-700:hover{background-color:#047857!important}.hover\:bg-brand-800:hover{background-color:#065f46!important}

/* ===== Sidebar colors ===== */
.bg-sidebar-bg{background-color:#000000!important}.bg-sidebar-hover{background-color:#0d2a1f!important}.bg-sidebar-active{background-color:#047857!important}.bg-sidebar-section{background-color:#000000!important}

/* ===== Ink (text) hierarchy ===== */
.text-ink-0 { color: #212529 !important; }
.text-ink-1 { color: #495057 !important; }
.text-ink-2 { color: #868e96 !important; }

/* ===== Surface (background) hierarchy ===== */
.bg-surface-1 { background-color: #f8f9fa !important; }
.bg-surface-2 { background-color: #f1f3f5 !important; }
.bg-surface-3 { background-color: #e9ecef !important; }
.border-surface-2 { border-color: #f1f3f5 !important; }
.border-surface-3 { border-color: #e9ecef !important; }

/* ===== Missing Tailwind utilities (not in subset build) ===== */
.bg-gray-50{background-color:#f9fafb}.bg-gray-200{background-color:#e5e7eb}
.text-gray-300{color:#d1d5db}.text-gray-400{color:#9ca3af}.text-gray-500{color:#6b7280}.text-gray-600{color:#4b5563}.text-gray-700{color:#374151}.text-gray-900{color:#111827}
.border-gray-200{border-color:#e5e7eb}.border-gray-300{border-color:#d1d5db}
.hover\:text-red-600:hover{color:#dc2626}
.bg-blue-500{background-color:#3b82f6}.bg-orange-500{background-color:#f97316}.bg-red-500{background-color:#ef4444}.bg-yellow-500{background-color:#eab308}
.bg-sky-100{background-color:#e0f2fe}.text-sky-700{color:#0369a1}
.bg-emerald-700{background-color:#047857}.bg-emerald-800{background-color:#065f46}
.text-emerald-600{color:#059669}
.hover\:bg-emerald-800:hover{background-color:#065f46}
.focus\:ring-emerald-400:focus{--tw-ring-color:#34d399}

/* ===== Spacing fallbacks (Tailwind CDN may miss htmx-loaded classes) ===== */
/* space-y: vertical spacing between children */
.space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.25rem; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.5rem; }
/* gap: flex/grid gap */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
/* grid columns */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
/* overflow */
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
/* width/height */
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
/* divide (borders between children) */
.divide-y > :not([hidden]) ~ :not([hidden]) { border-top: 1px solid; }
.divide-surface-3 > :not([hidden]) ~ :not([hidden]) { border-color: #e9ecef; }
/* margin */
.mb-0\.5 { margin-bottom: 0.125rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-1\.5 { margin-top: 0.375rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.-mt-2 { margin-top: -0.5rem; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
/* padding */
.p-1 { padding: 0.25rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-3\.5 { padding-left: 0.875rem; padding-right: 0.875rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
/* additional padding values */
.p-1\.5 { padding: 0.375rem; }
.p-2 { padding: 0.5rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.pt-2 { padding-top: 0.5rem; }
/* border */
.border { border-width: 1px; border-style: solid; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }
/* sizing used in forms */
.max-h-80 { max-height: 20rem; }
.max-h-96 { max-height: 24rem; }
.max-w-\[280px\] { max-width: 280px; }
/* sr-only (screen reader only) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0; }
/* text utilities */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
/* transition */
.transition-colors { transition-property: color, background-color, border-color; transition-duration: 150ms; }
.transition-all { transition-property: all; transition-duration: 150ms; }
/* interactive states (buttons) */
.disabled\:opacity-50:disabled { opacity: 0.5; }
.hover\:bg-surface-1:hover { background-color: #f8f9fa; }
.hover\:bg-brand-50:hover { background-color: #ecfdf5; }
.hover\:bg-brand-100:hover { background-color: #d1fae5; }
.hover\:bg-red-50:hover { background-color: #fef2f2; }
.hover\:underline:hover { text-decoration: underline; }
.focus\:outline-none:focus { outline: none; }
.focus\:ring-1:focus { box-shadow: 0 0 0 1px var(--tw-ring-color, #059669); }
.focus\:ring-2:focus { box-shadow: 0 0 0 3px var(--tw-ring-color, rgba(5,150,105,0.3)); }
.focus\:ring-brand-400:focus { --tw-ring-color: rgba(52,211,153,0.4); }
/* cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* ===== Toggle Switch ===== */
/* Replaces Tailwind peer-checked/after pseudo-classes that CDN misses on htmx-loaded content */
.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: #e9ecef;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.toggle-input:checked + .toggle-switch {
  background: #059669;
}
.toggle-input:checked + .toggle-switch::after {
  transform: translateX(16px);
}
.toggle-input:focus-visible + .toggle-switch {
  outline: 2px solid #059669;
  outline-offset: 2px;
}

/* ===== Component classes ===== */
.card { background: #fff; border: 1px solid #e9ecef; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03); overflow: hidden; }
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-pass { background: #d3f9d8; color: #2b8a3e; }
.badge-warn { background: #fff3bf; color: #e67700; }
.badge-block { background: #ffe3e3; color: #c92a2a; }
.badge-info { background: #d0ebff; color: #1864ab; }
.badge-mod { background: #e8dff5; color: #7048e8; }

/* ===== Sidebar ===== */
.sidebar-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 6px; font-size: 0.8125rem; font-weight: 500; color: #9ca3af; border-left: 2px solid transparent; transition: background-color 0.15s ease, border-color 0.15s ease; text-align: left; cursor: pointer; }
.sidebar-btn:hover { background-color: #162b24; color: #d1d5db; }
.sidebar-btn.active { background-color: #1a3a30; border-left-color: #34d399; color: #f9fafb; font-weight: 600; }

/* ===== Metric card ===== */
.metric-card { box-shadow: 0 1px 3px rgba(16,163,127,0.06), 0 4px 16px rgba(16,163,127,0.08); }
.metric-card:hover { box-shadow: 0 2px 6px rgba(16,163,127,0.1), 0 8px 24px rgba(16,163,127,0.14); }

/* ===== Status dots ===== */
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.status-dot.on { background: #2b8a3e; }
.status-dot.off { background: #c92a2a; }

/* ===== Code/result blocks ===== */
pre.result { background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 8px; padding: 16px; overflow-x: auto; font-size: 13px; line-height: 1.6; max-height: 480px; overflow-y: auto; }

/* ===== Buttons ===== */
.run-btn { transition: background 0.15s ease, transform 0.1s ease; }
.run-btn:hover { background: #047857; }
button:focus-visible { outline: 2px solid #059669; outline-offset: 2px; }
button:active { transform: scale(0.98); }

/* ===== Spinner ===== */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Range slider ===== */
input[type="range"]::-webkit-slider-thumb { -webkit-appearance:none; width:16px; height:16px; border-radius:50%; background:#059669; cursor:pointer; border:2px solid white; box-shadow:0 1px 3px rgba(0,0,0,0.2); }
input[type="range"] { -webkit-appearance:none; height:6px; border-radius:3px; background:#d1fae5; outline:none; }

/* ===== Drag zone (file upload) ===== */
.drag-zone { border: 2px dashed #d1d5db; border-radius: 12px; padding: 32px; text-align: center; transition: border-color 0.2s, background 0.2s; cursor: pointer; }
.drag-zone:hover, .drag-zone.dragover { border-color: #34d399; background: #ecfdf5; }

/* ===== Detection row (verification findings) ===== */
.detection-row { border-left: 3px solid transparent; padding: 8px 12px; border-radius: 6px; margin-bottom: 4px; }
.detection-row.critical { border-left-color: #c92a2a; background: #fff5f5; }
.detection-row.high { border-left-color: #e67700; background: #fff9db; }
.detection-row.medium { border-left-color: #1971c2; background: #e7f5ff; }
.detection-row.low { border-left-color: #868e96; background: #f8f9fa; }

/* ===== Entity chip (PII tags) ===== */
.entity-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 9999px; font-size: 0.6875rem; font-weight: 600; background: #e8dff5; color: #7048e8; }

/* ===== Pipeline step indicator ===== */
.pipeline-step { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 8px; font-size: 0.8125rem; }
.pipeline-step.completed { background: #d3f9d8; color: #2b8a3e; }
.pipeline-step.active { background: #e0f2fe; color: #0369a1; }
.pipeline-step.pending { background: #f8f9fa; color: #868e96; }
.pipeline-step.failed { background: #ffe3e3; color: #c92a2a; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-content { background: white; border-radius: 16px; padding: 24px; max-width: 560px; width: 90%; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }

/* ===== Toast notification ===== */
#toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); font-size: 0.875rem; font-weight: 500; color: white; transition: opacity 0.3s ease; max-width: 360px; }
.toast-success { background: #2f9e44; }
.toast-error { background: #e03131; }
.toast-info { background: #1971c2; }

/* ===== Skeleton loading ===== */
.skeleton { background: linear-gradient(90deg, #f1f3f5 25%, #e9ecef 50%, #f1f3f5 75%); background-size: 200% 100%; animation: skeleton-shimmer 1.5s infinite; border-radius: 6px; }
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== Panel (for htmx content switching) ===== */
.panel { display: none; }
.panel.active { display: block; }

/* ===== Responsive sidebar ===== */
@media (max-width: 1279px) and (min-width: 1024px) {
  .sidebar-collapsed .sidebar-label { display: none; }
  .sidebar-collapsed aside { width: 48px; }
}
@media (max-width: 1023px) {
  .sidebar-mobile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; }
}

/* ===== AI Assistant Floating Bubble ===== */
.ai-bubble-chat-scroll {
  scrollbar-width: thin;
  scrollbar-color: #dee2e6 transparent;
}
.ai-bubble-chat-scroll::-webkit-scrollbar { width: 4px; }
.ai-bubble-chat-scroll::-webkit-scrollbar-thumb { background: #dee2e6; border-radius: 2px; }

@keyframes ai-bubble-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(5, 150, 105, 0); }
}
.ai-bubble-pulse { animation: ai-bubble-pulse 2s ease-in-out 3; }

@media (max-width: 640px) {
  .ai-bubble-panel { width: calc(100vw - 2rem) !important; right: 1rem !important; }
}
