:root {
  --background: #0a0f1a;
  --background-raised: #0f1629;
  --surface: #151d30;
  --surface-hover: #1e2a42;
  --surface-active: #263450;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.15);
  --accent: #c084fc;
  --accent-glow: rgba(192, 132, 252, 0.15);
  --text: #f0f4fc;
  --text-secondary: #7e8ba8;
  --text-tertiary: #4a5578;
  --border: #1e2a42;
  --border-subtle: #161e30;
  --border-bright: #2a3a58;
  --success: #34d399;
  --success-muted: rgba(52, 211, 153, 0.12);
  --danger: #f87171;
  --danger-muted: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-muted: rgba(251, 191, 36, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --font-sans: var(--font-sora), 'Sora', system-ui, -apple-system, sans-serif;
  --font-mono: var(--font-mono), 'JetBrains Mono', 'Menlo', 'Monaco', monospace;
  --code-bg: #080c14;
  --sidebar-width: 264px;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-glow-sm: 0 0 15px -3px var(--primary-glow);
  --shadow-glow-md: 0 0 30px -5px var(--primary-glow);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-card-hover: 0 8px 25px -5px rgba(0,0,0,0.4), 0 4px 10px -3px rgba(0,0,0,0.3);
  --noise-filter: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

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

body {
  background-color: var(--background);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01' 1, 'ss02' 1, 'cv01' 1;
  min-height: 100vh;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.link-hover:hover {
  text-decoration: underline;
  color: var(--primary);
}

button {
  cursor: pointer;
  font-family: inherit;
}

button svg {
  display: block;
  flex-shrink: 0;
}

/* Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.badge-primary {
  background: rgba(59, 130, 246, 0.2);
  color: var(--primary);
}

.badge-secondary {
  background: var(--surface-hover);
  color: var(--text-secondary);
}

.btn-icon {
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.btn-icon:hover {
  background-color: var(--surface-hover);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--text-secondary);
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--text-secondary);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  transition: all 0.2s;
  outline: none;
}

.input.has-icon {
  padding-left: 2.5rem;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

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

.input::placeholder {
  color: var(--text-secondary);
  opacity: 0.5;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

.helper-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.visibility-toggle {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.visibility-toggle:hover {
  color: var(--text);
}

/* Badge variants */
.badge-sm {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
}

/* List/Card Item Styles */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
  cursor: pointer;
  overflow: hidden;
}

.list-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-color: var(--primary);
}

.status-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  fill: var(--text-secondary);
  transition: all 0.2s;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--surface-hover);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}

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

.spin {
  animation: spin 1s linear infinite;
}

/* Layout Utilities Added for PRD Page */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-4 {
  gap: 1rem;
}

.gap-6 {
  gap: 1.5rem;
}

.gap-8 {
  gap: 2rem;
}

.grow {
  flex-grow: 1;
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.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));
}

@media (min-width: 768px) {
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .md\:col-span-1 {
    grid-column: span 1 / span 1;
  }

  .md\:col-span-2 {
    grid-column: span 2 / span 2;
  }
}

@media (min-width: 1024px) {
  .lg\:col-span-1 {
    grid-column: span 1 / span 1;
  }

  .lg\:col-span-2 {
    grid-column: span 2 / span 2;
  }
}

/* Spacing */
.p-2 {
  padding: 0.5rem;
}

.p-4 {
  padding: 1rem;
}

.p-6 {
  padding: 1.5rem;
}

.p-8 {
  padding: 2rem;
}

