/**
 * Shadowlytics Theme - CSS Variables & Base Styles
 * For use with Django projects
 */

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
  /* Primary Colors */
  --primary: #e1a65d;
  --primary-hover: #d4973e;
  --primary-foreground: #141414;

  /* Background Colors */
  --background: #141414;
  --background-secondary: #1a1a1a;
  --foreground: #fafafa;

  /* Card Colors */
  --card: #141414;
  --card-foreground: #fafafa;

  /* Muted Colors */
  --muted: #2a2a2a;
  --muted-foreground: #a3a3a3;

  /* Secondary Colors */
  --secondary: #2a2a2a;
  --secondary-hover: #333333;
  --secondary-foreground: #fafafa;

  /* Sidebar Colors */
  --sidebar: #141414;
  --sidebar-foreground: #fafafa;
  --sidebar-border: #2a2a2a;
  --sidebar-accent: #2a2a2a;

  /* Border Colors */
  --border: #4a4a4a;
  --border-light: #333333;
  --input: #2a2a2a;
  --ring: #e1a65d;

  /* Semantic Colors */
  --destructive: #ef4444;
  --destructive-hover: #dc2626;
  --destructive-foreground: #fafafa;
  --success: #22c55e;
  --warning: #f59e0b;
  --info: #22d3ee;

  /* Chart Colors */
  --chart-1: #e1a65d;
  --chart-2: #22d3ee;
  --chart-3: #f59e0b;
  --chart-4: #a855f7;
  --chart-5: #ef4444;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', 'Roboto Mono', Menlo, Monaco, monospace;

  /* Spacing */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ============================================
   SCROLLBAR
   ============================================ */

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
}

/* WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background-color: var(--muted);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--muted-foreground);
}

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

/* ============================================
   BASE STYLES
   ============================================ */

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

button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  color: var(--foreground);
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  font-size: 2.25rem;  /* 36px */
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.875rem; /* 30px */
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.5rem;   /* 24px */
  font-weight: 600;
  letter-spacing: -0.015em;
}

h4 {
  font-size: 1.25rem;  /* 20px */
  font-weight: 600;
}

h5 {
  font-size: 1rem;     /* 16px */
  font-weight: 500;
}

h6 {
  font-size: 0.875rem; /* 14px */
  font-weight: 500;
}

p {
  color: var(--muted-foreground);
  line-height: 1.625;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

small {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--muted);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
}

/* ============================================
   LAYOUT
   ============================================ */

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-content {
  display: flex;
  flex: 1;
}

.main-content {
  flex: 1;
  padding: 1.5rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.page-header-content {
  flex: 1;
}

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 0.25rem;
}

.page-description {
  font-size: 1rem;
  color: var(--muted-foreground);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background-color: var(--background);
  border-bottom: 1px solid var(--sidebar-border);
  position: sticky;
  top: 0;
  z-index: 1100;
}

/* Push Leaflet controls below the header so search dropdown renders on top */
.leaflet-top,
.leaflet-bottom {
  z-index: 900 !important;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
}

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

.logo-icon {
  width: 32px;
  height: 32px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-email {
  font-size: 0.875rem;
  color: var(--foreground);
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  width: 280px;
  background-color: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  font-size: 0.875rem;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.sidebar-nav-item:hover {
  background-color: var(--sidebar-accent);
  color: var(--foreground);
}

.sidebar-nav-item.active {
  background-color: rgba(225, 166, 93, 0.1);
  color: var(--primary);
}

.sidebar-nav-item svg,
.sidebar-nav-item .icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.sidebar-nav-item .icon.icon-xs {
  width: 0.875rem;
  height: 0.875rem;
}

.sidebar-brand-icon {
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.sidebar-section {
  margin-top: 0.5rem;
}

.sidebar-section-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.75rem;
}

.sidebar-sub-item {
  padding-left: 1.5rem;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn svg,
.btn .icon {
  width: 1rem;
  height: 1rem;
}

/* Primary Button */
.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  color: var(--primary-foreground);
}

/* Secondary Button */
.btn-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--secondary-hover);
}

/* Outline Button */
.btn-outline {
  background-color: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--secondary);
}

/* Ghost Button */
.btn-ghost {
  background-color: transparent;
  color: var(--foreground);
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--secondary);
}

/* Destructive Button */
.btn-destructive {
  background-color: transparent;
  color: var(--destructive);
  border: 1px solid var(--border);
}

.btn-destructive:hover:not(:disabled) {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: var(--destructive);
}

/* Button Sizes */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-icon {
  padding: 0.5rem;
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.card-header {
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--card-foreground);
  margin-bottom: 0.25rem;
}

.card-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.card-content {
  /* Content styles */
}

.card-footer {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

/* Analysis card (top banner with dot grid default) */
a.analysis-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.analysis-card {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 378px;
  overflow: hidden;
}

/* ── Card cover banner ── */
.analysis-card .card-cover {
  position: relative;
  height: 80px;
  flex-shrink: 0;
  overflow: hidden;
}

.analysis-card .card-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.analysis-card .card-cover-pattern {
  width: 100%;
  height: 100%;
  background-color: var(--card);
  background-image: radial-gradient(circle, rgba(225, 166, 93, 0.2) 1px, transparent 1px);
  background-size: 14px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.analysis-card .card-cover-icon {
  opacity: 0.08;
  color: var(--foreground);
}
.analysis-card .card-cover-icon svg {
  width: 48px;
  height: 48px;
}

.analysis-card .card-cover-accent {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
}

.analysis-card .card-accent {
  display: none;
}

/* New version badge on card */
.card-new-version-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--primary);
  background: rgba(30, 30, 40, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(225, 166, 93, 0.25);
  border-radius: 6px;
  pointer-events: none;
  z-index: 2;
}

.pulse-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(225, 166, 93, 0.5); }
  50% { opacity: 0.6; box-shadow: 0 0 6px 2px rgba(225, 166, 93, 0.35); }
}

/* New version alert bar on detail page */
.new-version-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary);
  background: rgba(225, 166, 93, 0.08);
  border-bottom: 1px solid rgba(225, 166, 93, 0.15);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* When alert bar is present, hero loses its bottom radius */
.hero-bar:has(+ .new-version-alert) {
  border-radius: 0;
}
.detail-cover-banner + .hero-bar:has(+ .new-version-alert) {
  border-radius: 0;
}

.analysis-card .card-body {
  padding: 0 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.375rem;
}

.analysis-card .card-hero-icon {
  margin-top: -22px;
  margin-bottom: 0.25rem;
  position: relative;
  z-index: 1;
}

.icon-badge-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--card);
  padding: 8px;
}

.analysis-card .card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0.125rem;
}

.owner-link {
  color: inherit !important;
  text-decoration: none;
  transition: color 0.15s;
}

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

