/**
 * Knowledge Canvas - Component-Specific Styles
 * 
 * This file contains ONLY canvas-specific styles.
 * Generic component styles (buttons, modals, forms, badges, etc.) are in app.css
 * 
 * Canvas-specific components:
 * - Canvas container and infinite canvas behavior
 * - Draggable cards with connections
 * - Connection lines between cards
 * - Tool-specific UI (chat model selector, autocomplete)
 * - Toolbar and zoom controls
 * - Color picker for cards
 * - Side menu drawer
 * - Interests and matches panels (canvas-specific implementations)
 * - Mobile interaction elements (link arrow, submit button)
 * 
 * Usage: Always include app.css before this file
 */

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

.kc-type-filter {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.kc-type-filter .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.kc-type-filter-menu {
    min-width: 180px;
    padding: 8px;
    z-index: var(--z-dropdown, 4000);
    top: calc(100% + 6px);
    left: 0;
}

.kc-type-filter-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kc-type-filter-list .dropdown-item.selected {
    background: rgba(79, 70, 229, 0.12);
    color: #312e81;
    font-weight: 600;
}

body.kc-manual-resizing,
body.kc-manual-resizing * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
}

/* Ensure pointer cursor always shows over summary and its content */
details.advanced-section { cursor: default; }
details.advanced-section > summary.advanced-summary,
details.advanced-section > summary.advanced-summary *,
details.advanced-section > summary.advanced-summary::before,
details.advanced-section > summary.advanced-summary::after {
    cursor: pointer !important;
}