.py-8 {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mb-8 {
  margin-bottom: 2rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-auto {
  margin-top: auto;
}

.ml-2 {
  margin-left: 0.5rem;
}

.mr-2 {
  margin-right: 0.5rem;
}

/* Text */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-lg {
  font-size: 1.125rem;
}

.text-xl {
  font-size: 1.25rem;
}

.text-2xl {
  font-size: 1.5rem;
}

.text-3xl {
  font-size: 1.875rem;
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.font-medium {
  font-weight: 500;
}

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

.text-danger {
  color: var(--danger);
}

.text-success {
  color: var(--success);
}

.text-primary {
  color: var(--primary);
}

/* Components */
.hidden {
  display: none;
}

.block {
  display: block;
}

.rounded-lg {
  border-radius: var(--radius);
}

.rounded-full {
  border-radius: 9999px;
}

.border {
  border: 1px solid var(--border);
}

.border-dashed {
  border-style: dashed;
}

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

.hover\:border-primary:hover {
  border-color: var(--primary);
}

.cursor-pointer {
  cursor: pointer;
}

.transition-colors {
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}

.shadow-md {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.shadow-xl {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.shadow-primary\/20 {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.shadow-primary\/40 {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.shadow-primary\/10 {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.shadow-primary\/30 {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.text-white {
  color: white;
}

.bg-primary {
  background-color: var(--primary);
}

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

/* Spacing Extended */
.p-0 {
  padding: 0;
}

.p-1 {
  padding: 0.25rem;
}

.p-3 {
  padding: 0.75rem;
}

.p-5 {
  padding: 1.25rem;
}

.p-10 {
  padding: 2.5rem;
}

.px-2 {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.px-6 {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.py-1 {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.py-2 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.py-4 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.pt-4 {
  padding-top: 1rem;
}

.pb-4 {
  padding-bottom: 1rem;
}

.mt-1 {
  margin-top: 0.25rem;
}

.mt-6 {
  margin-top: 1.5rem;
}

.mt-8 {
  margin-top: 2rem;
}

.mr-4 {
  margin-right: 1rem;
}

.mb-1 {
  margin-bottom: 0.25rem;
}

.mb-3 {
  margin-bottom: 0.75rem;
}

.ml-auto {
  margin-left: auto;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

/* Grid Extended */
.gap-3 {
  gap: 0.75rem;
}

.gap-1 {
  gap: 0.25rem;
}

/* Flex Extended */
.flex-1 {
  flex: 1 1 0%;
}

.flex-none {
  flex: none;
}

.flex-wrap {
  flex-wrap: wrap;
}

.shrink-0 {
  flex-shrink: 0;
}

/* Text Extended */
.font-normal {
  font-weight: 400;
}

.text-xs {
  font-size: 0.75rem;
  line-height: 1rem;
}

.text-base {
  font-size: 1rem;
  line-height: 1.5rem;
}

.capitalize {
  text-transform: capitalize;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* Borders and Opacity */
.border-b {
  border-bottom: 1px solid var(--border);
}

.border-r {
  border-right: 1px solid var(--border);
}

.border-t {
  border-top: 1px solid var(--border);
}

.border-l {
  border-left: 1px solid var(--border);
}

.border-none {
  border: none;
}

.rounded-md {
  border-radius: 0.375rem;
}

.rounded-xl {
  border-radius: 0.75rem;
}

.opacity-50 {
  opacity: 0.5;
}

.opacity-70 {
  opacity: 0.7;
}

/* Heights and Widths */
.h-screen {
  height: 100vh;
}

.w-screen {
  width: 100vw;
}

.h-4 {
  height: 1rem;
}

.w-4 {
  width: 1rem;
}

.h-5 {
  height: 1.25rem;
}

.w-5 {
  width: 1.25rem;
}

.h-6 {
  height: 1.5rem;
}

.w-6 {
  width: 1.5rem;
}

.max-w-2xl {
  max-width: 42rem;
}

.max-w-4xl {
  max-width: 56rem;
}

.w-1\/3 {
  width: 33.333333%;
}

.w-2\/3 {
  width: 66.666667%;
}

/* Colors Extended */
.bg-background {
  background-color: var(--background);
}

/* Opacity Variants (Simulated Tailwind) */
.bg-primary-10 {
  background-color: rgba(59, 130, 246, 0.1);
}

.bg-primary-20 {
  background-color: rgba(59, 130, 246, 0.2);
}

.bg-primary-5 {
  background-color: rgba(59, 130, 246, 0.05);
}

.border-primary-20 {
  border-color: rgba(59, 130, 246, 0.2);
}

.bg-surface-hover-30 {
  background-color: rgba(51, 65, 85, 0.3);
}

.bg-surface-hover-50 {
  background-color: rgba(51, 65, 85, 0.5);
}

.bg-white-5 {
  background-color: rgba(255, 255, 255, 0.05);
}

.bg-white-10 {
  background-color: rgba(255, 255, 255, 0.1);
}

.bg-white-20 {
  background-color: rgba(255, 255, 255, 0.2);
}

.border-white-5 {
  border-color: rgba(255, 255, 255, 0.05);
}

.border-white-10 {
  border-color: rgba(255, 255, 255, 0.1);
}

.border-white-20 {
  border-color: rgba(255, 255, 255, 0.2);
}

.text-white-50 {
  color: rgba(255, 255, 255, 0.5);
}

/* Reset for buttons to avoid white chrome default */
button {
  background: transparent;
  border: none;
}

/* Auth form input styling */
input[type="text"],
input[type="email"],
input[type="password"] {
  color: var(--text) !important;
}

/* Brighter placeholder for auth forms */
input::placeholder {
  color: #94a3b8 !important;
  opacity: 0.8;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: var(--surface);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Dropdown menu item hover state */
.dropdown-item {
  transition: background-color 0.15s ease !important;
  background-color: transparent !important;
}
.dropdown-item:hover {
  background-color: var(--surface-hover) !important;
}

/* ===== AI Assistant (assistant-ui) Theme Overrides ===== */
:root {
  --aui-background: var(--background);
  --aui-foreground: var(--text);
  --aui-card: var(--surface);
  --aui-card-foreground: var(--text);
  --aui-popover: var(--surface);
  --aui-popover-foreground: var(--text);
  --aui-primary: var(--primary);
  --aui-primary-foreground: #ffffff;
  --aui-secondary: var(--surface-hover);
  --aui-secondary-foreground: var(--text);
  --aui-muted: var(--surface-hover);
  --aui-muted-foreground: var(--text-secondary);
  --aui-accent: var(--surface-hover);
  --aui-accent-foreground: var(--text);
  --aui-border: var(--border);
  --aui-input: var(--border);
  --aui-ring: var(--primary);
  --aui-radius: var(--radius);
}

/* assistant-ui component overrides */
[data-aui-thread] {
  background: var(--background) !important;
}

[data-aui-assistant-message] {
  color: var(--text) !important;
}

[data-aui-user-message] {
  background: rgba(59, 130, 246, 0.1) !important;
  color: var(--text) !important;
}

[data-aui-composer-input] {
  background: var(--code-bg) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

[data-aui-composer-input]:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
}

[data-aui-composer-send] {
  background: var(--primary) !important;
  color: white !important;
}

.aui-composer-input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  background: var(--code-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  resize: none;
}

.aui-composer-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Chat bubble slide animation */
@keyframes chatSlideUp {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Assistant markdown content styles */
.assistant-markdown {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
}

.assistant-markdown h1,
.assistant-markdown h2,
.assistant-markdown h3,
.assistant-markdown h4 {
  margin-top: 0.75rem;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: var(--text);
}

.assistant-markdown h1 { font-size: 1.15rem; }
.assistant-markdown h2 { font-size: 1.05rem; }
.assistant-markdown h3 { font-size: 0.95rem; }

.assistant-markdown p {
  margin-bottom: 0.5rem;
}

.assistant-markdown p:last-child {
  margin-bottom: 0;
}

.assistant-markdown ul,
.assistant-markdown ol {
  margin: 0.4rem 0;
  padding-left: 1.25rem;
}

.assistant-markdown li {
  margin-bottom: 0.25rem;
}

.assistant-markdown code {
  background: var(--code-bg);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.assistant-markdown pre {
  background: var(--code-bg);
  padding: 0.75rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.assistant-markdown pre code {
  background: none;
  padding: 0;
}

.assistant-markdown strong {
  font-weight: 600;
  color: var(--text);
}

.assistant-markdown a {
  color: var(--primary);
  text-decoration: underline;
}

.assistant-markdown blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 0.75rem;
  margin: 0.5rem 0;
  color: var(--text-secondary);
}

.assistant-markdown hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.75rem 0;
}

.assistant-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.assistant-markdown thead {
  background: var(--surface);
}

.assistant-markdown th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.assistant-markdown td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.assistant-markdown tbody tr:last-child td {
  border-bottom: none;
}

.assistant-markdown tbody tr:hover {
  background: rgba(59, 130, 246, 0.04);
}

.assistant-markdown del {
  color: var(--text-secondary);
}

.assistant-markdown input[type="checkbox"] {
  margin-right: 0.4rem;
  accent-color: var(--primary);
}

/* ===== Command Palette (cmdk) Styles ===== */
@keyframes cmdkFadeIn {
  from { opacity: 0; transform: translateX(-50%) scale(0.98); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}

.cmdk-dialog {
  position: fixed;
  top: min(14vh, 112px);
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 32px));
  z-index: 9999;
  animation: cmdkFadeIn 0.15s ease-out;
}

.cmdk-root {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.cmdk-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}

.cmdk-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

.cmdk-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.cmdk-list {
  max-height: min(620px, calc(100vh - 220px));
  overflow-y: auto;
  padding: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-hover) transparent;
}

.cmdk-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.cmdk-group {
  margin-bottom: 0.25rem;
}

[cmdk-group-heading] {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem 0.25rem;
}

.cmdk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 42px;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  transition: background-color 0.1s;
}

.cmdk-item[data-selected="true"] {
  background: rgba(59, 130, 246, 0.1);
  color: var(--text);
}

.cmdk-item:hover {
  background: var(--surface-hover);
}

.cmdk-item-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.cmdk-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmdk-item-meta {
  flex-shrink: 0;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.cmdk-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface-hover);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cmdk-badge-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex-shrink: 0;
  max-width: 48%;
}

.cmdk-badge {
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: var(--surface-hover);
  color: var(--text-secondary);
  text-transform: capitalize;
}

.cmdk-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.cmdk-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.cmdk-kbd {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--surface-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}

.cmdk-kbd-sm {
  font-size: 0.65rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  background: var(--surface-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  line-height: 1;
}

@media (max-width: 640px) {
  .cmdk-dialog {
    top: 10px;
    width: calc(100vw - 20px);
  }

  .cmdk-list {
    max-height: calc(100vh - 146px);
  }

  .cmdk-input-wrapper {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .cmdk-footer,
  .cmdk-kbd {
    display: none;
  }

  .cmdk-badge-row {
    max-width: 36%;
  }

  .cmdk-badge {
    max-width: 110px;
  }
}

/* Hide chat bubble on small screens */
@media (max-width: 768px) {
  .chat-bubble-container {
    display: none;
  }
}

/* Typing indicator animation */
@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Notification pulse animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* Copy button on hover */
.assistant-msg-wrapper:hover .copy-btn {
  opacity: 1 !important;
}

/* Action bar visibility on hover */
.assistant-msg-wrapper:hover .msg-action-bar {
  opacity: 1 !important;
}

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

/* ===== Page Entrance Animations ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

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

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 4px var(--primary-glow);
  }
  50% {
    box-shadow: 0 0 16px var(--primary-glow), 0 0 32px var(--primary-glow);
  }
}

@keyframes dotPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.3);
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    max-height: 500px;
    transform: translateY(0);
  }
}

@keyframes subtleFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

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

/* Stagger animation delays */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

.animate-in {
  animation: fadeInUp 0.5s var(--ease-out-expo) both;
}

.animate-in-scale {
  animation: fadeInScale 0.4s var(--ease-out-expo) both;
}

.animate-in-right {
  animation: slideInRight 0.5s var(--ease-out-expo) both;
}

.animate-count {
  animation: countUp 0.6s var(--ease-out-expo) both;
}

/* Gradient text utility */
.gradient-text {
  background: linear-gradient(135deg, #f0f4fc, #7e8ba8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Page header with bottom border */
.page-header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.page-header p {
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* Page layout tiers */
.page-narrow {
  max-width: 800px;
  margin: 0 auto;
}

.page-standard {
  max-width: 1200px;
  margin: 0 auto;
}

.page-wide {
  max-width: 1400px;
  margin: 0 auto;
}

.page-full {
  max-width: 100%;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 2rem;
  gap: 0.75rem;
}

.empty-state .empty-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  max-width: 360px;
}

/* Enhanced card styles */
.card-elevated {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.3s var(--ease-smooth);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.card-elevated::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

.card-elevated:hover {
  border-color: var(--border-bright);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

/* Workflow page: dense SaaS layout refinements */
.workflow-page {
  --workflow-gap: 16px;
  min-width: 0;
  overflow-x: hidden;
}

.workflow-page-header {
  margin-bottom: 1.5rem;
}

.workflow-page-header > div {
  flex-wrap: wrap;
}

.workflow-page-header > div > div:first-child {
  min-width: 0;
  flex: 1 1 520px;
}

.workflow-page-header > div > div:last-child {
  flex-wrap: wrap;
}

.workflow-page-header h1 {
  font-size: 1.72rem;
  line-height: 1.15;
}

.workflow-page-header p {
  margin-top: 0.3rem;
  color: var(--text-secondary);
}

.workflow-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.workflow-workspace-nav {
  display: grid;
  gap: 12px;
  margin-bottom: 1.25rem;
}

.workflow-workspace-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.workflow-workspace-group {
  min-height: 84px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "icon copy"
    "stat stat";
  align-items: start;
  gap: 10px 12px;
  text-align: left;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 13px;
  background: rgba(255,255,255,0.018);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s var(--ease-smooth), border-color 0.2s var(--ease-smooth), transform 0.2s var(--ease-smooth);
}

.workflow-workspace-group:hover {
  background: rgba(255,255,255,0.035);
  border-color: var(--border-bright);
  transform: translateY(-1px);
}

.workflow-workspace-group:focus-visible,
.workflow-subtab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.workflow-workspace-group.is-active {
  border-color: rgba(59,130,246,0.48);
  background: linear-gradient(180deg, rgba(59,130,246,0.12), rgba(59,130,246,0.045));
}

.workflow-workspace-group-icon {
  grid-area: icon;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(59,130,246,0.22);
  border-radius: 8px;
  color: var(--primary);
  background: rgba(59,130,246,0.08);
}

.workflow-workspace-group-copy {
  grid-area: copy;
  min-width: 0;
  display: grid;
  gap: 3px;
}

.workflow-workspace-group-copy strong {
  font-size: 0.9rem;
  line-height: 1.2;
}

.workflow-workspace-group-copy span {
  color: var(--text-secondary);
  font-size: 0.77rem;
  line-height: 1.4;
}

.workflow-workspace-group-stat {
  grid-area: stat;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workflow-subtabs {
  min-height: 40px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--border-subtle);
}

.workflow-subtab {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0 12px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.workflow-subtab.is-active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.workflow-subtab-count {
  min-width: 22px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 7px;
  background: rgba(255,255,255,0.055);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 750;
}

.workflow-subtab.is-active .workflow-subtab-count {
  background: rgba(59,130,246,0.14);
  color: var(--primary);
}

.workflow-section {
  padding: 0 !important;
  overflow: hidden;
  border-radius: 10px;
  max-width: 100%;
}

.workflow-section-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.workflow-section-header h2 {
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 750;
  margin: 0;
}

.workflow-section-header p {
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
}

.workflow-section-body {
  padding: 20px;
}

.workflow-stack {
  display: grid;
  gap: var(--workflow-gap);
}

.workflow-card-grid {
  display: grid;
  gap: var(--workflow-gap);
  align-items: stretch;
  min-width: 0;
}

.workflow-library-grid {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.workflow-template-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.workflow-discover,
.workflow-template-toolbar {
  display: grid;
  gap: 14px;
}

.workflow-discover-intro,
.workflow-builder-guide,
.workflow-library-overview {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: rgba(255,255,255,0.018);
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 16px;
  align-items: start;
}

.workflow-discover-intro h3,
.workflow-builder-guide h3,
.workflow-library-overview h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.workflow-discover-intro p,
.workflow-builder-guide p,
.workflow-library-overview p {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.5;
}

.workflow-discover-stats,
.workflow-builder-guide-metrics,
.workflow-library-overview-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 8px;
  min-width: 0;
}

.workflow-eyebrow {
  color: var(--text-tertiary);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}

.workflow-template-search {
  position: relative;
}

.workflow-template-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.workflow-template-category-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.workflow-library-card,
.workflow-template-card {
  padding: 0 !important;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  min-width: 0;
}

.workflow-library-card {
  min-height: 176px;
}

.workflow-template-card {
  min-height: 260px;
  padding: 16px !important;
  gap: 14px;
  align-content: space-between;
}

.workflow-template-card.has-warning {
  border-color: rgba(251,191,36,0.24);
}

.workflow-library-card-body {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.workflow-template-content {
  display: grid;
  gap: 11px;
}

.workflow-card-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  min-width: 0;
}

.workflow-card-title {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.35;
  font-weight: 750;
  letter-spacing: 0;
}

.workflow-card-title-clamped,
.workflow-card-description-clamped {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.workflow-card-title-clamped {
  min-height: 1.35em;
  -webkit-line-clamp: 2;
}

.workflow-card-description {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  font-size: 0.81rem;
  line-height: 1.45;
}

.workflow-card-description-clamped {
  -webkit-line-clamp: 2;
}

.workflow-template-use-case {
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 750;
  margin-top: 0.3rem;
}

.workflow-template-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary-glow);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.workflow-template-path {
  display: grid;
  gap: 6px;
}

.workflow-template-path-step {
  min-height: 28px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.3;
}

.workflow-template-path-step span:first-child {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(59,130,246,0.09);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
}

.workflow-template-path-more {
  color: var(--text-secondary);
  font-size: 0.74rem;
  padding-left: 30px;
}

.workflow-template-ready,
.workflow-template-warning {
  min-height: 28px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 0.76rem;
  line-height: 1.35;
}

.workflow-template-ready {
  color: #93c5fd;
  background: rgba(59,130,246,0.07);
  border: 1px solid rgba(147,197,253,0.18);
}

.workflow-template-warning {
  color: #fbbf24;
  background: rgba(251,191,36,0.07);
  border: 1px solid rgba(251,191,36,0.22);
}

.workflow-template-actions,
.workflow-template-preview-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.workflow-template-actions {
  justify-content: space-between;
}

.workflow-template-preview-dialog {
  display: grid;
  overflow: hidden !important;
}

.workflow-template-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(59,130,246,0.08), rgba(255,255,255,0.012));
}

.workflow-template-preview-heading {
  min-width: 0;
}

.workflow-template-preview-header h2 {
  margin: 0.25rem 0 0;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
}

.workflow-template-preview-header p {
  max-width: 58rem;
  margin: 0.45rem 0 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.55;
}

.workflow-template-preview-close {
  width: 40px !important;
  height: 40px !important;
  flex-shrink: 0;
  color: var(--text-secondary) !important;
}

.workflow-template-preview-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 20px 0;
  min-width: 0;
}

.workflow-template-preview-metric {
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(255,255,255,0.018);
  padding: 10px 11px;
  min-width: 0;
}

.workflow-template-preview-metric[data-tone="high"] {
  border-color: rgba(248,113,113,0.28);
  background: rgba(248,113,113,0.07);
}

.workflow-template-preview-metric[data-tone="medium"] {
  border-color: rgba(251,191,36,0.24);
  background: rgba(251,191,36,0.06);
}

.workflow-template-preview-metric[data-tone="low"] {
  border-color: rgba(52,211,153,0.22);
  background: rgba(52,211,153,0.055);
}

.workflow-template-preview-metric-label {
  color: var(--text-secondary);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}

.workflow-template-preview-metric-value {
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.workflow-template-preview-warning {
  margin: 14px 20px 0 !important;
}

.workflow-template-preview-steps {
  display: grid;
  gap: 0;
  padding: 18px 20px 20px;
}

.workflow-template-preview-section-label {
  margin-bottom: 12px;
  color: var(--text-tertiary);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}

.workflow-template-preview-step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.workflow-template-preview-step-rail {
  display: grid;
  grid-template-rows: 28px 1fr;
  justify-items: center;
}

.workflow-template-preview-step-number {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(59,130,246,0.17);
  border: 1px solid rgba(147,197,253,0.24);
  color: #93c5fd;
  display: grid;
  place-items: center;
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 1;
}

.workflow-template-preview-step-line {
  width: 1px;
  min-height: 18px;
  background: linear-gradient(180deg, rgba(147,197,253,0.28), rgba(147,197,253,0.05));
}

.workflow-template-preview-step-body {
  min-width: 0;
  padding: 2px 0 18px;
}

.workflow-template-preview-step:last-child .workflow-template-preview-step-body {
  padding-bottom: 0;
}

.workflow-template-preview-step-title {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.workflow-template-preview-step p {
  margin: 0.3rem 0 0.55rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.5;
}

.workflow-template-preview-actions {
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(255,255,255,0.018);
}

.workflow-template-preview-actions button {
  min-height: 40px;
}

.workflow-meta-row {
  display: flex;
  gap: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.74rem;
  flex-wrap: wrap;
}

.workflow-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(255,255,255,0.018);
}

.workflow-action-menu {
  width: 260px;
  max-width: calc(100vw - 32px);
  padding: 6px !important;
}

.workflow-action-menu [role="separator"] {
  margin: 6px 0;
}

.workflow-action-menu-item {
  min-height: 34px;
  padding: 7px 9px !important;
  gap: 9px;
  font-size: 0.84rem;
  line-height: 1.25;
  align-items: center !important;
}

.workflow-action-menu-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-library-controls {
  min-height: 40px;
  min-width: 0;
}

.workflow-library-search {
  position: relative;
  min-width: 260px;
  flex: 1 1 320px;
}

.workflow-library-select-status {
  width: 180px !important;
}

.workflow-library-select-sort {
  width: 170px !important;
}

.workflow-catalog {
  display: grid;
  gap: 14px;
}

.workflow-catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.workflow-catalog-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.workflow-catalog-filter {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 8px 0 10px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.83rem;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s var(--ease-smooth), background 0.2s var(--ease-smooth), border-color 0.2s var(--ease-smooth);
}

.workflow-catalog-filter:hover {
  color: var(--text);
  background: rgba(255,255,255,0.035);
  border-color: var(--border-subtle);
}

.workflow-catalog-filter:focus-visible,
.workflow-catalog-step:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.workflow-catalog-filter.is-active {
  color: var(--text);
  background: var(--primary-glow);
  border-color: rgba(59,130,246,0.45);
}

.workflow-catalog-filter-count {
  min-width: 20px;
  min-height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 6px;
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.workflow-catalog-filter.is-active .workflow-catalog-filter-count {
  color: var(--primary);
  background: rgba(59,130,246,0.16);
}

.workflow-catalog-wait-toggle {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.35;
  cursor: pointer;
}

.workflow-catalog-search {
  position: relative;
}

.workflow-catalog-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.workflow-catalog-group {
  display: grid;
  gap: 7px;
}

.workflow-catalog-group-title {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.workflow-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.workflow-catalog-step {
  min-height: 88px;
  text-align: left;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255,255,255,0.018);
  color: var(--text);
  cursor: pointer;
  display: grid;
  align-content: start;
  gap: 7px;
  transition: background 0.2s var(--ease-smooth), border-color 0.2s var(--ease-smooth), transform 0.2s var(--ease-smooth);
}

.workflow-catalog-step:hover {
  background: rgba(255,255,255,0.035);
  border-color: var(--border-bright);
  transform: translateY(-1px);
}

.workflow-catalog-step-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.workflow-catalog-step-title {
  min-width: 0;
  font-size: 0.87rem;
  line-height: 1.3;
  font-weight: 750;
}

.workflow-catalog-risk,
.workflow-catalog-meta {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(255,255,255,0.025);
  color: var(--text-secondary);
  white-space: nowrap;
}

.workflow-catalog-risk {
  padding: 0 8px;
  font-size: 0.68rem;
  line-height: 1;
  flex: 0 0 auto;
}

.workflow-catalog-step[data-risk="medium"] .workflow-catalog-risk {
  color: #fbbf24;
  border-color: rgba(251,191,36,0.22);
  background: rgba(251,191,36,0.06);
}

.workflow-catalog-step[data-risk="high"] .workflow-catalog-risk {
  color: #fb7185;
  border-color: rgba(251,113,133,0.24);
  background: rgba(251,113,133,0.07);
}

.workflow-catalog-step-description {
  color: var(--text-secondary);
  font-size: 0.77rem;
  line-height: 1.45;
}

.workflow-catalog-meta-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 1px;
}

.workflow-catalog-meta {
  padding: 0 8px;
  font-size: 0.73rem;
  line-height: 1;
}

.workflow-catalog-meta-accent {
  color: var(--primary);
  border-color: rgba(59,130,246,0.22);
  background: rgba(59,130,246,0.075);
}

.workflow-builder-meta-grid,
.workflow-step-fields-grid {
  display: grid;
  gap: 12px;
}

.workflow-builder-meta-grid {
  grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 1.2fr);
}

.workflow-builder-actions,
.workflow-draft-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.workflow-builder-guide {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr);
}

.workflow-builder-guide-copy {
  min-width: 0;
}

.workflow-builder-guide-alerts {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.workflow-library-overview {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.75fr);
}

.workflow-draft-indicator {
  min-height: 32px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(255,255,255,0.025);
  padding: 4px 6px 4px 10px;
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.workflow-draft-indicator span:first-child {
  color: var(--text);
  font-weight: 750;
}

.workflow-step-list {
  display: grid;
  gap: 12px;
}

.workflow-step-card {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.workflow-step-card-dependent {
  border-left: 3px solid rgba(147,197,253,0.38);
}

.workflow-step-card-header {
  padding: 14px 16px;
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-subtle);
}

.workflow-step-card-body {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.workflow-step-description {
  margin-top: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}

.workflow-step-type-meta {
  color: var(--text-tertiary);
}

.workflow-step-fields-grid {
  grid-template-columns: minmax(160px, 0.7fr) minmax(220px, 1fr);
}

.workflow-step-index {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary-glow);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 750;
  flex-shrink: 0;
}

.workflow-step-status {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(255,255,255,0.025);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.workflow-step-status-error {
  color: #fb7185;
  border-color: rgba(251,113,133,0.28);
  background: rgba(251,113,133,0.08);
}

.workflow-step-status-warning {
  color: #fbbf24;
  border-color: rgba(251,191,36,0.28);
  background: rgba(251,191,36,0.07);
}

.workflow-step-status-valid {
  color: #93c5fd;
  border-color: rgba(147,197,253,0.24);
  background: rgba(59,130,246,0.07);
}

.workflow-field-helper,
.workflow-dependency-hint {
  margin-top: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.4;
}

.workflow-dependency-hint {
  color: #93c5fd;
}

.workflow-next-step-panel {
  border: 1px solid rgba(147,197,253,0.24);
  border-radius: 8px;
  background: rgba(59,130,246,0.06);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.workflow-next-step-title {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 750;
}

.workflow-next-step-description {
  margin-top: 0.2rem;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.4;
}

.workflow-next-step-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.workflow-agent-empty-state {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(255,255,255,0.025);
  padding: 12px;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: flex-start;
}

.workflow-agent-empty-state p {
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.4;
}

.workflow-inline-link {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.workflow-inline-link:hover {
  text-decoration: underline;
}

.workflow-advanced-panel {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(255,255,255,0.018);
  padding: 12px;
}

.workflow-advanced-toggle {
  height: auto !important;
  min-height: 0;
  width: fit-content;
  min-width: 0;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  align-items: center;
  justify-content: flex-start;
  color: var(--text);
  font-weight: 750;
  line-height: 1.35;
}

.workflow-advanced-summary {
  margin-top: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.workflow-advanced-body {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.45rem;
}

.workflow-step-actions,
.workflow-run-actions,
.workflow-run-filters {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.workflow-step-actions {
  flex-shrink: 0;
}

.workflow-step-actions button,
.workflow-run-actions button {
  width: 34px;
  height: 34px;
}

.workflow-run-actions .workflow-run-details-button {
  width: auto;
  min-width: 86px;
  height: 34px;
  padding: 0 0.75rem;
}

.workflow-run-actions {
  justify-content: flex-end;
}

.workflow-runs-table {
  min-width: 980px;
}

.workflow-runs-table th {
  height: 40px;
  padding: 0 14px;
  font-size: 0.78rem;
  font-weight: 750;
}

.workflow-runs-table td {
  padding: 12px 14px;
}

@media (max-width: 900px) {
  .workflow-workspace-groups {
    grid-template-columns: 1fr;
  }

  .workflow-discover-intro,
  .workflow-builder-guide,
  .workflow-library-overview {
    grid-template-columns: 1fr;
  }

  .workflow-page-header > div {
    align-items: stretch !important;
  }

  .workflow-page-header > div > div,
  .workflow-page-header > div > div:last-child {
    width: 100%;
  }

  .workflow-page-header > div > div:last-child {
    justify-content: flex-start;
  }

  .workflow-section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .workflow-library-grid,
  .workflow-template-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-library-search,
  .workflow-library-select,
  .workflow-library-select-status,
  .workflow-library-select-sort {
    width: 100% !important;
    min-width: 0;
    flex-basis: 100%;
  }

  .workflow-builder-meta-grid,
  .workflow-step-fields-grid {
    grid-template-columns: 1fr;
  }

  .workflow-catalog-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workflow-catalog-wait-toggle {
    width: 100%;
  }

  .workflow-action-menu {
    width: 248px;
  }
}

@media (max-width: 720px) {
  .workflow-section-body {
    padding: 16px;
  }

  .workflow-step-card-header,
  .workflow-card-header {
    gap: 10px;
  }

  .workflow-catalog-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-template-actions,
  .workflow-template-preview-actions {
    justify-content: flex-start;
  }

  .workflow-template-preview-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .workflow-page-header > div {
    align-items: stretch !important;
  }

  .workflow-page-header > div > div,
  .workflow-page-header > div > div:last-child {
    width: 100%;
  }

  .workflow-page-header > div > div:last-child {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .workflow-card-footer,
  .workflow-step-card-header {
    flex-direction: column;
  }

  .workflow-agent-empty-state {
    flex-direction: column;
  }

  .workflow-inline-link {
    white-space: normal;
  }

  .workflow-catalog-filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .workflow-template-category-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-catalog-filter {
    justify-content: space-between;
    width: 100%;
  }

  .workflow-workspace-group {
    grid-template-columns: 1fr;
    grid-template-areas:
      "icon"
      "copy"
      "stat";
  }

  .workflow-template-preview-header {
    padding: 16px;
  }

  .workflow-template-preview-summary {
    padding: 12px 16px 0;
  }

  .workflow-template-preview-warning {
    margin: 12px 16px 0 !important;
  }

  .workflow-template-preview-steps {
    padding: 16px;
  }

  .workflow-template-preview-actions {
    padding: 12px 16px;
  }

  .workflow-template-preview-actions button {
    flex: 1 1 140px;
  }

  .workflow-catalog-step-header {
    align-items: flex-start;
  }

  .workflow-run-actions {
    justify-content: flex-start;
  }

  .workflow-action-menu {
    width: min(248px, calc(100vw - 24px));
  }

  .workflow-action-menu-item {
    min-height: 32px;
    padding: 6px 8px !important;
    font-size: 0.8rem;
  }
}

/* Glass effect */
.glass {
  background: rgba(21, 29, 48, 0.7);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Noise texture overlay */
.noise-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--noise-filter);
  opacity: 0.4;
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* Custom scrollbar for dark theme */
.custom-scrollbar::-webkit-scrollbar {
  width: 5px;
}

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

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--surface-active);
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* Focus ring utility */
.focus-ring:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Radix UI Tabs design token overrides */
[data-radix-collection-item][data-state="inactive"] {
  color: var(--text-secondary);
}

[data-radix-collection-item][data-state="active"] {
  color: var(--text);
  background: var(--surface-hover);
}

/* Radix Select item focus state */
[data-radix-select-viewport] [data-highlighted] {
  background: var(--primary-glow);
}

/* Radix Input focus glow */
input:focus-visible,
input:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary-glow) !important;
}

/* Radix Switch design token overrides */
button[role="switch"] {
  cursor: pointer;
}

button[role="switch"][data-state="checked"] {
  background: var(--primary) !important;
  border-color: rgba(147, 197, 253, 0.72) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

button[role="switch"][data-state="unchecked"] {
  background: var(--surface-hover) !important;
  border-color: var(--border-bright) !important;
}

button[role="switch"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.26);
}

button[role="switch"]:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button[role="switch"][data-state="unchecked"] .quorvex-switch-thumb {
  transform: translateX(0);
}

button[role="switch"][data-state="checked"] .quorvex-switch-thumb {
  transform: translateX(20px);
}

/* Radix Dropdown/Context menu focus states */
[data-radix-menu-content] [data-highlighted] {
  background: var(--surface-hover) !important;
  color: var(--text) !important;
}

[data-radix-menu-content] [data-state="open"] {
  background: var(--surface-hover);
}

/* ===== PRD Premium Utilities ===== */
.gradient-border {
  position: relative;
  background: var(--surface);
  border: 1px solid transparent;
  background-clip: padding-box;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(192,132,252,0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.gradient-border-success {
  position: relative;
  background: var(--surface);
  border: 1px solid transparent;
  background-clip: padding-box;
}

.gradient-border-success::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(34,197,94,0.3), rgba(52,211,153,0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.stepper-connector {
  position: absolute;
  top: 50%;
  height: 2px;
  background: rgba(255,255,255,0.06);
  transform: translateY(-50%);
  z-index: 0;
}

.stepper-connector-active {
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

@keyframes progressShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-shimmer {
  position: relative;
  overflow: hidden;
}

.progress-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: progressShimmer 1.5s ease-in-out infinite;
}

.terminal-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dot-red { background: rgba(239, 68, 68, 0.75); }
.terminal-dot-yellow { background: rgba(250, 204, 21, 0.75); }
.terminal-dot-green { background: rgba(34, 197, 94, 0.75); }