.analysis-card .card-desc {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.analysis-card .card-tags {
  margin-bottom: auto;
}

.analysis-card .card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.625rem;
  border-top: 1px solid var(--border);
  margin-top: 0.625rem;
}

.analysis-card .card-meta {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.analysis-card .card-meta .owner {
  color: var(--primary);
  font-weight: 500;
}

/* ─── Card Stat Bar (Design 3) ─── */
.card-stat-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.25rem;
  background: rgba(42, 42, 42, 0.35);
  border-top: 1px solid var(--border-light);
  font-size: 0.7rem;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.card-stat-bar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-item-warning {
  color: var(--warning, #f59e0b);
}

/* ─── Avatar Stack ─── */
.av-stack {
  display: flex;
  align-items: center;
}

.av-stack .av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 2px solid var(--card);
  margin-left: -5px;
  flex-shrink: 0;
}

.av-stack .av:first-child { margin-left: 0; }
.av-stack .av:nth-child(1) { background: rgba(225,166,93,0.2); color: var(--primary); }
.av-stack .av:nth-child(2) { background: rgba(34,211,238,0.15); color: #22d3ee; }
.av-stack .av:nth-child(3) { background: rgba(168,85,247,0.15); color: #a855f7; }
.av-stack .av:nth-child(4) { background: rgba(34,197,94,0.15); color: #22c55e; }
.av-stack .av:nth-child(n+5) { background: var(--muted); color: var(--muted-foreground); font-size: 0.5rem; }

/* Larger variant for detail page */
.av-stack-lg .av {
  width: 28px;
  height: 28px;
  font-size: 0.65rem;
  margin-left: -7px;
}

.av-stack-lg .av:first-child { margin-left: 0; }

/* ─── Detail Stats Bar (Design 5) ─── */
.analysis-stats-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.65rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin-top: 0.875rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.stats-bar-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.stats-bar-item .stat-value {
  font-weight: 600;
}

.stats-bar-item .stat-label {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.stats-bar-divider {
  width: 1px;
  height: 18px;
  background: var(--border-light);
  flex-shrink: 0;
}

.stats-bar-spacer { flex: 1; min-width: 0.5rem; }

.stats-bar-contributors {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stats-bar-contributors .contributor-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}

/* Selection Card */
.selection-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.selection-card:hover:not(.disabled) {
  border-color: var(--primary);
}

.selection-card.active {
  border-color: var(--primary);
}

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

/* Stats Card */
.stats-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.stats-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.stats-card-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.stats-card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--foreground);
}

.stats-card-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.card-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
  margin-bottom: 1rem;
}

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

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--foreground);
  background-color: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
}

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

.form-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgba(225, 166, 93, 0.2);
}

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

.form-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

.form-error {
  font-size: 0.75rem;
  color: var(--destructive);
  margin-top: 0.25rem;
}

/* Textarea */
.form-textarea,
textarea.form-input {
  min-height: 100px;
  resize: vertical;
}

/* Select */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* Checkbox */
.form-checkbox {
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--input);
  cursor: pointer;
  accent-color: var(--primary);
}

/* File Input */
.form-file {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.form-file-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

/* ============================================
   DROPDOWN MENU
   ============================================ */

.dropdown {
  position: relative;
}

.dropdown-trigger {
  cursor: pointer;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 200px;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
}

.dropdown-menu.open {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.dropdown-item:hover {
  background-color: var(--muted);
}

.dropdown-item svg,
.dropdown-item .icon {
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
}

.dropdown-separator {
  height: 1px;
  background-color: var(--border);
  margin: 0.25rem 0;
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

dialog.modal {
  border: none;
  background: none;
  padding: 0;
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100vh;
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

dialog.modal::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

dialog.modal:not([open]) {
  display: none;
}

.modal-content {
  background-color: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 94%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0.25rem;
}

.modal-close:hover {
  color: var(--foreground);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 1.5rem 1.5rem;
}

/* Secret input with visibility toggle */
.secret-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.secret-input-wrapper .form-input {
  padding-right: 2.5rem;
  flex: 1;
}

.secret-input-wrapper .secret-toggle {
  position: absolute;
  right: 0.25rem;
  padding: 0.25rem;
  color: var(--muted-foreground);
}

.secret-input-wrapper .secret-toggle:hover {
  color: var(--foreground);
}

/* Modal form sections */
.modal-section {
  padding: 0.75rem;
  margin-bottom: 1rem;
  background: var(--muted);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.modal-section:last-of-type {
  margin-bottom: 0;
}

.modal-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
}

.modal-section-desc {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 0.75rem;
}

.modal-section .form-group {
  margin-bottom: 0.75rem;
}

.modal-section .form-group:last-child {
  margin-bottom: 0;
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid;
}

.alert-title {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.alert-description {
  font-size: 0.875rem;
}

/* Info Alert */
.alert-info {
  background-color: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.3);
}

.alert-info .alert-title {
  color: var(--info);
}

/* Success Alert */
.alert-success {
  background-color: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
}

.alert-success .alert-title {
  color: var(--success);
}

/* Warning Alert */
.alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}

.alert-warning .alert-title {
  color: var(--warning);
}

/* Destructive/Error Alert */
.alert-destructive {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

.alert-destructive .alert-title {
  color: var(--destructive);
}

/* ============================================
   AVATAR
   ============================================ */

.avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  border: 2px solid var(--primary);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 2rem;
  height: 2rem;
}

.avatar-lg {
  width: 3rem;
  height: 3rem;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background-color: var(--muted);
  color: var(--muted-foreground);
}

.badge-primary {
  background-color: rgba(225, 166, 93, 0.2);
  color: var(--primary);
}

.badge-success {
  background-color: rgba(34, 197, 94, 0.2);
  color: var(--success);
}

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

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

/* ============================================
   TAGS
   ============================================ */

/* Tag badge (display on cards / detail) */
.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.0625rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--radius-full, 9999px);
  background: color-mix(in srgb, var(--tag-color) 15%, transparent);
  color: var(--tag-color);
  line-height: 1.4;
  white-space: nowrap;
}

.tag-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* Tag picker (GitHub-style dropdown) */
.tag-picker {
  position: relative;
}

.tag-picker-trigger {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  min-height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input);
  cursor: pointer;
  transition: border-color 0.15s;
}

.tag-picker-trigger:hover {
  border-color: var(--muted-foreground);
}

.tag-picker-trigger.open {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(225, 166, 93, 0.15);
}

.tag-picker-placeholder {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.tag-picker-chevron {
  margin-left: auto;
  color: var(--muted-foreground);
  flex-shrink: 0;
  transition: transform 0.15s;
}

.tag-picker-trigger.open .tag-picker-chevron {
  transform: rotate(180deg);
}

.tag-picker-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-full, 9999px);
  background: color-mix(in srgb, var(--tag-color) 20%, transparent);
  color: var(--tag-color);
  line-height: 1.5;
}