body {
    font-family: var(--font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    overflow: hidden;
    background: var(--color-bg-canvas, #f8f9fa);
}

/* Avoid iOS auto-zoom on input focus by keeping font-size >= 16px on touch */
@media (pointer: coarse) {
  .card textarea,
  textarea.editing-textarea,
  .card.input-derived-card .chat-input {
    font-size: 16px !important;
  }
}

html, body { -webkit-text-size-adjust: 100%; }

.canvas-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    cursor: grab;
    background: 
        radial-gradient(circle, #e1e5e9 1px, transparent 1px),
        radial-gradient(circle, #e1e5e9 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

.canvas-container.dragging {
    cursor: grabbing;
}

.canvas-container.file-drop-active {
    outline: 2px dashed rgba(79, 70, 229, 0.8);
    outline-offset: -6px;
}

.canvas-container.file-drop-uploading {
    outline-color: rgba(16, 185, 129, 0.9);
}

.canvas-container.file-drop-active::after {
    content: attr(data-drop-label);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: #312e81;
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(2px);
    pointer-events: none;
    z-index: 1200;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.canvas-container.file-drop-uploading::after {
    color: #065f46;
}

.canvas-container.loading .canvas {
    filter: blur(6px);
    transition: filter 0.2s ease;
    pointer-events: none;
}

.canvas-loading-overlay[hidden] {
    display: none !important;
}

.canvas-loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(241, 245, 249, 0.7);
    backdrop-filter: blur(4px);
    z-index: 250;
    pointer-events: auto;
}

.canvas-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px 28px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
    text-align: center;
    min-width: 260px;
}

.canvas-loading-spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 4px solid rgba(148, 163, 184, 0.35);
    border-top-color: rgba(59, 130, 246, 0.85);
    animation: canvas-spin 0.8s linear infinite;
}

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

.canvas-loading-content p {
    margin: 0;
    font-size: 0.95rem;
    color: #1e293b;
}

.canvas {
    position: absolute;
    transform-origin: 0 0;
    will-change: transform;
}

.card {
    position: absolute;
    min-width: 200px;
    min-height: 120px;
    background: #fff;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 16px;
    cursor: move;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    resize: both;
    /* Avoid premature scrollbars due to subpixel rounding when canvas is zoomed */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.card-resize-indicator {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 18px;
    height: 18px;
    pointer-events: auto;
    cursor: nwse-resize;
    z-index: 200;
    background: repeating-linear-gradient(135deg, rgba(100, 116, 139, 0.85) 0 2px, transparent 2px 4px);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

@media (pointer: coarse) {
    .card-resize-indicator {
        width: 28px;
        height: 28px;
        right: 8px;
        bottom: 8px;
        background: repeating-linear-gradient(135deg, rgba(100, 116, 139, 0.85) 0 3px, transparent 3px 6px);
    }
}

.card.dragging {
    z-index: 1000;
    transform: rotate(2deg);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.card textarea {
    width: 100%;
    /* Let flexbox control height so it truly fills the card's inner area */
    height: auto;
    flex: 1 1 auto;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    background: transparent;
    /* Ensure scrolling happens on the textarea only when content actually overflows */
    overflow: auto;
}

.connection-line {
    position: absolute;
    height: 2px;
    background: #9ca3af;
    z-index: -1;
    pointer-events: none;
    transform-origin: left center;
}

.connection-line.selected {
    background: #4f46e5;
    height: 3px;
}

.card:hover {
    border-color: #4f46e5;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.2);
}

/* Status-based card styling */
.card.status-paused {
    border: 3px solid #f59e0b; /* Amber/Orange */
    background-color: #fffbeb; /* Very light amber tint */
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}
.card.status-paused:hover {
    border-color: #d97706;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
}

.card.status-error {
    border: 3px solid #ef4444; /* Red */
    background-color: #fef2f2; /* Very light red tint */
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}
.card.status-error:hover {
    border-color: #dc2626;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

/* Selected state - takes precedence */
.card.selected {
    border-color: #4f46e5 !important;
    border-width: 2px; /* Reset to standard width for selection or keep status width? Standardizing to 2px for clean look */
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2) !important;
    z-index: 1000;
}

.card.input-derived-card.tool-chat-card {
    padding-top: 18px;
    overflow: visible;
}

.tool-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 16px;
    padding: 0 24px 0 0;
    position: relative;
}

.tool-card-header--chat {
    border-bottom: 1px solid #eef0f8;
    padding-bottom: 10px;
}

.tool-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tool-card-model-control {
    flex-shrink: 0;
    position: relative;
    padding-right: 0;
}

.chat-model-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid rgba(79, 70, 229, 0.18);
    background: rgba(248, 250, 252, 0.94);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
    position: relative;
    margin-left: auto;
}

.chat-model-selector-pills {
    display: flex;
    gap: 6px;
}

.chat-model-select-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    color: #312e81;
    padding: 0;
}

.chat-model-select-toggle:focus {
    outline: none;
    color: #312e81;
}

.chat-model-toggle-caret {
    font-size: 0.55rem;
    color: #4338ca;
    margin-left: 4px;
    transform: translateY(1px);
}

.chat-model-menu {
    position: absolute;
    z-index: 4000;
    list-style: none;
    margin: 0;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(79, 70, 229, 0.15);
    background: #fff;
    box-shadow: 0 14px 24px rgba(15, 23, 42, 0.18);
    min-width: 150px;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.chat-model-menu.visible {
    opacity: 1;
    transform: translateY(0);
}

.chat-model-menu-item {
    width: 100%;
}

.chat-model-menu-item.selected .chat-model-menu-btn {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(79, 70, 229, 0.3);
}

.chat-model-menu-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 10px;
    padding: 6px 8px;
    text-align: left;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.chat-model-menu-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(79, 70, 229, 0.24);
}

.chat-model-menu-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #312e81;
}

.chat-model-menu-desc {
    font-size: 0.68rem;
    color: #64748b;
    margin-top: 1px;
}



.tool-autocomplete {
    list-style: none;
    margin: 0;
    padding: 6px 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 35px rgba(15, 23, 42, 0.12);
    min-width: 120px;
}

.tool-autocomplete .tool-item {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #4b5563;
}

.tool-autocomplete .tool-item:hover {
    background: rgba(99, 102, 241, 0.12);
    color: #312e81;
}

/* Mobile link arrow (appears on selected card) */
.mobile-link-arrow {
    position: absolute;
    top: 50%;
    /* Keep inside the card to avoid being clipped by card overflow */
    right: 6px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: none; /* default hidden; JS toggles on select for mobile */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    background: rgba(79, 70, 229, 0.12);
    border: 1px solid rgba(79, 70, 229, 0.35);
    color: #4f46e5;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 4;
}
.mobile-link-arrow::before {
    content: '\2192'; /* → */
    font-size: 18px;
    line-height: 1;
}
.mobile-link-arrow:active {
    background: rgba(79, 70, 229, 0.15);
}

.mobile-submit-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 36px;
  height: 36px;
  display: none; /* toggled via JS on focus */
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 18px;
  background: rgba(79, 70, 229, 0.9); /* indigo */
  color: #fff;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  z-index: 1002; /* above textarea and overlays */
  pointer-events: auto;
}

