:root {
  --primary: hsl(166, 100%, 20%);
  --primary-light: hsl(166, 80%, 26%);
  --primary-foreground: hsl(0, 0%, 100%);
  --secondary: hsl(30, 4%, 95%);
  --secondary-foreground: hsl(30, 3%, 44%);
  --background: hsl(0, 0%, 100%);
  --foreground: hsl(30, 3%, 44%);
  --accent: hsl(217, 91%, 60%);
  --accent-foreground: hsl(0, 0%, 100%);
  --destructive: hsl(0, 70%, 50%);
  --warning: hsl(38, 80%, 50%);
  --warning-foreground: hsl(38, 80%, 14%);
  --success: hsl(152, 90%, 33%);
  --muted: hsl(30, 3%, 95%);
  --muted-foreground: hsl(30, 3%, 55%);
  --border: hsl(213, 30%, 88%);
  --input: hsl(213, 30%, 88%);
  --ring: hsl(213, 52%, 52%);
  --card: hsl(30, 3%, 97%);
  --card-foreground: hsl(30, 3%, 44%);
  --font-sans: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
  --font-serif: 'DM Serif Display', ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --radius: 0.5rem;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100vh; display: flex; flex-direction: column; overflow: hidden; font-family: var(--font-sans); background: var(--background); color: var(--foreground); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.btn { display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; cursor: pointer; transition: all 0.15s; border: none; font-family: var(--font-sans); font-weight: 600; }
.btn-sm { height: 32px; padding: 0 16px; font-size: 0.8rem; gap: 6px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-danger { background: var(--destructive); color: white; }
.btn-ghost { background: transparent; color: var(--muted-foreground); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--secondary); color: var(--foreground); border-color: var(--border); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.text-sm { font-size: 0.875rem; }
.font-mono { font-family: var(--font-mono); }
.text-muted { color: var(--muted-foreground); }
.text-primary { color: var(--primary); }
.border-b { border-bottom: 1px solid var(--border); }
.app-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.navbar { height: 56px; border-bottom: 1px solid var(--border); background: var(--background); display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 50; }
.main-content { flex: 1; min-height: 0; display: flex; flex-direction: row; overflow: hidden; }
.left-panel { background: var(--card); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overflow-x: hidden; height: 100%; padding-bottom: 16px; }
.panel-section { padding: 16px; border-bottom: 1px solid var(--border); }
.panel-section:last-child { border-bottom: none; }
.panel-label { font-family: var(--font-mono); font-size: 0.65rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-foreground); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.panel-label-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.data-sources-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.data-source-card { min-height: 88px; border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); background: linear-gradient(180deg, #ffffff 0%, var(--card) 100%); padding: 10px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.data-source-card.clickable { cursor: pointer; }
.data-source-card.clickable:hover { border-color: var(--primary); box-shadow: 0 8px 20px hsl(166 100% 20% / 0.08); }
.data-source-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.data-source-card-icon { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.88rem; }
.data-source-card-icon.web { background: hsl(217 91% 60% / 0.1); color: var(--accent); }
.data-source-card-icon.file { background: hsl(38 80% 50% / 0.1); color: var(--warning); }
.data-source-card-icon.live { background: hsl(166 100% 20% / 0.1); color: var(--primary); }
.data-source-card-icon.other { background: hsl(30 3% 44% / 0.08); color: var(--foreground); }
.data-source-card-remove { width: 20px; height: 20px; border: none; border-radius: 999px; background: transparent; color: var(--muted-foreground); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: background 0.12s, color 0.12s; }
.data-source-card-remove:hover { background: var(--secondary); color: var(--foreground); }
.data-source-card-title { font-size: 0.74rem; font-weight: 600; color: var(--foreground); line-height: 1.3; }
.data-source-card-meta { font-family: var(--font-mono); font-size: 0.58rem; color: var(--muted-foreground); line-height: 1.35; }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 10001; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal-overlay.active { display: flex; }
.modal { width: min(560px, calc(100vw - 32px)); max-height: min(620px, calc(100vh - 40px)); background: #fff; border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,0.18); border: 1px solid rgba(0,0,0,0.06); overflow: hidden; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 16px; border-top: 1px solid var(--border); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px; background: var(--border); cursor: pointer; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--primary); cursor: pointer; border: 2px solid var(--background); box-shadow: 0 0 0 1px var(--primary); }
.tab-bar { display: flex; border-bottom: 1px solid var(--border); background: var(--card); flex-shrink: 0; }
.tab-btn { flex: 1; padding: 10px 4px; border: none; background: none; cursor: pointer; border-bottom: 2px solid transparent; font-size: 0.8rem; color: var(--foreground); transition: all 0.15s; }
.tab-btn.active { border-bottom-color: var(--primary); font-weight: bold; }
.tab-btn:hover:not(.active) { background: var(--secondary); }
.search-textarea { width: 100%; min-height: 120px; border: none; outline: none; resize: none; font-family: var(--font-sans); font-size: 0.92rem; line-height: 1.55; color: hsl(30, 3%, 22%); background: transparent; padding: 12px 14px; }
.results-area { flex: 1; min-height: 0; overflow: hidden; padding: 20px 24px; background: var(--background); display: flex; flex-direction: column; }
.progress-dashboard { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.progress-stats { display: flex; gap: 16px; }
.stat-box { background: var(--card); border: 1px solid var(--border); padding: 10px 14px; border-radius: calc(var(--radius) - 2px); display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.stat-box-value { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 600; color: var(--primary); }
.stat-box-label { font-family: var(--font-mono); color: var(--muted-foreground); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; }
.progress-log { flex: 1; min-height: 100px; overflow-y: auto; font-family: var(--font-mono); font-size: 0.75rem; background: hsl(30, 3%, 98%); border: 1px solid var(--border); border-radius: 4px; padding: 10px; }
.log-entry { color: var(--foreground); word-break: break-all; line-height: 1.4; margin-bottom: 4px; }
.thinking-dots { display: flex; gap: 4px; }
.thinking-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); animation: dot-bounce 1.4s ease-in-out infinite; }
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }
.data-sources-add-btn { width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 999px; background: var(--background); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.12s, border-color 0.12s; }
.data-sources-add-btn:hover { background: var(--secondary); border-color: var(--primary); }
.data-source-empty { grid-column: 1 / -1; min-height: 96px; border: 1.5px dashed var(--border); border-radius: calc(var(--radius) + 2px); background: linear-gradient(180deg, #ffffff 0%, var(--card) 100%); padding: 12px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px; cursor: pointer; transition: background 0.12s, border-color 0.12s; }
.data-source-empty:hover { background: var(--secondary); border-color: var(--primary); }
.upload-toast { position: fixed; bottom: 24px; right: 24px; background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); display: flex; align-items: center; gap: 10px; z-index: 200; transform: translateY(100px); opacity: 0; transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); min-width: 240px; }
.upload-toast.show { transform: translateY(0); opacity: 1; }
.ds-card { border: 1px solid #E0E0E0; border-radius: 6px; padding: 16px; text-align: center; cursor: pointer; transition: all 0.2s; background: #FFF; }
.ds-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.12); border-color: #B3B3B3; transform: translateY(-1px); }
.ds-tab { padding: 8px 12px; margin-bottom: 4px; cursor: pointer; border-radius: 4px; font-size: 14px; color: #333; transition: background 0.1s; }
.ds-tab.active { background: #107C41; color: #FFF !important; font-weight: 500; }
.ds-tab:not(.active):hover { background: #EBEBEB; }

/* --- MOBILE RESPONSIVE PATTERNS --- */

/* Base mobile-first, then scale up */
@media (max-width: 768px) {
  /* Layout shifts to vertical stack */
  .main-content {
    flex-direction: column;
  }

  .left-panel {
    width: 100%;
    height: auto;
    max-height: 60vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  /* Navbar compact */
  .navbar {
    height: 48px;
    padding: 0 16px;
    gap: 12px;
  }

  .navbar-logo-text {
    font-size: 1rem;
  }

  .navbar-logo-icon {
    width: 24px;
    height: 24px;
  }

  /* Data grids single column on mobile */
  .data-sources-grid {
    grid-template-columns: 1fr;
  }

  /* Full width buttons */
  .btn {
    width: 100%;
    justify-content: center;
  }

  /* Panels stack */
  .panel-section {
    padding: 12px;
  }

  /* Search area compact */
  .search-area {
    padding: 16px;
  }

  .search-textarea {
    min-height: 80px;
    font-size: 16px; /* prevent zoom on iOS */
  }

  /* Results area */
  .results-area {
    padding: 16px;
  }

  /* Stats horizontal scroll */
  .progress-stats {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

  .stat-box {
    min-width: 100px;
    flex-shrink: 0;
  }

  /* Modals full screen on mobile */
  .modal {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  /* Tab bar scrollable */
  .tab-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    flex: 0 0 auto;
    padding: 10px 16px;
    white-space: nowrap;
  }

  /* Touch targets min 44px */
  .data-source-card-remove,
  .data-sources-add-btn,
  input[type="range"]::-webkit-slider-thumb {
    min-width: 44px;
    min-height: 44px;
  }

  /* Gutter hidden on mobile (no resize) */
  .gutter {
    display: none;
  }

  /* SpreadJS wrapper full width */
  #gc-designer-wrapper {
    width: 100%;
    height: 50vh;
  }

  /* Mobile menu toggle */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--foreground);
    cursor: pointer;
  }

  /* Collapsed state for left panel */
  .left-panel.collapsed {
    max-height: 56px;
    overflow: hidden;
  }

  .left-panel.collapsed .panel-section {
    display: none;
  }

  .left-panel.collapsed .tab-bar {
    display: flex;
  }

  /* Panel header for mobile collapse */
  .panel-header-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
  }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .data-sources-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop - full layout */
@media (min-width: 1025px) {
  .mobile-menu-toggle {
    display: none;
  }
}

/* Safe area insets for notched phones */
@supports (padding: max(0px)) {
  .navbar {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    padding-top: max(0px, env(safe-area-inset-top));
  }

  .upload-toast {
    bottom: max(24px, env(safe-area-inset-bottom));
    right: max(24px, env(safe-area-inset-right));
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .data-source-card,
  .ds-card,
  .tab-btn {
    min-height: 44px;
  }

  /* Remove hover effects that stick on touch */
  .data-source-card:hover,
  .ds-card:hover {
    transform: none;
    box-shadow: none;
  }

  /* Active state for touch */
  .data-source-card:active,
  .btn:active,
  .tab-btn:active {
    opacity: 0.7;
  }

  /* Disable text selection on interactive elements */
  .data-source-card,
  .btn,
  .tab-btn,
  .ds-card {
    user-select: none;
    -webkit-user-select: none;
  }
}

/* Landscape phone optimization */
@media (max-height: 500px) and (orientation: landscape) {
  .navbar {
    height: 40px;
  }

  .left-panel {
    max-height: 70vh;
  }

  .panel-section {
    padding: 8px 12px;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .upload-toast {
    transition: none;
  }
}



/* Extracted from index.html */


.gc-designer-ribbon-license-text { display: none !important; }
.ribbon-button-download-excel::before {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  margin: 0 auto;
  background: url("/app/logos/excel.svg") no-repeat center / contain;
}
.ribbon-button-open-excel::before {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  margin: 0 auto;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23217346' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E") no-repeat center / contain;
}
[data-id="SpreadJS Designer License"] { display: none !important; }
.gc-designer-dialog-title { font-size: 0 !important; }
.gc-designer-dialog-title::after { content: "Variance"; font-size: 14px; font-weight: 600; }
.gc-scroll-mobile-container { padding: 4px !important; }
.gc-scroll-mobile-container-vertical { width: 14px !important; }
.gc-scroll-mobile-container-horizontal { height: 14px !important; }
.gc-scroll-mobile-state-hover.gc-scroll-mobile-container-vertical { width: 18px !important; }
.gc-scroll-mobile-state-hover.gc-scroll-mobile-container-horizontal { height: 18px !important; }
.gc-scroll-mobile-thumb {
  background-color: rgba(0,0,0,0.2) !important;
  border-radius: 999px !important;
  border: none !important;
}
.gc-scroll-mobile-state-hover > .gc-scroll-mobile-thumb {
  background-color: rgba(0,0,0,0.4) !important;
}


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: hsl(166, 100%, 20%);
  --primary-light: hsl(166, 80%, 26%);
  --primary-foreground: hsl(0, 0%, 100%);
  --secondary: hsl(30, 4%, 95%);
  --secondary-foreground: hsl(30, 3%, 44%);
  --background: hsl(0, 0%, 100%);
  --foreground: hsl(30, 3%, 44%);
  --accent: hsl(217, 91%, 60%);
  --accent-foreground: hsl(0, 0%, 100%);
  --destructive: hsl(0, 70%, 50%);
  --warning: hsl(38, 80%, 50%);
  --warning-foreground: hsl(38, 80%, 14%);
  --success: hsl(152, 90%, 33%);
  --muted: hsl(30, 3%, 95%);
  --muted-foreground: hsl(30, 3%, 55%);
  --border: hsl(213, 30%, 88%);
  --input: hsl(213, 30%, 88%);
  --ring: hsl(213, 52%, 52%);
  --card: hsl(30, 3%, 97%);
  --card-foreground: hsl(30, 3%, 44%);
  --font-sans: 'DM Sans', ui-sans-serif, system-ui, sans-serif;
  --font-serif: 'DM Serif Display', ui-serif, Georgia, Cambria, 'Times New Roman', Times, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --radius: 0.5rem;
}
html, body {
  height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
  overscroll-behavior-x: none;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
#gc-designer-wrapper,
#gc-designer-container {
  overscroll-behavior: contain;
  overscroll-behavior-x: none;
}
.app-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.navbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.navbar-logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.navbar-logo-text {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.navbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}
.navbar-title {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted-foreground);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.navbar-spacer { flex: 1; }
.navbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted-foreground);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.navbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.main-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  align-items: stretch;
}
.left-panel {
  flex: 0 0 auto;
  min-width: 0;
  background: var(--card);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  padding-bottom: 16px;
  overscroll-behavior: contain;
}
#gc-designer-wrapper {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  overflow: hidden;
}
#gc-designer-container {
  width: 100%;
}
.panel-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.panel-section:last-child { border-bottom: none; }
.panel-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.panel-label-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}
.slider-row {
  margin-bottom: 14px;
}
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.slider-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--foreground);
}
.slider-value {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: 500;
  min-width: 28px;
  text-align: right;
}
.slider-desc {
  font-size: 0.7rem;
  color: var(--muted-foreground);
  margin-bottom: 6px;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  cursor: pointer;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--background);
  box-shadow: 0 0 0 1px var(--primary);
  transition: box-shadow 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 3px hsl(166 100% 20% / 0.15);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--background);
}
.source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background 0.1s;
  margin-bottom: 2px;
}
.source-item:hover { background: var(--secondary); }
.source-icon {
  width: 28px;
  height: 28px;
  border-radius: calc(var(--radius) - 2px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
}
.source-icon.web { background: hsl(217 91% 60% / 0.1); color: var(--accent); }
.source-icon.file { background: hsl(38 80% 50% / 0.1); color: var(--warning); }
.source-icon.live { background: hsl(166 100% 20% / 0.1); color: var(--primary); }
.source-info { flex: 1; min-width: 0; }
.source-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.source-meta {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted-foreground);
}
.source-toggle {
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  border: none;
  outline: none;
}
.source-toggle.on { background: var(--primary); }
.source-toggle::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.source-toggle.on::after { transform: translateX(12px); }
.data-sources-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.data-sources-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.data-sources-add-btn {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--background);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.data-sources-add-btn:hover {
  background: var(--secondary);
  border-color: var(--primary);
}
.data-source-card {
  min-height: 88px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(180deg, #ffffff 0%, var(--card) 100%);
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.data-source-card.clickable {
  cursor: pointer;
}
.data-source-card.clickable:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 20px hsl(166 100% 20% / 0.08);
}
.data-source-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.data-source-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
}
.data-source-card-icon.web { background: hsl(217 91% 60% / 0.1); color: var(--accent); }
.data-source-card-icon.file { background: hsl(38 80% 50% / 0.1); color: var(--warning); }
.data-source-card-icon.live { background: hsl(166 100% 20% / 0.1); color: var(--primary); }
.data-source-card-icon.other { background: hsl(30 3% 44% / 0.08); color: var(--foreground); }
.data-source-card-remove {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.data-source-card-remove:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.data-source-card-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.3;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.data-source-card-meta {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--muted-foreground);
  line-height: 1.35;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.data-source-empty {
  grid-column: 1 / -1;
  min-height: 96px;
  border: 1.5px dashed var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(180deg, #ffffff 0%, var(--card) 100%);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.data-source-empty:hover {
  background: var(--secondary);
  border-color: var(--primary);
}
.data-source-empty-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--foreground);
}
.data-source-empty-meta {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--muted-foreground);
}
.news-config-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 10001;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.news-config-modal {
  width: min(460px, calc(100vw - 32px));
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
  border: 1px solid rgba(0,0,0,0.06);
  overflow: hidden;
}
.news-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.news-config-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.news-config-label {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.news-source-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.news-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.news-source-name {
  font-size: 0.84rem;
  color: var(--foreground);
  font-weight: 500;
}
.news-source-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.news-source-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.news-source-btn:hover {
  background: var(--secondary);
  border-color: var(--primary);
}
.news-source-btn.active {
  background: hsl(166 100% 20% / 0.08);
  color: var(--primary);
  border-color: hsl(166 100% 20% / 0.25);
}
.news-source-state {
  min-width: 64px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--muted-foreground);
}
.news-config-hint {
  font-size: 0.72rem;
  color: var(--muted-foreground);
}
.news-config-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.validator-config-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 10001;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.validator-config-modal {
  width: min(560px, calc(100vw - 32px));
  max-height: min(620px, calc(100vh - 40px));
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
  border: 1px solid rgba(0,0,0,0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.validator-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.validator-config-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.validator-suggestion-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.validator-suggestion-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0%, var(--card) 100%);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.validator-suggestion-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--foreground);
}
.validator-suggestion-meta {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted-foreground);
  line-height: 1.45;
}
.validator-add-btn {
  flex-shrink: 0;
}
.validator-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.validator-detail-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.validator-detail-field.full {
  grid-column: 1 / -1;
}
.validator-detail-select,
.validator-detail-input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 10px;
  font-size: 0.82rem;
  color: var(--foreground);
  outline: none;
  background: #fff;
}
.validator-detail-select:focus,
.validator-detail-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px hsl(166 100% 20% / 0.08);
}
.validator-detail-help {
  font-size: 0.72rem;
  color: var(--muted-foreground);
  line-height: 1.45;
}
.saved-query-item {
  padding: 8px 10px;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s;
  margin-bottom: 4px;
}
.saved-query-item:hover {
  background: var(--secondary);
  border-color: var(--border);
}
.saved-query-name {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-query-meta {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted-foreground);
  display: flex;
  gap: 8px;
}
.sq-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 500;
}
.sq-badge.schedule { background: hsl(217 91% 60% / 0.1); color: var(--accent); }
.sq-badge.event { background: hsl(166 100% 20% / 0.1); color: var(--primary); }
.sq-badge.manual { background: var(--muted); color: var(--muted-foreground); }
.center-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}
.search-area {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}
.search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.search-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: hsl(30, 3%, 22%);
  letter-spacing: -0.02em;
}
.search-title em {
  font-style: italic;
  color: var(--primary);
}
.search-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn-ghost-sm {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--font-sans);
}
.btn-ghost-sm:hover {
  background: var(--secondary);
  color: var(--foreground);
  border-color: var(--border);
}
.btn-primary-sm {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 16px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-foreground);
  background: var(--primary);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
}
.btn-primary-sm:hover { background: var(--primary-light); }
.btn-primary-sm:active { transform: scale(0.98); }
#cancel-btn:hover { background: hsl(0, 80%, 45%) !important; }
#run-btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.search-input-wrapper {
  position: relative;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.search-input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px hsl(166 100% 20% / 0.08), 0 1px 3px rgba(0,0,0,0.06);
}
.search-input-top {
  display: flex;
  align-items: flex-start;
  padding: 12px 14px 8px 14px;
  gap: 10px;
}
.search-input-icon {
  margin-top: 2px;
  flex-shrink: 0;
  opacity: 0.4;
}
.search-textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  line-height: 1.55;
  color: hsl(30, 3%, 22%);
  background: transparent;
  min-height: 90px;
  max-height: 280px;
  overflow-y: auto;
}
.search-textarea::placeholder {
  color: var(--muted-foreground);
  font-style: italic;
}
.search-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px 10px 14px;
  border-top: 1px solid var(--muted);
  gap: 8px;
  flex-wrap: wrap;
}
.search-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}
.input-chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  flex: 1;
}
.input-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.1s;
  border: 1px solid transparent;
}
.input-chip.active {
  background: hsl(166 100% 20% / 0.08);
  color: var(--primary);
  border-color: hsl(166 100% 20% / 0.2);
}
.input-chip.inactive {
  background: var(--muted);
  color: var(--muted-foreground);
  border-color: var(--border);
}
.input-chip:hover { opacity: 0.75; }
.char-count {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.execution-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}
.exec-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--muted-foreground);
  transition: all 0.12s;
  font-family: var(--font-sans);
}
.exec-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.exec-tab:not(.active):hover {
  background: var(--secondary);
  color: var(--foreground);
}
.exec-spacer { flex: 1; }
.exec-config {
  display: flex;
  align-items: center;
  gap: 8px;
}
.exec-input-sm {
  height: 32px;
  padding: 0 10px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--foreground);
  background: var(--background);
  outline: none;
  width: 140px;
  transition: border-color 0.15s;
}
.exec-input-sm:focus { border-color: var(--primary); }
.exec-input-sm::placeholder { color: var(--muted-foreground); }
.drop-zone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--card);
  margin-top: 10px;
  position: relative;
  overflow: hidden;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: hsl(166 100% 20% / 0.03);
}
.drop-zone.dragover { border-style: solid; }
.drop-zone-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: hsl(166 100% 20% / 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}
.drop-zone-text { flex: 1; }
.drop-zone-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 2px;
}
.drop-zone-sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted-foreground);
}
.drop-zone-formats {
  display: flex;
  gap: 4px;
}
.format-tag {
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  background: var(--secondary);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
}
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.results-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 20px 24px;
  background: var(--background);
  display: flex;
  flex-direction: column;
}
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.results-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 12px;
}
.results-meta-sep { opacity: 0.4; }
.results-sort {
  display: flex;
  gap: 4px;
}
.sort-btn {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  color: var(--muted-foreground);
  transition: all 0.1s;
}
.sort-btn.active {
  background: var(--secondary);
  border-color: var(--border);
  color: var(--foreground);
}
.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--background);
  cursor: pointer;
  transition: all 0.12s;
  position: relative;
  overflow: hidden;
}
.result-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  transition: background 0.12s;
}
.result-card:hover {
  border-color: hsl(213 30% 80%);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.result-card:hover::before { background: var(--primary); }
.result-card.relevance-high::before { background: var(--primary); }
.result-card.relevance-med::before { background: var(--accent); }
.result-card.relevance-low::before { background: var(--border); }
.result-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.result-source-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.result-source-icon.web-src { background: hsl(217 91% 60% / 0.1); color: var(--accent); }
.result-source-icon.file-src { background: hsl(38 80% 50% / 0.1); color: var(--warning); }
.result-source-icon.db-src { background: hsl(166 100% 20% / 0.1); color: var(--primary); }
.result-source-icon.news-src { background: hsl(0 70% 50% / 0.1); color: var(--destructive); }
.result-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: hsl(30, 3%, 20%);
  line-height: 1.4;
  flex: 1;
}
.result-score {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.score-bar {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--muted);
  overflow: hidden;
}
.score-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--primary);
  transition: width 0.3s;
}
.score-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted-foreground);
}
.result-snippet {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  line-height: 1.55;
  margin-bottom: 8px;
}
.result-snippet strong {
  color: var(--foreground);
  font-weight: 600;
  background: hsl(166 100% 20% / 0.08);
  padding: 0 2px;
  border-radius: 2px;
}
.result-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  background: var(--muted);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
}
.result-date {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted-foreground);
  margin-left: auto;
}
.thinking-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: hsl(166 100% 20% / 0.04);
  border: 1px solid hsl(166 100% 20% / 0.15);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.thinking-dots {
  display: flex;
  gap: 4px;
}
.thinking-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  animation: dot-bounce 1.4s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
.thinking-text {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 500;
}
.thinking-step {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted-foreground);
  margin-left: auto;
}
.synthesis-box {
  border: 1px solid hsl(166 100% 20% / 0.2);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: hsl(166 100% 20% / 0.03);
  margin-bottom: 14px;
}
.synthesis-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.synthesis-text {
  font-size: 0.85rem;
  color: hsl(30, 3%, 22%);
  line-height: 1.6;
}
.synthesis-footer {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  align-items: center;
}
.synthesis-cite {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 2px;
    padding: 1px 6px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.10);
    color: #1d4ed8;
    font: inherit;
    font-size: 0.92em;
    line-height: 1.4;
    cursor: pointer;
    vertical-align: baseline;
}
.synthesis-cite:hover {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(59, 130, 246, 0.55);
}
.synthesis-cite:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.45);
    outline-offset: 1px;
}
.synthesis-cite:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.45);
    outline-offset: 1px;
}
.evidence-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(2px);
}
.evidence-modal {
    width: min(860px, calc(100vw - 48px));
    max-height: min(84vh, calc(100vh - 48px));
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.evidence-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fff 0%, #fafaf9 100%);
}
.evidence-modal-title {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    line-height: 1.15;
    color: hsl(30, 3%, 20%);
    letter-spacing: -0.02em;
}
.evidence-modal-subtitle {
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted-foreground);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.evidence-modal-body {
    overflow: auto;
    padding: 20px;
    background: #fcfcfc;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.evidence-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}
.evidence-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: #fafaf9;
}
.evidence-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.evidence-card-kicker {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--muted-foreground);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.evidence-card-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: hsl(30, 3%, 20%);
}
.evidence-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    background: rgba(59, 130, 246, 0.05);
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
}
.evidence-card-body {
    padding: 16px;
    display: grid;
    gap: 12px;
}
.evidence-meta-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 14px;
}
.evidence-meta-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.evidence-meta-value {
    font-size: 0.82rem;
    color: var(--foreground);
    line-height: 1.55;
    word-break: break-word;
}
.evidence-query {
    padding: 12px 14px;
    border-radius: 12px;
    background: hsl(217 91% 60% / 0.05);
    border: 1px solid hsl(217 91% 60% / 0.14);
    color: hsl(30, 3%, 20%);
    font-size: 0.84rem;
    line-height: 1.55;
}
.evidence-block {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafaf9;
    overflow: hidden;
}
.evidence-block-label {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.evidence-block-body {
    padding: 12px 14px;
    font-size: 0.82rem;
    color: var(--foreground);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 280px;
    overflow: auto;
}
.evidence-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.evidence-link {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.8rem;
    line-height: 1.45;
}
.evidence-link:hover {
    text-decoration: underline;
}
.evidence-empty {
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: #fff;
    padding: 28px 20px;
    text-align: center;
    color: var(--muted-foreground);
    font-size: 0.84rem;
}
.report-cite {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 2px;
    padding: 1px 6px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.08);
    color: #1d4ed8;
    font: inherit;
    font-size: 0.92em;
    line-height: 1.4;
    cursor: pointer;
    vertical-align: baseline;
}
.report-cite:hover {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.55);
}
.report-cite:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.45);
    outline-offset: 1px;
}
.report-sources {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.report-sources h3 {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-foreground);
}
.report-source-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.report-sources {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.report-sources h3 {
    margin: 0 0 6px 0;
}
#view-report {
    max-width: 860px;
    margin: 0 auto;
}
#view-report :where(h2,h3) {
    font-family: var(--font-serif);
    letter-spacing: -0.01em;
    color: hsl(30, 3%, 20%);
    margin: 12px 0 6px 0;
    line-height: 1.25;
}
#view-report :where(p,li) {
    font-size: 0.9rem;
    line-height: 1.6;
    color: hsl(30, 3%, 22%);
}
#view-report p { margin: 6px 0 10px 0; }
#view-report ul, #view-report ol { margin: 6px 0 10px 18px; }
.report-source-title {
    font-weight: 600;
    color: hsl(30, 3%, 20%);
    line-height: 1.35;
    margin-bottom: 2px;
}
.report-source-domain {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted-foreground);
    margin-bottom: 4px;
}
.report-source-excerpt {
    font-size: 0.85rem;
    color: var(--foreground);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafaf9;
}
.report-source-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.report-source-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: hsl(30, 3%, 20%);
}
.report-source-domain {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted-foreground);
}
.report-source-excerpt {
    font-size: 0.8rem;
    color: var(--foreground);
    line-height: 1.55;
}
.source-modal-header {
    background: linear-gradient(180deg, #fff 0%, #fafaf9 100%);
}
.source-modal-body {
    background: #fcfcfc;
}
.right-panel {
  background: var(--card);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
}
.ingested-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background 0.1s;
  margin-bottom: 2px;
  position: relative;
}
.ingested-item:hover { background: var(--secondary); }
.ingested-icon {
  width: 30px;
  height: 30px;
  border-radius: calc(var(--radius) - 2px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.ingested-info { flex: 1; min-width: 0; }
.ingested-name {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ingested-meta {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted-foreground);
}
.ingested-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ingested-status.ready { background: var(--success); }
.ingested-status.processing { background: var(--warning); animation: pulse-dot 1.5s infinite; }
.ingested-status.error { background: var(--destructive); }
.schedule-item {
  padding: 9px 10px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  background: var(--background);
  cursor: pointer;
  transition: all 0.12s;
}
.schedule-item:hover { border-color: hsl(213 30% 78%); }
.schedule-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.schedule-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--foreground);
  flex: 1;
}
.schedule-active {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}
.schedule-cron {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted-foreground);
  background: var(--muted);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
}
.schedule-desc {
  font-size: 0.72rem;
  color: var(--muted-foreground);
}
.schedule-next {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted-foreground);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.activity-item {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid hsl(213 30% 94%);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-text {
  font-size: 0.74rem;
  color: var(--foreground);
  line-height: 1.4;
}
.activity-time {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted-foreground);
  margin-left: auto;
  flex-shrink: 0;
}
.upload-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 200;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 240px;
}
.upload-toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}
.toast-text { flex: 1; }
.toast-title { font-size: 0.8rem; font-weight: 600; color: hsl(30,3%,22%); }
.toast-sub { font-family: var(--font-mono); font-size: 0.65rem; color: var(--muted-foreground); }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: hsl(213 30% 78%); }
.gutter {
  background-color: var(--background);
  background-repeat: no-repeat;
  background-position: 50%;
  position: relative;
  z-index: 10;
}
.gutter.gutter-horizontal {
  cursor: col-resize;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.gutter.gutter-vertical {
  cursor: row-resize;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.logo-svg { width: 100%; height: 100%; }
.empty-state-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
}
.empty-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: hsl(166 100% 20% / 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  color: var(--primary);
}
.empty-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: hsl(30,3%,30%);
}
.empty-desc {
  font-size: 0.78rem;
  color: var(--muted-foreground);
  max-width: 220px;
  line-height: 1.5;
}
.progress-ring-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.progress-ring {
  transform: rotate(-90deg);
}
.progress-ring-bg { fill: none; stroke: var(--border); stroke-width: 2; }
.progress-ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 31.4;
  stroke-dashoffset: 31.4;
  transition: stroke-dashoffset 1s ease;
}
.progress-dashboard {
  margin: -20px -24px -20px -24px;
  padding: 20px 24px 20px 24px;
  background: var(--background);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 12px;
}
.progress-stats {
  display: flex;
  gap: 16px;
}
.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: calc(var(--radius) - 2px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}
.stat-box-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--primary);
}
.stat-box-label {
  font-family: var(--font-mono);
  color: var(--muted-foreground);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.progress-log {
  flex: 1;
  min-height: 100px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: hsl(30, 3%, 98%);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.log-entry {
  color: var(--foreground);
  word-break: break-all;
  line-height: 1.4;
}
.log-entry.tool-call { color: var(--accent); }
.log-entry.tool-resp { color: var(--muted-foreground); }
.log-entry.system { color: var(--primary); font-weight: 600; }


#login-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--background);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: white; padding: 30px; border-radius: var(--radius);
  border: 1px solid var(--border); width: 320px; display: flex;
  flex-direction: column; gap: 15px; color: black; font-family: sans-serif;
}
.login-box input, .login-box select {
  width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px;
}
.login-box button {
  padding: 10px; background: var(--primary); color: white; border: none;
  border-radius: 4px; cursor: pointer; font-size: 16px; font-weight: bold;
}


#ds-modal *, #ds-modal *::before, #ds-modal *::after {
  line-height: 1.4;
}
#ds-modal *:not([class*="ph"]) {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
#ds-modal input[type="text"] {
  font-size: 13px;
  color: #333;
  background: #fff;
}
#ds-modal input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  accent-color: #107C41;
}
#ds-modal label {
  font-size: 13px;
  color: #333;
}
#ds-modal button {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
#ds-modal ::-webkit-scrollbar { width: 8px; }
#ds-modal ::-webkit-scrollbar-track { background: #F3F2F1; }
#ds-modal ::-webkit-scrollbar-thumb { background: #C8C8C8; border-radius: 4px; }
#ds-modal ::-webkit-scrollbar-thumb:hover { background: #A0A0A0; }
#ds-modal table th,
#ds-modal table td {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #333;
}
#ds-modal table th {
  font-weight: 500;
  background: #F3F2F1;
}
#ds-modal h2 { margin: 0; }
#ds-step-1, #ds-step-2 { min-height: 0; }
#ds-modal table { table-layout: auto; }
.ds-tab { padding: 8px 12px; margin-bottom: 4px; cursor: pointer; border-radius: 4px; font-size: 14px; color: #333; transition: background 0.1s; }
.ds-tab.active { background: #107C41; color: #FFF !important; font-weight: 500; }
.ds-tab:not(.active):hover { background: #EBEBEB; }
.ds-card { border: 1px solid #E0E0E0; border-radius: 6px; padding: 16px; text-align: center; cursor: pointer; transition: all 0.2s; background: #FFF; position: relative; z-index: 0; overflow: visible; }
.ds-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.12); border-color: #B3B3B3; transform: translateY(-1px); z-index: 3; }
.ds-card-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.ds-tree-item { display:flex; align-items:center; gap:6px; padding:4px 8px; margin-left: 14px; border-radius:4px; cursor:pointer; font-size:13px; color:#333; transition: background 0.1s; }
.ds-tree-item:hover { background: #F3F2F1; }
.ds-tree-item.active { background: #EBEBEB; }