.tag-picker-pill .remove {
  font-size: 0.8125rem;
  line-height: 1;
  opacity: 0.6;
  cursor: pointer;
  margin-left: 0.125rem;
}

.tag-picker-pill .remove:hover {
  opacity: 1;
}

.tag-picker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: none;
  overflow: hidden;
}

.tag-picker-dropdown.open {
  display: block;
}

.tag-picker-search {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.tag-picker-search input {
  width: 100%;
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--foreground);
  outline: none;
}

.tag-picker-search input:focus {
  border-color: var(--primary);
}

.tag-picker-search input::placeholder {
  color: var(--muted-foreground);
}

.tag-picker-options {
  max-height: 12rem;
  overflow-y: auto;
}

.tag-picker-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--foreground);
  cursor: pointer;
  transition: background 0.1s;
}

.tag-picker-option:hover {
  background: var(--accent);
}

.tag-picker-option.selected {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.tag-picker-option .check {
  margin-left: auto;
  color: var(--primary);
  font-size: 0.75rem;
  opacity: 0;
  flex-shrink: 0;
}

.tag-picker-option.selected .check {
  opacity: 1;
}

.tag-picker-empty {
  padding: 1rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.tag-picker-create {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--primary);
  cursor: pointer;
  border-top: 1px solid var(--border-light);
  transition: background 0.1s;
}

.tag-picker-create:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

/* Settings tag management */
.tag-management-list {
  display: flex;
  flex-direction: column;
}

.tag-management-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.25rem;
  border-bottom: 1px solid var(--border);
}

.tag-management-item:last-child {
  border-bottom: none;
}

.tag-management-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}

.tag-management-count {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-left: auto;
}

.tag-management-actions {
  display: flex;
  gap: 0.375rem;
}

.tag-management-actions button {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s;
}

.tag-management-actions button:hover {
  background: var(--accent);
  color: var(--foreground);
}

.tag-management-actions button.delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--destructive);
  border-color: var(--destructive);
}

/* Color palette (settings tag create/edit) */
.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.color-palette-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}

.color-palette-btn:hover {
  transform: scale(1.15);
}

.color-palette-btn.selected {
  border-color: var(--foreground);
  box-shadow: 0 0 0 2px var(--background);
}

/* Tag create row in settings */
.tag-create-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-bottom: 0.75rem;
}

.tag-create-row .form-input {
  flex: 1;
  min-width: 120px;
  max-width: 200px;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.empty-state-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: var(--muted-foreground);
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}

.empty-state-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted-foreground);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
}

.table tbody tr:hover {
  background-color: var(--muted);
}

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

/* Text Colors */
.text-primary { color: var(--primary); }
.text-muted { color: var(--muted-foreground); }
.text-destructive { color: var(--destructive); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* Background Colors */
.bg-primary { background-color: var(--primary); }
.bg-muted { background-color: var(--muted); }
.bg-card { background-color: var(--card); }

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Spacing */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }

/* Width */
.w-full { width: 100%; }

/* Visibility */
.hidden { display: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   ICON BADGE & PICKER
   ============================================ */

.icon-badge {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: var(--primary);
  padding: 6px;
}

.icon-badge svg {
  width: 100%;
  height: 100%;
  color: white;
}

.icon-badge-sm {
  width: 32px;
  height: 32px;
  padding: 5px;
}

.icon-badge-lg {
  width: 48px;
  height: 48px;
  padding: 7px;
}

/* Icon picker container */
.icon-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  overflow: hidden;
}

.icon-picker-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.icon-picker-preview-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: var(--primary);
}

.icon-picker-preview-badge svg {
  width: 22px;
  height: 22px;
  color: white;
}

.icon-picker-label {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  line-height: 1.3;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 6px;
  padding: 0.75rem;
  max-height: 160px;
  overflow-y: auto;
}

.icon-picker-btn {
  background: none;
  border: none;
  color: var(--muted-foreground);
  margin: 4px;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-picker-btn:hover {
  color: var(--primary);
}

.icon-picker-btn.selected {
  color: var(--primary);
}

.icon-picker-btn svg {
  width: 18px;
  height: 18px;
}

/* Scrollbar for icon grid */
.icon-picker-grid::-webkit-scrollbar {
  width: 4px;
}

.icon-picker-grid::-webkit-scrollbar-track {
  background: transparent;
}

.icon-picker-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.icon-picker-grid::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

.icon-picker-upload {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.icon-upload-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* ── Cover image upload area ── */
.cover-upload-area {}

.cover-preview {
  position: relative;
  height: 100px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--background);
}

.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.cover-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.cover-preview:hover .cover-remove-btn {
  opacity: 1;
}

/* ============================================
   SEARCH
   ============================================ */

.search-container {
  position: relative;
}

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

.search-input-wrapper .search-icon {
  position: absolute;
  left: 0.75rem;
  width: 16px;
  height: 16px;
  color: var(--muted-foreground);
  pointer-events: none;
}

.search-input-wrapper .form-input {
  padding-left: 2.5rem;
  padding-right: 2.5rem;
}

.search-clear {
  position: absolute;
  right: 0.25rem;
}

.search-results-count {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.5rem;
}

/* ============================================
   FILTER CHIPS (Page-level & Global search)
   ============================================ */

/* Row layout: search input + chips inline */
.search-filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-filter-row .search-input-wrapper {
  flex: 1;
}

.filter-chips {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Individual chip */
.filter-chip {
  position: relative;
}

.filter-chip-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  height: 36px;
  background: var(--muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.filter-chip-trigger:hover {
  border-color: var(--border);
  color: var(--foreground);
}

.filter-chip-trigger.active {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--muted));
}

/* Badge count on chip trigger */
.filter-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.25rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius-full);
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
}

/* Chip dropdown */
.filter-chip-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  display: none;
  overflow: hidden;
}

.filter-chip-dropdown.open {
  display: block;
}

.filter-chip-dropdown-search {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-light);
}

.filter-chip-dropdown-search input {
  width: 100%;
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--foreground);
  outline: none;
}

.filter-chip-dropdown-search input:focus {
  border-color: var(--primary);
}

.filter-chip-dropdown-search input::placeholder {
  color: var(--muted-foreground);
}

.filter-chip-dropdown-options {
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.filter-chip-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4375rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--foreground);
  cursor: pointer;
  transition: background 0.1s;
}

.filter-chip-option:hover {
  background: var(--muted);
}

.filter-chip-option input[type="checkbox"],
.filter-chip-option input[type="radio"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.filter-chip-empty {
  padding: 1rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

/* Active filter pills (below search bar) */
.active-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.active-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary);
  white-space: nowrap;
}

.active-filter-pill-remove {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 0.125rem;
  opacity: 0.6;
}

.active-filter-pill-remove:hover {
  opacity: 1;
}

.active-filters-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.active-filters-meta .btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.75rem;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 0;
}

.active-filters-meta .btn-link:hover {
  text-decoration: underline;
}