/* Dark mode adjustments for visibility */
@media (prefers-color-scheme: dark) {
  .mobile-link-arrow {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
    color: #e5e7eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  }
  .mobile-link-arrow:active {
    background: rgba(255, 255, 255, 0.18);
  }
  .mobile-submit-btn { box-shadow: 0 2px 8px rgba(0,0,0,0.35); }
}

/* Give textarea space so the button doesn't overlap content on mobile */
@media (max-width: 768px) {
  .card textarea {
    padding-right: 48px;
    padding-bottom: 8px;
    background: rgba(255,255,255,0.18);
  }
}

.toolbar {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border: 1px solid #e1e5e9;
}

.toolbar button,
.toolbar select {
    padding: 8px 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #fff;
    cursor: pointer !important;
    font-size: 14px;
    transition: all 0.2s ease;
    color: #333;
    font-family: inherit;
}

.toolbar button:hover,
.toolbar select:hover {
    background: #f8f9fa;
    border-color: #4f46e5;
}

.toolbar select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.zoom-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border: 1px solid #e1e5e9;
}

.zoom-controls button {
    width: 40px;
    height: 40px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.zoom-controls button:hover {
    background: #f8f9fa;
    border-color: #4f46e5;
}

#focusNearestBtn {
    font-size: 16px;
    font-weight: 500;
}

.zoom-icon {
    display: inline-block;
    position: relative;
}

.zoom-icon-arrange {
    width: 18px;
    height: 18px;
}

.zoom-icon-arrange::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: rgba(71, 85, 105, 0.85);
    box-shadow:
        0 7px 0 rgba(71, 85, 105, 0.85),
        7px 0 0 rgba(148, 163, 184, 0.85),
        7px 7px 0 rgba(148, 163, 184, 0.85);
}

.zoom-icon-crosshair {
    width: 18px;
    height: 18px;
}

.zoom-icon-crosshair::before,
.zoom-icon-crosshair::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(71, 85, 105, 0.8);
}

.zoom-icon-crosshair::before {
    width: 12px;
    height: 2px;
    border-radius: 999px;
}

.zoom-icon-crosshair::after {
    width: 2px;
    height: 12px;
    border-radius: 999px;
}

.zoom-level {
    text-align: center;
    font-size: 12px;
    color: #6b7280;
    margin: 4px 0;
}