/* ============================================
   GLOBAL SEARCH (Header)
   ============================================ */

.global-search {
  position: relative;
  flex: 1;
  max-width: 480px;
  margin: 0 1.5rem;
}

.global-search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.global-search-icon {
  position: absolute;
  left: 0.75rem;
  width: 16px;
  height: 16px;
  color: var(--muted-foreground);
  pointer-events: none;
  z-index: 1;
}

.global-search-input {
  width: 100%;
  height: 36px;
  padding: 0 2.5rem 0 2.5rem;
  background: var(--muted);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  color: var(--foreground);
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s ease;
}

.global-search-input::placeholder {
  color: var(--muted-foreground);
}

.global-search-input:hover {
  border-color: var(--border-light);
}

.global-search-input:focus {
  background: var(--background);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(225, 166, 93, 0.1);
}

.global-search-input:focus + .global-search-shortcut,
.global-search-input:not(:placeholder-shown) + .global-search-shortcut {
  display: none;
}

.global-search-shortcut {
  position: absolute;
  right: 0.75rem;
  padding: 0.125rem 0.5rem;
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  line-height: 1.4;
  pointer-events: none;
}

.global-search-spinner {
  position: absolute;
  right: 0.75rem;
  display: flex;
  align-items: center;
  color: var(--muted-foreground);
}

.global-search-spinner[hidden] {
  display: none;
}

.global-search-spinner .spin {
  width: 16px;
  height: 16px;
  animation: spin 0.8s linear infinite;
}

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

/* Dropdown */
.global-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 1001;
  max-height: 420px;
  display: flex;
  flex-direction: column;
}

.global-search-dropdown[hidden] {
  display: none;
}

/* Group headers */
.global-search-group-label {
  padding: 0.5rem 0.875rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.global-search-group-label:not(:first-child) {
  border-top: 1px solid var(--border-light);
  margin-top: 0.25rem;
  padding-top: 0.625rem;
}

/* Result items */
.global-search-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.875rem;
  text-decoration: none;
  color: var(--foreground);
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.global-search-item:hover,
.global-search-item[aria-selected="true"] {
  background: var(--muted);
}

.global-search-item[aria-selected="true"] {
  outline: none;
}

.global-search-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  border-radius: var(--radius);
  color: var(--primary);
}

.global-search-item[aria-selected="true"] .global-search-item-icon {
  background: var(--border-light);
}

.global-search-item-icon svg {
  width: 16px;
  height: 16px;
}

.global-search-item-content {
  flex: 1;
  min-width: 0;
}

.global-search-item-name {
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-search-item-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

.global-search-item-meta .owner {
  color: var(--primary);
  font-weight: 500;
}

.global-search-item-badges {
  flex-shrink: 0;
  display: flex;
  gap: 0.375rem;
}

/* Results scrollable area */
#globalSearchResults {
  overflow-y: auto;
  max-height: 350px;
  padding: 0.375rem 0;
}

/* Empty / no results state */
.global-search-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.global-search-empty-icon {
  display: block;
  margin: 0 auto 0.5rem;
  width: 24px;
  height: 24px;
  opacity: 0.5;
}

/* Footer with keyboard hints */
.global-search-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.875rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

.global-search-footer kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.625rem;
  line-height: 1;
}

/* Global search filter additions */
.global-search-filters {
  padding: 0.5rem 0.875rem;
  border-bottom: 1px solid var(--border-light);
}

.global-search-filter-chips {
  display: flex;
  gap: 0.375rem;
}

.global-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: var(--muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--muted-foreground);
  font-size: 0.6875rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s;
}

.global-filter-chip:hover {
  border-color: var(--border);
  color: var(--foreground);
}

.global-filter-chip.active {
  border-color: color-mix(in srgb, var(--primary) 40%, transparent);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.global-filter-chip .chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 0.1875rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius-full);
  font-size: 0.5625rem;
  font-weight: 700;
  line-height: 1;
}

.global-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.375rem;
}

.global-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.0625rem 0.375rem;
  font-size: 0.5625rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary);
}

.global-active-pill button {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.6;
}

.global-active-pill button:hover {
  opacity: 1;
}

/* Filter panel inside global search dropdown */
.global-filter-panel {
  border-bottom: 1px solid var(--border-light);
  max-height: 250px;
  overflow-y: auto;
}

.global-filter-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--foreground);
  border-bottom: 1px solid var(--border-light);
}

.global-filter-panel-header button {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.6875rem;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 0;
}

.global-filter-panel-header button:hover {
  text-decoration: underline;
}

.global-filter-panel-search {
  padding: 0.375rem 0.875rem;
  border-bottom: 1px solid var(--border-light);
}

.global-filter-panel-search input {
  width: 100%;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--foreground);
  outline: none;
}

.global-filter-panel-search input:focus {
  border-color: var(--primary);
}

.global-filter-panel-search input::placeholder {
  color: var(--muted-foreground);
}

.global-filter-panel-options {
  padding: 0.25rem 0;
}

.global-filter-panel-options .filter-chip-option {
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
}

/* Tag badges on global search result items */
.global-search-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.125rem;
}

.global-search-item-tags .tag-badge {
  font-size: 0.5625rem;
  padding: 0 0.375rem;
}

.global-search-item-tags .tag-badge .tag-badge-dot {
  width: 5px;
  height: 5px;
}

/* ============================================
   DETAIL PAGE — TWO-COLUMN LAYOUT
   ============================================ */

/* Top bar: breadcrumb */
.detail-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.breadcrumb a {
  color: var(--muted-foreground);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb svg {
  width: 14px;
  height: 14px;
}

.breadcrumb .current {
  color: var(--foreground);
  font-weight: 500;
}

/* Detail page cover banner */
.detail-cover-banner {
  position: relative;
  height: 120px;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
}

.detail-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Empty state: type-colored gradient + wave lines */
.detail-cover-empty {
  background: linear-gradient(135deg, var(--card) 0%, #292524 100%);
  overflow: hidden;
}
.detail-cover-empty[data-type="llm"] {
  background: linear-gradient(135deg, #1c1917 0%, #422006 50%, #78350f 100%);
}
.detail-cover-empty[data-type="python_code"] {
  background: linear-gradient(135deg, #1c1917 0%, #27272a 50%, #3f3f46 100%);
}
.detail-cover-waves {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: rgba(255, 255, 255, 0.08);
}

.detail-cover-upload-hint {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
  flex-direction: column;
  line-height: 1.3;
}

.detail-cover-upload-hint .detail-cover-dimensions {
  font-size: 0.625rem;
  opacity: 0.75;
}

.detail-cover-banner:hover .detail-cover-upload-hint {
  opacity: 1;
}

.detail-cover-banner + .hero-bar {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Hero Action Bar */
.hero-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 0;
}

.hero-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(225,166,93,0.15), rgba(225,166,93,0.05));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
  padding: 8px;
}

.hero-icon svg {
  width: 100%;
  height: 100%;
}

.hero-info {
  flex: 1;
  min-width: 0;
}

.hero-title {
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.hero-desc {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}

.hero-desc .inline-edit-btn {
  opacity: 0;
}

.hero-desc:hover .inline-edit-btn {
  opacity: 0.7;
}

.hero-desc-empty {
  font-style: italic;
  opacity: 0.5;
  cursor: pointer;
}

.hero-info .inline-editor {
  margin-top: 0.375rem;
  max-width: 480px;
}

.hero-info .inline-edit-textarea {
  font-size: 0.8125rem;
  min-height: 2.5rem;
  resize: vertical;
}

.hero-meta svg {
  width: 12px;
  height: 12px;
}

/* Inline editable elements */
.inline-editable {
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.inline-editable:hover {
  background: rgba(255, 255, 255, 0.05);
}

.hero-title .inline-editable {
  padding: 0 0.25rem;
  margin: 0 -0.25rem;
  border-radius: var(--radius);
}

.hero-title-editor {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.hero-title-input {
  font-size: 1.25rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  flex: 1;
  min-width: 0;
}

.hero-tags {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-top: 0.375rem;
}

.hero-tag-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.0625rem 0.5rem;
  border-radius: 9999px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.hero-tag-add-btn:hover {
  background: rgba(225, 166, 93, 0.15);
  color: var(--primary);
}

/* Tag modal option rows */
.tag-modal-option {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s;
}

.tag-modal-option:hover {
  background: var(--muted);
}

.tag-modal-option-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.tag-modal-option.selected .tag-modal-option-check {
  background: var(--primary);
  border-color: var(--primary);
}

.tag-modal-option-check svg {
  width: 12px;
  height: 12px;
  color: var(--primary-foreground);
  display: none;
}

.tag-modal-option.selected .tag-modal-option-check svg {
  display: block;
}

.tag-modal-option-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tag-modal-option-name {
  font-size: 0.875rem;
}

.tag-color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
  flex-shrink: 0;
}

.tag-color-swatch:hover {
  transform: scale(1.15);
}

.tag-color-swatch.active {
  border-color: var(--foreground);
  box-shadow: 0 0 0 1px var(--background);
}

.hero-stats {
  display: flex;
  gap: 1.5rem;
  padding: 0 1.5rem;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}

.hero-stat {
  text-align: center;
}

.hero-stat-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
}

.hero-stat-label {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.hero-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

/* Content grid: sidebar + main */
.content-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
  align-items: start;
}

/* Sidebar card */
.sidebar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: 4.5rem;
  align-self: start;
}

.sidebar-card .sidebar-section {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-card .sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-card .sidebar-section-title {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: 0.375rem;
  padding: 0;
}

.sidebar-desc {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.5;
  margin: 0;
}

.sidebar-kv {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-kv-label {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

.sidebar-kv-value {
  font-size: 0.8125rem;
  color: var(--foreground);
}

/* Inline editing */
.inline-edit-btn {
  background: none;
  border: none;
  padding: 0;
  margin-left: 0.375rem;
  color: var(--muted-foreground);
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms, color 150ms;
  vertical-align: middle;
  line-height: 1;
}

.inline-edit-btn svg {
  width: 11px;
  height: 11px;
}

.sidebar-section:hover .inline-edit-btn {
  opacity: 0.7;
}

.inline-edit-btn:hover {
  opacity: 1 !important;
  color: var(--primary);
}

.inline-editor {
  margin-top: 0.375rem;
}

.inline-edit-textarea {
  font-size: 0.8125rem;
  min-height: 3rem;
  resize: vertical;
}

.inline-edit-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.375rem;
  justify-content: flex-end;
}

.inline-save-indicator {
  font-size: 0.6875rem;
  color: var(--success);
  margin-right: auto;
  animation: fadeInOut 1.5s ease;
}

@keyframes fadeInOut {
  0% { opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

.sidebar-no-content {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.inline-visibility-toggle {
  display: flex;
  align-items: center;
  gap: 0;
}

.inline-toggle-option {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--border);
  transition: background 150ms, color 150ms;
}

.inline-toggle-option:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.inline-toggle-option:last-of-type {
  border-radius: 0 var(--radius) var(--radius) 0;
  border-left: none;
}

.inline-toggle-option input[type="radio"] {
  display: none;
}

.inline-toggle-option:has(input:checked) {
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  border-color: var(--primary);
  color: var(--primary);
}

.inline-toggle-option:has(input:checked) + .inline-toggle-option:not(:has(input:checked)) {
  border-left: 1px solid var(--border);
}

.inline-toggle-option:not(:has(input:checked)) + .inline-toggle-option:has(input:checked) {
  border-left: 1px solid var(--primary);
}

/* Sidebar tag picker (inline, not absolute) */
.sidebar-tag-picker {
  margin-top: 0.5rem;
}

.sidebar-tag-dropdown {
  position: static !important;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  z-index: auto;
}

/* Detail page main content area */
.detail-main {
  min-width: 0;
}

.input-pill {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--muted);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  margin-bottom: 0.375rem;
}

.input-pill:last-child {
  margin-bottom: 0;
}

.input-pill svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.input-pill .pill-content {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.input-pill .pill-name {
  font-weight: 500;
}

.input-pill .pill-spec {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

/* Toggle switch (used in hero bar) */

.toggle-switch {
  width: 56px;
  height: 24px;
  background: var(--success);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  transition: background 200ms ease;
}

.toggle-switch::before {
  content: 'ON';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  font-weight: 700;
  color: white;
  letter-spacing: 0.05em;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 33px;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: white;
  transition: left 200ms ease;
}

.toggle-switch.off {
  background: var(--border);
}

.toggle-switch.off::before {
  content: 'OFF';
  left: auto;
  right: 7px;
  color: var(--muted-foreground);
}

.toggle-switch.off::after {
  left: 3px;
}

/* Section cards */
.detail-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 0.75rem;
}

.detail-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.detail-section-title {
  font-size: 0.9375rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-section-title svg {
  width: 18px;
  height: 18px;
  color: var(--muted-foreground);
}

.detail-section-body {
  padding: 0.75rem 1rem;
}

/* Collapsible section */
.detail-section-header.collapsible {
  cursor: pointer;
  transition: background 150ms ease;
}

.detail-section-header.collapsible:hover {
  background: var(--muted);
}

.detail-section-header .section-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted-foreground);
  transition: transform 200ms ease;
}

.detail-section-header.open .section-chevron {
  transform: rotate(180deg);
}

/* Execution table */
.exec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.exec-table thead th {
  padding: 0.5rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

.exec-th-sortable {
  cursor: pointer;
}

.exec-th-sortable:hover {
  color: var(--foreground);
}

.exec-th-sortable .sort-icon {
  width: 12px;
  height: 12px;
  vertical-align: middle;
  opacity: 0.3;
  transition: opacity 150ms, transform 150ms;
}

.exec-th-sortable[data-sort-active] .sort-icon {
  opacity: 1;
  color: var(--primary);
}

.exec-th-sortable.sorted-asc .sort-icon {
  transform: rotate(180deg);
}

.exec-table tbody tr {
  cursor: pointer;
  transition: background 100ms ease;
}

.exec-table tbody tr:hover {
  background: var(--muted);
}

.exec-table tbody tr:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.exec-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  white-space: nowrap;
}

.exec-table td code {
  font-size: 0.75rem;
}

.exec-table td .badge {
  font-size: 0.625rem;
}

.exec-table .exec-time {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.exec-table .exec-duration {
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
}

.exec-table .exec-via {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

/* Status dot (inline, for exec table) */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.375rem;
  vertical-align: middle;
  background: var(--muted-foreground);
}

.detail-section-body:has(.exec-table) {
  padding: 0;
}

.status-dot.dot-success { background: var(--success); }
.status-dot.dot-failed { background: var(--destructive); }
.status-dot.dot-running { background: var(--primary); }
.status-dot.dot-timeout { background: var(--warning, #f59e0b); }
.status-dot.dot-pending { background: var(--muted-foreground); }

/* Parameter grid */
.param-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.param-item {
  padding: 0.625rem 0.75rem;
  background: var(--muted);
  border-radius: var(--radius);
}

.param-item .param-name {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.125rem;
}

.param-item .param-value {
  font-size: 0.8125rem;
  font-weight: 500;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.param-item .param-type {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--info);
  background: rgba(34, 211, 238, 0.1);
  padding: 0.0625rem 0.4rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}

.param-item .param-desc {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
  line-height: 1.3;
}

/* Analytic list items */
.analytic-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}

.analytic-item:last-child {
  border-bottom: none;
}

.analytic-icon {
  width: 36px;
  height: 36px;
  background: var(--muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.analytic-icon svg {
  width: 18px;
  height: 18px;
  color: var(--muted-foreground);
}

.analytic-info {
  flex: 1;
  min-width: 0;
}

.analytic-info .analytic-name {
  font-size: 0.8125rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.analytic-info .analytic-meta {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

.analytic-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Tech details table (key-value) */
.kv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.kv-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.kv-table tr:last-child td {
  border-bottom: none;
}

.kv-table .kv-label {
  color: var(--muted-foreground);
  width: 160px;
  font-size: 0.8125rem;
}

/* ============================================
   TAB BAR
   ============================================ */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--foreground);
}

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

.tab-btn svg {
  color: inherit;
}

/* Tab panes */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* ============================================
   STAT CARDS
   ============================================ */
.stat-cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.stat-card-icon {
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.stat-card-content {
  min-width: 0;
}

.stat-card-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.2;
}

.stat-card-label {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================
   OVERVIEW CARDS
   ============================================ */
.overview-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 0.75rem;
}

.overview-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.overview-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.overview-card-body {
  padding: 1rem 1.25rem;
}

.overview-card-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0 0 0.5rem;
}

.overview-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.6;
  white-space: pre-line;
}

.overview-description-empty {
  font-style: italic;
  opacity: 0.5;
  cursor: pointer;
}

.overview-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.overview-row-2col .overview-card {
  margin-bottom: 0;
}

/* ── Overview hero block (description + meta strip) ── */
.overview-hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.overview-hero-desc {
  padding: 1rem 1.25rem;
}

.overview-meta-strip {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.625rem 1.25rem;
  border-top: 1px solid var(--border-light);
  background: rgba(255,255,255,0.015);
  flex-wrap: wrap;
}

.meta-strip-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.meta-strip-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.meta-strip-separator {
  width: 1px;
  height: 16px;
  background: var(--border-light);
  flex-shrink: 0;
}

.meta-strip-vis {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.1875rem 0.5rem;
  background: var(--muted);
  border-radius: var(--radius);
  font-size: 0.75rem;
  cursor: pointer;
  border: none;
  color: var(--muted-foreground);
  transition: background 0.15s;
}

.meta-strip-vis:hover {
  background: var(--border-light);
}

.meta-strip-vis svg {
  width: 12px;
  height: 12px;
}

.meta-strip-test {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.meta-strip-test.test-passing { color: var(--success); }
.meta-strip-test.test-failing { color: var(--destructive); }
.meta-strip-test.test-none { color: var(--muted-foreground); font-weight: 400; }

.add-tag-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.4375rem;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 999px;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s;
}

.add-tag-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* View All link for executions */
.view-all-link {
  padding: 0.5rem 0.75rem;
  text-align: right;
  border-top: 1px solid var(--border-light);
}

/* ============================================
   HEADER OVERFLOW MENU
   ============================================ */
.hero-actions {
  position: relative;
}

.header-overflow-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  min-width: 160px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 50;
  padding: 0.25rem 0;
}

.overflow-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--foreground);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 100ms;
}

.overflow-menu-item:hover {
  background: var(--muted);
}

.overflow-menu-item-danger {
  color: var(--destructive);
}

/* ============================================
   EXECUTIONS TAB FILTERS
   ============================================ */
.exec-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.exec-filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.exec-status-filter {
  width: 160px;
  font-size: 0.8125rem;
}

.exec-search-wrapper {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted-foreground);
}

.exec-search-wrapper .form-input {
  border: none;
  background: none;
  padding: 0.375rem 0;
  font-size: 0.8125rem;
  width: 180px;
}

.exec-search-wrapper .form-input:focus {
  box-shadow: none;
}

.exec-id-copyable {
  cursor: pointer;
  transition: color 100ms;
}

.exec-id-copyable:hover {
  color: var(--primary);
}

/* Pagination */
.exec-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--border-light);
}

.exec-pagination-info {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.exec-pagination-buttons {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.exec-pagination-buttons .btn {
  min-width: 32px;
  justify-content: center;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.exec-pagination-buttons .exec-page-active {
  background: var(--primary);
  color: var(--background);
}

.exec-pagination-buttons .exec-page-active:hover {
  background: var(--primary);
}

.exec-pagination-ellipsis {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  padding: 0 0.25rem;
}

/* ============================================
   DANGER ZONE
   ============================================ */
.danger-zone {
  border: 1px solid var(--destructive);
  border-radius: var(--radius-lg);
  margin-top: 1.5rem;
  overflow: hidden;
}

.danger-zone-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}

.danger-zone-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--destructive);
  margin: 0;
}

.danger-zone-body {
  padding: 0;
}

.danger-zone-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  gap: 1.5rem;
}