.card-colors {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.color-option {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s ease;
}

.color-option:hover {
    transform: scale(1.2);
}

.color-option.yellow { background: #fef3c7; }
.color-option.blue { background: #dbeafe; }
.color-option.green { background: #d1fae5; }
.color-option.pink { background: #fce7f3; }
.color-option.purple { background: #e9d5ff; }

/* Extraction menu button */
.kc-extraction-btn {
    position: absolute;
    top: 18px;
    right: 2px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    color: #4f46e5;
    padding: 4px 6px;
    line-height: 0;
    z-index: 5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: background 0.2s, box-shadow 0.2s;
}
.kc-extraction-btn:hover {
    background: rgba(240, 240, 255, 0.9);
    color: #4338ca;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.kc-extraction-btn:focus {
    outline: none;
}

.kc-extraction-body {
    margin-top: 8px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.9em;
    color: #1f2933;
}

.kc-extraction-body pre {
    margin: 0;
    white-space: pre-wrap;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Side menu drawer */
#kc-side-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: #fff;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 10000;
    display: flex;
    flex-direction: column;
}
#kc-side-menu.open {
    transform: translateX(0);
}
#kc-side-menu .kc-side-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
}
#kc-side-menu .kc-side-menu-items {
    list-style: none;
    padding: 0;
    margin: 0;
}
#kc-side-menu .kc-side-menu-items button {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
}
#kc-side-menu .kc-side-menu-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Adjust zoom-controls position on mobile to avoid overlap */
/* Autocomplete dropdown for tools */
.tool-autocomplete {
    position: absolute;
    list-style: none;
    margin: 0;
    padding: 4px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    max-height: 150px;
    overflow-y: auto;
    z-index: 1002;
}
.tool-autocomplete li.tool-item {
    padding: 4px 8px;
    background: #f5f5f5;
    font-style: italic;
    cursor: pointer;
}
.tool-autocomplete li.tool-item:hover {
    background: #e5e5e5;
}

@media (max-width: 768px) {
  .zoom-controls {
    bottom: 60px;
  }
}

/* ===== INTERESTS SYSTEM STYLES ===== */

/* Interests Panel Styles */
.interests-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 400px;
    max-height: 80vh;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1001;
    overflow: hidden;
}

/* Matches Panel Styles */
.matches-panel {
    position: fixed;
    top: 60px;
    right: 440px;
    width: 500px;
    max-height: 80vh;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1002;
    overflow: hidden;
}

.matches-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.matches-content {
    max-height: calc(80vh - 60px);
    overflow-y: auto;
}

.matches-filters {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fafafa;
}

.matches-filters label {
    font-size: 0.9em;
    color: #666;
}

.matches-filters select {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
}

.matches-list {
    padding: 8px;
}

.match-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.match-card:hover {
    border-color: #4f46e5;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
}

.match-card.high-fit {
    border-left: 4px solid #10b981;
}

.match-card.medium-fit {
    border-left: 4px solid #f59e0b;
}

.match-card.low-fit {
    border-left: 4px solid #ef4444;
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.match-title {
    font-weight: 600;
    font-size: 0.95em;
    color: #1f2937;
    flex: 1;
    margin-right: 8px;
}

.match-score {
    background: #f3f4f6;
    color: #374151;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    white-space: nowrap;
}

.match-score.high {
    background: #d1fae5;
    color: #065f46;
}

.match-score.medium {
    background: #fef3c7;
    color: #92400e;
}

.match-score.low {
    background: #fee2e2;
    color: #991b1b;
}

.match-summary {
    font-size: 0.85em;
    color: #6b7280;
    line-height: 1.4;
    margin-bottom: 8px;
}

.match-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8em;
    color: #9ca3af;
}

.match-tool {
    background: #e5e7eb;
    color: #374151;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75em;
}

.match-feasibility {
    font-weight: 500;
}

.match-feasibility.feasible {
    color: #059669;
}

.match-feasibility.not-feasible {
    color: #dc2626;
}

/* Capability Details (in modal) */
.capability-details {
    display: grid;
    gap: 16px;
}

.capability-section {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
}

.capability-section h4 {
    margin: 0 0 8px 0;
    color: #374151;
    font-size: 0.9em;
    font-weight: 600;
}

.capability-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.capability-tag {
    background: #f3f4f6;
    color: #374151;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}

.fit-scores {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.fit-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fit-score-value {
    font-weight: 600;
    color: #374151;
}

.evidence-links {
    max-height: 120px;
    overflow-y: auto;
}

.evidence-link {
    display: block;
    color: #4f46e5;
    text-decoration: none;
    font-size: 0.85em;
    margin-bottom: 4px;
    padding: 4px 0;
    border-bottom: 1px solid #f3f4f6;
}

.evidence-link:hover {
    text-decoration: underline;
}

/* Loading and Error States - using app.css definitions */

.no-matches {
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
}

.no-matches .text-muted {
    font-size: 0.9em;
    margin-top: 8px;
}

/* Quality Score Display */
.quality-score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-value {
    font-size: 1.2em;
    font-weight: 600;
    color: #059669;
}

.score-label {
    font-size: 0.85em;
    color: #6b7280;
}

/* Blueprint Summary */
.blueprint-summary {
    font-size: 0.9em;
    color: #6b7280;
}

.blueprint-summary p {
    margin: 4px 0;
}

/* Source Info */
.source-info {
    font-size: 0.9em;
}

.source-info p {
    margin: 4px 0;
}

.source-info strong {
    color: #374151;
}

.source-info a {
    color: #4f46e5;
    text-decoration: none;
}

.source-info a:hover {
    text-decoration: underline;
}

/* Fit Score Details */
.fit-score-details {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.fit-score-details h4 {
    margin: 0 0 12px 0;
    color: #374151;
}

.fit-score-details h5 {
    margin: 16px 0 8px 0;
    color: #374151;
    font-size: 0.9em;
}

.fit-reasoning p {
    margin: 0;
    font-size: 0.9em;
    color: #6b7280;
    line-height: 1.4;
}

.fit-feasibility ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.fit-feasibility li {
    font-size: 0.85em;
    color: #6b7280;
    margin: 4px 0;
}

/* Full content overlay body styles */
.kc-full-content-body {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    font-size: 0.95rem;
}

.kc-full-content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 8px 0;
    display: block;
}

.kc-full-content-body ul,
.kc-full-content-body ol {
    padding-left: 24px;
    margin-bottom: 1em;
    list-style-position: outside;
}

.kc-full-content-body li {
    margin-bottom: 0.25em;
}

.kc-full-content-body p {
    margin-bottom: 1em;
}

.kc-full-content-body h1,
.kc-full-content-body h2,
.kc-full-content-body h3,
.kc-full-content-body h4,
.kc-full-content-body h5,
.kc-full-content-body h6 {
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    font-weight: 600;
    line-height: 1.3;
}

.kc-full-content-body pre {
    background: #f5f7f9;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
    margin-bottom: 1em;
}

.kc-full-content-body code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    background: rgba(0,0,0,0.05);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

.kc-full-content-body pre code {
    background: none;
    padding: 0;
}

.kc-full-content-body blockquote {
    border-left: 4px solid #e5e7eb;
    margin: 0 0 1em 0;
    padding-left: 16px;
    color: #555;
}

/* Mobile Responsiveness for New Panels */
@media (max-width: 768px) {
    .matches-panel {
        right: 10px;
        left: 10px;
        width: auto;
        top: 80px;
    }
    
    .capability-modal .modal-content {
        margin: 10px;
        max-width: none;
        width: auto;
    }
    
    .fit-scores {
        grid-template-columns: 1fr;
    }
}

.interests-header {
    padding: 16px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.interests-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: #333;
}

.interests-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* Interest Cards */
.interest-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    margin-bottom: 8px;
    padding: 12px;
    transition: all 0.2s ease;
    border-left: 4px solid #4f46e5;
}

.interest-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #4f46e5;
}

.interest-card.draft {
    border-left-color: #fbbf24;
    opacity: 0.8;
}

.interest-card.archived {
    border-left-color: #6b7280;
    opacity: 0.6;
}

.interest-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.interest-title {
    font-size: 0.95em;
    font-weight: 600;
    margin: 0;
    color: #333;
    flex: 1;
}

.interest-actions {
    display: flex;
    gap: 4px;
}

.interest-natural-text {
    font-size: 0.85em;
    color: #555;
    margin-bottom: 8px;
    line-height: 1.4;
}

.interest-contract-summary {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.interest-tags {
    margin-bottom: 8px;
}

.interest-tags .tag {
    display: inline-block;
    background: #e1e5e9;
    color: #555;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.75em;
    margin-right: 4px;
    margin-bottom: 2px;
}

.interest-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75em;
    color: #888;
    border-top: 1px solid #f0f0f0;
    padding-top: 6px;
}

.interests-empty {
    text-align: center;
    padding: 32px 16px;
    color: #666;
}

.interests-empty p {
    margin-bottom: 16px;
}

/* Modal z-index overrides for canvas modals */
.modal-overlay {
    z-index: 2000;
}

/* Capability modal specific width */
.capability-modal .modal-content {
    max-width: 700px;
}

/* Feedback Buttons */
.feedback-buttons {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.feedback-btn {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s ease;
}

.feedback-btn:hover {
    background: #e5e7eb;
    transform: scale(1.05);
}

.feedback-btn:active {
    transform: scale(0.95);
}

/* Notifications - canvas specific z-index */
.notification {
    z-index: 3000;
}

/* Interests Panel - duplicate removed, definitions above are sufficient */

/* Toolbar Integration */
#interestsToggleBtn {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.2s ease;
}

#interestsToggleBtn:hover {
    background: #e5e7eb;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .interests-panel {
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        z-index: 1500;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .modal-body {
        padding: 16px;
    }

/* Advanced Section (details/summary) */
details.advanced-section {
    margin-top: 16px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #fff;
}

details.advanced-section > summary.advanced-summary {
    list-style: none;
    padding: 12px 14px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer !important;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Hover state to make clickability obvious */
details.advanced-section > summary.advanced-summary:hover {
    background: #eef2ff; /* subtle indigo tint */
    color: #374151; /* gray-700 */
}

/* Hide default marker in all browsers */
details.advanced-section > summary::-webkit-details-marker { display: none; }
details.advanced-section > summary::marker { content: ''; }

/* Chevron */
details.advanced-section > summary .chevron::before {
    content: '▸';
    display: inline-block;
    transform: translateY(-1px);
    color: #6b7280; /* gray-500 */
}
details.advanced-section[open] > summary .chevron::before {
    content: '▾';
}

/* Content */
details.advanced-section > .advanced-content {
    display: none;
    padding: 12px 14px 14px;
}
details.advanced-section[open] > .advanced-content {
    display: block;
    border-top: 1px solid #e1e5e9;
}

    .interests-header {
        padding: 12px 16px;
    }
}