.danger-zone-item-title {
  font-size: 0.8125rem;
  font-weight: 500;
}

.danger-zone-item-desc {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

/* ============================================
   SETTINGS FORM
   ============================================ */
.settings-form .form-group {
  margin-bottom: 1rem;
}

.settings-form .form-group:last-of-type {
  margin-bottom: 0;
}

.settings-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
  margin-top: 1rem;
}

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

/* Large screens: hero actions wrap to second row */
@media (max-width: 1400px) {
  .hero-bar {
    flex-wrap: wrap;
  }

  .hero-actions {
    width: 100%;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
  }
}

/* Medium screens: single-column content, compact hero */
@media (max-width: 1100px) {
  .stat-cards-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .overview-row-2col {
    grid-template-columns: 1fr;
  }

  .overview-meta-strip {
    gap: 0.75rem;
  }
}

/* Small screens / mobile */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .card-grid-2,
  .card-grid-3 {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
  }

  .global-search {
    margin: 0 0.75rem;
  }

  .global-search-shortcut {
    display: none;
  }

  .user-email {
    display: none;
  }

  .hero-bar {
    padding: 1rem;
    gap: 0.75rem;
  }

  .hero-icon {
    width: 40px;
    height: 40px;
  }

  .hero-title {
    font-size: 1.0625rem;
  }

  .hero-actions .btn span,
  .hero-actions .btn:not(.btn-icon):not(.btn-sm) {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }

  .hero-divider {
    display: none;
  }

  .detail-top-bar {
    margin-bottom: 0.75rem;
  }

  .param-grid {
    grid-template-columns: 1fr;
  }

  .stat-cards-row {
    grid-template-columns: 1fr 1fr;
  }

  .tab-btn {
    padding: 0.625rem 0.75rem;
    font-size: 0.75rem;
  }

  .overview-row-2col {
    grid-template-columns: 1fr;
  }

  .meta-strip-separator {
    display: none;
  }

  .overview-meta-strip {
    gap: 0.5rem 1rem;
  }
}


/* ============================================
   ANALYSIS TYPE SYSTEM (Glass Panels)
   ============================================ */

:root {
  --type-color-code: #4ade80;
  --type-color-llm: #60a5fa;
  --type-color-notebook: #facc15;
}

/* --- Card accent bar (always primary/orange) --- */
.analysis-card .card-accent { background: var(--primary); }
.analysis-card .card-cover-accent { background: var(--primary); }

/* --- Card hover glow (always primary/orange) --- */
.analysis-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 20px -4px rgba(225, 166, 93, 0.18);
}

/* --- Card type label (dot + text) --- */
.card-type-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.25rem;
}

.card-type-row > :last-child {
  margin-left: auto;
}

.card-type-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--type-color, var(--muted-foreground));
}

.card-type-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--type-color, var(--muted-foreground));
  flex-shrink: 0;
}

/* --- Type badge (hero, execution bar) --- */
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.type-badge-code {
  background: rgba(163, 163, 163, 0.12);
  color: var(--type-color-code);
}

.type-badge-llm {
  background: rgba(225, 166, 93, 0.14);
  color: var(--type-color-llm);
}

/* --- Certification tier badges --- */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.tier-badge svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.tier-badge-certified {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.tier-badge-verified {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.tier-badge-community {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
}

.tier-badge-tip {
  position: relative;
  cursor: help;
}

.tier-badge-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.5;
  white-space: normal;
  text-align: left;
  z-index: 100;
  pointer-events: none;
}

.tier-badge-tip:hover .tier-badge-tooltip {
  display: block;
}

/* --- Segmented control (create form) --- */
.segmented-control {
  display: inline-flex;
  width: 100%;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3px;
  gap: 2px;
}

.segmented-control-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.55rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted-foreground);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-lg) - 3px);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.segmented-control-btn:hover {
  color: var(--foreground);
  background: rgba(255, 255, 255, 0.04);
}

.segmented-control-btn.active {
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  font-weight: 600;
}

.segmented-control-btn.active[data-type="llm"] { color: var(--type-color-llm); }

.seg-sublabel {
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--muted-foreground);
}

.segmented-control-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.5;
}

.segmented-control-btn.active .segmented-control-dot { opacity: 1; }

/* --- Glass config section (LLM create form) --- */
.glass-config-section {
  position: relative;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1.25rem;
  overflow: hidden;
}

.glass-config-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.glass-config-section[data-type="llm"]::before {
  background: linear-gradient(90deg, var(--type-color-llm), transparent 80%);
}

.glass-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.glass-section-icon {
  width: 18px;
  height: 18px;
}

/* --- Instruction placeholder chips --- */
.instruction-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.45rem 0.6rem;
  background: rgba(225, 166, 93, 0.04);
  border: 1px solid rgba(225, 166, 93, 0.12);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: none;
}

.instruction-chips-label {
  font-size: 0.65rem;
  color: var(--muted-foreground);
  font-weight: 500;
  margin-right: 0.25rem;
  white-space: nowrap;
}

.instruction-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.68rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  background: rgba(225, 166, 93, 0.1);
  color: var(--primary);
  border: 1px solid rgba(225, 166, 93, 0.22);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.instruction-chip:hover {
  background: rgba(225, 166, 93, 0.2);
  border-color: var(--primary);
}

.instruction-chip i { width: 10px; height: 10px; }

.textarea-chip-attached {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  border-top: none !important;
}

/* --- Config card rows (sidebar, detail) --- */
.type-config-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-top: 0.5rem;
}

.config-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 0.78rem;
}

.config-card-row:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.config-card-label { color: var(--muted-foreground); }
.config-card-value { font-weight: 500; }

/* --- Instructions preview (detail page) --- */
.instructions-preview {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted-foreground);
  white-space: pre-wrap;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  max-height: 160px;
  overflow-y: auto;
}

/* --- Token strip (LLM execution detail) --- */
.token-strip {
  display: flex;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}

.token-strip-cell {
  flex: 1;
  padding: 0.65rem 0.85rem;
  text-align: center;
  border-right: 1px solid var(--border);
}

.token-strip-cell:last-child { border-right: none; }

.token-strip-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  margin-bottom: 0.15rem;
  font-weight: 600;
}

.token-strip-value {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* --- Prompt collapsible (LLM execution detail) --- */
.prompt-collapsible { margin-bottom: 1rem; }

.prompt-collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.15s;
}

.prompt-collapsible-header:hover { background: var(--muted); }
.prompt-collapsible.open .prompt-collapsible-header { border-radius: var(--radius) var(--radius) 0 0; }
.prompt-collapsible.open .prompt-collapsible-header i:last-child { transform: rotate(180deg); }

.prompt-collapsible-body {
  display: none;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.01);
}

.prompt-collapsible.open .prompt-collapsible-body { display: block; }

.prompt-collapsible-body pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--muted-foreground);
  line-height: 1.6;
  margin: 0;
}

.token-expiry-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: var(--info);
  background: rgba(34, 211, 238, 0.08);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(34, 211, 238, 0.15);
}

/* --- Input row for dynamic LLM inputs --- */
.type-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.type-input-row .form-input { flex: 1; }

/* ============================================
   FEEDBACK SYSTEM
   ============================================ */

.feedback-list { display: flex; flex-direction: column; gap: 0.75rem; }

.feedback-card {
  background: var(--background-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  transition: border-color var(--transition);
  cursor: pointer;
}
.feedback-card:hover { border-color: var(--border); }
.feedback-card.expanded { border-color: var(--primary); cursor: default; }

.feedback-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.feedback-type-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.feedback-type-icon svg { width: 16px; height: 16px; }
.feedback-type-icon.type-bug { background: rgba(239,68,68,0.15); color: var(--destructive); }
.feedback-type-icon.type-feature { background: rgba(59,130,246,0.15); color: #3b82f6; }
.feedback-type-icon.type-use-case { background: rgba(245,158,11,0.15); color: var(--warning); }
.feedback-type-icon.type-general { background: rgba(163,163,163,0.15); color: var(--muted-foreground); }

.feedback-main { flex: 1; min-width: 0; }
.feedback-title-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.feedback-title { font-weight: 600; font-size: 0.925rem; }
.feedback-meta {
  display: flex; align-items: center; gap: 0.5rem;
  color: var(--muted-foreground); font-size: 0.8rem;
}
.feedback-meta-sep { opacity: 0.4; }
.feedback-right {
  display: flex; align-items: center; gap: 0.5rem;
  flex-shrink: 0;
}

.feedback-expanded {
  margin-top: 1rem; padding-top: 1rem;
  border-top: 1px solid var(--border-light);
  display: none;
}
.feedback-card.expanded .feedback-expanded { display: block; }

.feedback-description {
  color: var(--foreground); font-size: 0.875rem;
  line-height: 1.65; margin-bottom: 1rem;
  white-space: pre-wrap;
}

/* Context snapshot panel */
.feedback-context-panel {
  background: var(--muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
}
.feedback-context-title {
  font-size: 0.75rem; font-weight: 600; color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.feedback-context-title svg { width: 12px; height: 12px; }
.feedback-context-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1.5rem;
}
.feedback-context-label {
  font-size: 0.7rem; color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.feedback-context-value {
  font-size: 0.8rem; color: var(--foreground); font-weight: 500;
}
.feedback-context-value.mono {
  font-family: var(--font-mono); font-size: 0.75rem;
}
.feedback-context-error {
  margin-top: 0.75rem; padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
}
.feedback-context-error pre {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono); font-size: 0.75rem;
  color: #fca5a5; overflow-x: auto;
  white-space: pre-wrap; word-break: break-word;
}

.feedback-actions {
  display: flex; align-items: center; gap: 0.5rem;
  justify-content: flex-end;
}

/* AI Copy button */
.btn-ai-copy {
  background: linear-gradient(135deg, rgba(168,85,247,0.15), rgba(59,130,246,0.15));
  color: #c4b5fd; border: 1px solid rgba(168,85,247,0.3);
}
.btn-ai-copy:hover {
  background: linear-gradient(135deg, rgba(168,85,247,0.25), rgba(59,130,246,0.25));
  border-color: rgba(168,85,247,0.5);
}

/* Status badges for feedback */
.badge-fb-open { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-fb-acknowledged { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-fb-resolved { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-fb-wont-fix { background: rgba(163,163,163,0.15); color: var(--muted-foreground); }

/* Feedback tab badge */
.tab-badge {
  background: var(--destructive); color: white;
  font-size: 0.65rem; font-weight: 600;
  padding: 0.1rem 0.4rem; border-radius: var(--radius-full);
  min-width: 18px; text-align: center;
}

/* Status dropdown */
.feedback-status-select {
  background: var(--secondary); color: var(--foreground);
  border: 1px solid var(--border-light); border-radius: var(--radius);
  padding: 0.3rem 0.5rem; font-size: 0.75rem; font-family: var(--font-sans);
  cursor: pointer;
}

/* Feedback type selector in modal */
.feedback-type-selector {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.feedback-type-option {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  padding: 0.6rem 0.5rem;
  background: var(--muted); border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.7rem; font-weight: 500; color: var(--muted-foreground);
  transition: all var(--transition-fast);
  cursor: pointer;
}
.feedback-type-option:hover { border-color: var(--border); color: var(--foreground); }
.feedback-type-option.selected { border-color: var(--primary); color: var(--foreground); }
.feedback-type-option svg { width: 18px; height: 18px; }

/* Feedback context preview in modal */
.feedback-context-preview {
  background: var(--muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
}
.feedback-context-preview-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.feedback-context-preview-title {
  font-size: 0.75rem; font-weight: 600; color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: 0.05em;
  display: flex; align-items: center; gap: 0.4rem;
}
.feedback-context-preview-title svg { width: 12px; height: 12px; }
.feedback-context-preview-badge {
  font-size: 0.65rem; padding: 0.1rem 0.4rem;
  background: rgba(34,197,94,0.15); color: var(--success);
  border-radius: var(--radius-full); font-weight: 500;
}
.feedback-context-row {
  display: flex; align-items: baseline; gap: 0.5rem;
  padding: 0.2rem 0; font-size: 0.8rem;
}
.feedback-context-row-label {
  color: var(--muted-foreground); font-size: 0.75rem;
  min-width: 90px; flex-shrink: 0;
}
.feedback-context-row-value { color: var(--foreground); font-weight: 500; }
.feedback-context-note {
  margin-top: 0.5rem; font-size: 0.7rem; color: var(--muted-foreground);
  font-style: italic;
  display: flex; align-items: center; gap: 0.35rem;
}
.feedback-context-note svg { width: 12px; height: 12px; flex-shrink: 0; }

/* Feedback empty state */
.feedback-empty {
  text-align: center; padding: 3rem 1rem;
  color: var(--muted-foreground);
}
.feedback-empty svg { width: 48px; height: 48px; margin-bottom: 1rem; opacity: 0.3; }
.feedback-empty h3 { font-size: 1rem; font-weight: 500; margin-bottom: 0.25rem; color: var(--foreground); }
.feedback-empty p { font-size: 0.85rem; }

/* Filter bar for feedback tab */
.feedback-filter-bar {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 1.25rem; flex-wrap: wrap;
}
.feedback-filter-select {
  background: var(--secondary); color: var(--foreground);
  border: 1px solid var(--border-light); border-radius: var(--radius);
  padding: 0.4rem 0.75rem; font-size: 0.8rem; font-family: var(--font-sans);
  cursor: pointer;
}
.feedback-filter-select:focus { outline: none; border-color: var(--primary); }
.feedback-filter-count { color: var(--muted-foreground); font-size: 0.8rem; margin-left: auto; }

@media (max-width: 640px) {
  .feedback-context-grid { grid-template-columns: 1fr; }
  .feedback-type-selector { grid-template-columns: repeat(2, 1fr); }
}
