/**
 * Main Stylesheet
 * Component styling for the Webbing unified application.
 */

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

body {
    font-family: var(--font-family-system);
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    line-height: 1.65;
}

:focus-visible {
    outline: 2px solid var(--color-primary-light);
    outline-offset: 1px;
}

h1 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

/* Form Elements */
label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
}

input,
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: var(--font-family-system);
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    transition: border-color var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-primary);
}

textarea {
    min-height: 200px;
    font-family: var(--font-family-mono);
}

/* Buttons */
button {
    padding: 10px var(--spacing-xl);
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-fast);
}

button:hover {
    background: var(--color-primary-hover);
}

button:disabled {
    background: var(--color-bg-quaternary);
    color: var(--color-text-secondary);
    cursor: not-allowed;
}

button.secondary {
    background: var(--color-secondary);
    color: var(--color-text-inverse);
}

button.secondary:hover {
    background: var(--color-secondary-hover);
}

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

button.danger:hover {
    background: var(--color-danger-hover);
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-bg-secondary);
    border-top: 2px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: var(--spacing-sm);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ontology Components */
.ontology-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.ontology-chip {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg-quaternary);
    border-radius: var(--radius-pill);
    font-size: var(--font-size-base);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ontology-chip:hover {
    background: var(--color-border-light);
}

.ontology-chip.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

/* Activity Panel (bottom panel) */
.activity-header {
    background: var(--color-terminal-header);
    padding: 2px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-terminal-border);
    height: 24px;
    flex-shrink: 0;
}

.activity-title {
    color: var(--color-terminal-text-muted);
    font-weight: var(--font-weight-semibold);
    font-size: 11px;
}

.activity-controls {
    display: flex;
    gap: 4px;
}

.activity-control-btn {
    background: transparent;
    border: none;
    color: var(--color-terminal-text-muted);
    cursor: pointer;
    padding: 1px 6px;
    font-size: 10px;
    border-radius: var(--radius-sm);
    height: 18px;
}

.activity-control-btn:hover {
    background: var(--color-terminal-border);
}

.activity-content {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
    line-height: 1.4;
}

.activity-line {
    margin-bottom: 1px;
    word-wrap: break-word;
}

.activity-timestamp {
    color: var(--color-text-tertiary);
    margin-right: 4px;
}

.activity-level-info {
    color: var(--color-info);
}

.activity-level-success {
    color: var(--color-success);
}

.activity-level-error {
    color: var(--color-error);
}

.activity-level-warning {
    color: var(--color-warning);
}

.activity-message {
    color: var(--color-terminal-text);
}

/* Ontology Builder Mode */
.onto-mode-toggle {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    background: var(--color-bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-md);
    width: fit-content;
}

.onto-mode-btn {
    padding: 8px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    transition: all var(--transition-fast);
}

.onto-mode-btn:hover {
    background: var(--color-bg-quaternary);
}

.onto-mode-btn.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.onto-builder-container {
    display: block;
}

#ontology-json-container {
    display: none;
}

.onto-section {
    margin-bottom: var(--spacing-2xl);
}

.onto-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.onto-section-header h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.onto-section-header button {
    padding: 8px 16px;
    font-size: var(--font-size-sm);
}

.onto-section-hint {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    margin: 0 0 var(--spacing-sm) 0;
}

.chip-ontology-type {
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    margin-left: 4px;
}

.onto-card {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    transition: all var(--transition-fast);
}

.onto-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.onto-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--spacing-sm);
}

.onto-card-header h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin: 0;
}

.onto-card-actions {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.onto-card-edit-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
    transition: all var(--transition-fast);
}

.onto-card-edit-btn:hover {
    background: var(--color-bg-quaternary);
    border-color: var(--color-primary);
}

.onto-btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: all var(--transition-fast);
}

.onto-btn-icon:hover {
    background: var(--color-bg-quaternary);
}

.onto-card-description {
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
    margin-bottom: var(--spacing-md);
}

.onto-relation-path {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding: 8px;
    background: var(--color-bg-quaternary);
    border-radius: var(--radius-sm);
}

.onto-entity-ref {
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
    padding: 4px 8px;
    background: var(--color-bg-primary);
    border-radius: var(--radius-sm);
}

.onto-attributes {
    font-size: var(--font-size-sm);
}

.onto-attributes strong {
    display: block;
    margin-bottom: var(--spacing-xs);
    color: var(--color-text-primary);
}

.onto-attribute-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--color-bg-quaternary);
    border-radius: var(--radius-sm);
    margin-right: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-sm);
}

.onto-attribute-badge em {
    color: var(--color-text-secondary);
    font-style: normal;
}

.onto-badge-req,
.onto-badge-unique {
    font-size: 10px;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-semibold);
}

.onto-badge-req {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.onto-badge-unique {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.onto-badge-label {
    background: var(--color-info-bg);
    color: var(--color-info-text);
}

/* Modal Styles -- must stack above .app-modal (e.g. Ontology Manager at 9999) */
.onto-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 40, 36, 0.4);
    align-items: center;
    justify-content: center;
    z-index: 10100;
}

.onto-modal-content {
    background: var(--color-bg-primary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

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

.onto-modal-header h2 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin: 0;
}

.onto-modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.onto-modal-close:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.onto-modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    flex: 1;
}

.onto-modal-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

.onto-form-group {
    margin-bottom: var(--spacing-lg);
}

.onto-form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: var(--font-weight-medium);
}

.onto-form-group input[type="text"],
.onto-form-group textarea,
.onto-form-group select {
    width: 100%;
}

.onto-form-group textarea {
    min-height: 80px;
}

.onto-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.onto-btn-small {
    padding: 6px 12px;
    font-size: var(--font-size-sm);
    background: var(--color-secondary);
    color: var(--color-text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.onto-btn-small:hover {
    background: var(--color-secondary-hover);
}

.onto-attribute-row {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    padding: var(--spacing-sm);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-sm);
}

.onto-attribute-row input[type="text"] {
    flex: 1;
    min-width: 100px;
}

.onto-attribute-row select {
    width: 100px;
}

.onto-attribute-row label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-size-sm);
    white-space: nowrap;
    margin: 0;
}

.onto-attribute-row label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.onto-attribute-row .onto-label-radio {
    display: flex;
    align-items: center;
    gap: 4px;
}

.onto-attribute-row .onto-label-radio input[type="radio"] {
    width: auto;
    margin: 0;
}

/* Application modals */
.app-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 40, 36, 0.45);
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.app-modal-content {
    background: var(--color-bg-primary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.app-modal-sm {
    max-width: 500px;
    padding: var(--spacing-2xl);
}

.app-modal-md {
    max-width: 640px;
}

.app-modal-lg {
    max-width: 960px;
}

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

.app-modal-header h2 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin: 0;
}

.app-modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.app-modal-close:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.app-modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    flex: 1;
}

.app-modal-sm h2 {
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

.app-modal-sm p {
    margin-bottom: var(--spacing-lg);
    color: var(--color-text-secondary);
}

.app-form-group {
    margin-bottom: var(--spacing-lg);
}

.app-btn-group {
    display: flex;
    gap: var(--spacing-sm);
}

.app-hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    margin-top: 4px;
}

.app-hint-danger {
    color: var(--color-danger);
}

/* Full-Page Graph Modal */
.graph-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-primary);
    z-index: 3000;
    flex-direction: column;
}

.graph-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xl);
    background: var(--color-bg-secondary);
    border-bottom: 2px solid var(--color-primary);
    gap: var(--spacing-lg);
}

.graph-modal-header h2 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin: 0;
}

.graph-modal-subtitle {
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
    margin: var(--spacing-xs) 0 0 0;
}

.graph-modal-info {
    flex: 1;
    text-align: center;
    font-size: var(--font-size-base);
    color: var(--color-text-secondary);
}

.graph-modal-close {
    background: transparent;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.graph-modal-close:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.graph-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.graph-modal-content {
    flex: 1;
    background: var(--color-bg-primary);
    overflow: hidden;
}

#graph-view {
    width: 100%;
    height: 100%;
    background-color: var(--color-bg-primary);
}

/* Graph Content Wrapper and Timeline */
.graph-content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0; /* allow flex children to shrink properly */
}

.graph-timeline-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
}

.timeline-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 60%;
    height: 6px;
    border-radius: 4px;
    background: var(--color-border);
    outline: none;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
}

.timeline-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
}

.timeline-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}

/* Graph Sidebars */
.graph-sidebar {
    width: 250px;
    background: var(--color-bg-secondary);
    overflow-y: auto;
    padding: var(--spacing-lg);
    border-left: 1px solid var(--color-border);
}

.graph-sidebar:first-child {
    border-left: none;
    border-right: 1px solid var(--color-border);
}

.graph-sidebar h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin: 0 0 var(--spacing-md) 0;
}

.graph-sidebar h4 {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin: var(--spacing-md) 0 var(--spacing-sm) 0;
}

/* Legend Styles */
.legend-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) 0;
}

.legend-color-box {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    flex-shrink: 0;
}

.legend-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
}

/* Filter Styles */
.filter-description {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-lg);
    line-height: 1.4;
}

.filter-section {
    margin-bottom: var(--spacing-lg);
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-base);
    color: var(--color-text-primary);
    transition: background var(--transition-fast);
}

.filter-toggle:hover {
    background: var(--color-bg-quaternary);
}

.filter-toggle input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) 0;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
}

.filter-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.filter-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    flex-shrink: 0;
}

.filter-reset-btn {
    width: 100%;
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
}

/* Custom Interactive Tooltip */
#custom-graph-tooltip {
    display: none;
    position: fixed;
    max-width: min(500px, 90vw);
    max-height: min(400px, 60vh);
    padding: 0;
    font-family: var(--font-family-system);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    overflow: hidden;
    z-index: 10000;
    /* Allow interaction with the tooltip itself */
    pointer-events: auto;
}

.tooltip-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.tooltip-close:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

/* Graph Tooltips - Scrollable and Responsive */
.vis-tooltip {
    max-width: min(500px, 90vw) !important;
    max-height: min(400px, 60vh) !important;
    padding: 0 !important;
    font-family: var(--font-family-system) !important;
    background: var(--color-bg-primary) !important;
    border: 1px solid var(--color-border) !important;
    box-shadow: var(--shadow-md) !important;
    border-radius: var(--radius-md) !important;
    overflow: hidden !important;
    z-index: 9999 !important;
}

.graph-tooltip {
    display: flex;
    flex-direction: column;
    max-height: min(400px, 60vh);
    color: var(--color-text-primary);
}

.tooltip-header {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    padding: var(--spacing-md);
    padding-right: 40px; /* Space for close button */
    padding-bottom: var(--spacing-sm);
    background: var(--color-bg-primary);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.tooltip-subheader {
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    font-weight: var(--font-weight-medium);
    padding: 0 var(--spacing-md) var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg-primary);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.tooltip-section-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg-secondary);
    flex-shrink: 0;
}

.tooltip-scroll-content {
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-md);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    color: var(--color-text-secondary);
    flex: 1;
    min-height: 0;
}

.tooltip-scroll-content::-webkit-scrollbar {
    width: 8px;
}

.tooltip-scroll-content::-webkit-scrollbar-track {
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
}

.tooltip-scroll-content::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-sm);
}

.tooltip-scroll-content::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-tertiary);
}

.tooltip-prop {
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-xs);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    word-wrap: break-word;
    word-break: break-word;
    /* Ensure long strings don't prevent wrapping */
    overflow-wrap: break-word;
}

.tooltip-prop strong {
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
}

.tooltip-chunk-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.8;
    color: var(--color-text-primary);
}

.tooltip-empty {
    font-style: italic;
    color: var(--color-text-tertiary);
    text-align: center;
    padding: var(--spacing-lg);
}

/* Ontology List Fields */
.onto-list-block {
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-sm);
}

.onto-list-block strong {
    display: block;
    margin-bottom: var(--spacing-xs);
    color: var(--color-text-primary);
}

.onto-list-block ul {
    list-style-type: disc;
    padding-left: var(--spacing-lg);
    color: var(--color-text-secondary);
}

.onto-list-block li {
    margin-bottom: 4px;
}

.onto-badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.onto-badge-anchor {
    background: var(--color-bg-quaternary);
    color: var(--color-text-primary);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-xs);
    border: 1px solid var(--color-border);
}

.onto-tags-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.onto-tag-input-row {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
}

.onto-tag-input-row input {
    max-width: 200px;
}

.onto-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--color-bg-quaternary);
    color: var(--color-text-primary);
    padding: 2px 6px 2px 8px;
    border-radius: var(--radius-pill);
    font-size: var(--font-size-xs);
    border: 1px solid var(--color-border);
}

.onto-tag-remove {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    border-radius: 50%;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.onto-tag-remove:hover {
    color: var(--color-danger);
    background: var(--color-danger-bg);
}

/* Drag and Drop Zone Styles */
#ontology-panel.drag-over {
    border: 2px dashed var(--color-primary);
    background-color: var(--color-bg-tertiary);
    position: relative;
}

#ontology-panel.drag-over::after {
    content: "Drop JSON files to upload";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--font-size-xl);
    color: var(--color-primary);
    font-weight: var(--font-weight-bold);
    pointer-events: none;
    background: rgba(250, 250, 248, 0.85);
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-md);
}

/* Tabular Highlighting Styles */
.tabular-highlight {
    background-color: rgba(100, 200, 255, 0.4);
    cursor: help;
    border-bottom: 1px dashed rgba(100, 200, 255, 0.8);
    transition: background-color 0.2s;
    padding: 1px 2px;
    border-radius: 2px;
}

.tabular-highlight:hover {
    background-color: rgba(100, 200, 255, 0.7);
    border-bottom-color: rgba(100, 200, 255, 1);
}

/* When highlights are toggled off */
body.highlights-hidden .tabular-highlight {
    background-color: transparent;
    border-bottom: none;
    cursor: default;
}

/* =============================================================================
   APPLICATION SHELL
   ============================================================================= */

.app-shell {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: var(--color-bg-app);
    color: var(--color-text-primary);
    font-family: var(--font-family-system);
    font-size: var(--font-size-sm);
    --panel-left-width: 240px;
}

/* --- Header ---------------------------------------------------------------- */

.app-header {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 10px;
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-bg-secondary);
    box-shadow: 0 1px 2px rgba(44, 62, 107, 0.04);
    flex-shrink: 0;
    gap: 8px;
    font-size: var(--font-size-xs);
}

.app-header-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.app-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    letter-spacing: 0.3px;
}

.app-header-center {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.panel-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px;
    border-top: 1px solid var(--color-border);
    font-size: 11px;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.panel-footer-user {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-panel-toggles {
    display: flex;
    gap: 2px;
}

.app-panel-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 22px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: pointer;
    padding: 0;
    transition: all var(--transition-fast);
}

.app-panel-toggle:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.app-panel-toggle.active {
    color: var(--color-primary);
    background: var(--color-bg-tertiary);
}

/* --- Compact form elements ------------------------------------------------- */

.app-select {
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: var(--font-size-xs);
    min-width: 100px;
    height: 22px;
}

.app-select[multiple],
.app-select[size] {
    height: auto;
}

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

.app-select-sm {
    min-width: 50px;
    height: 20px;
    padding: 1px 4px;
}

.app-input {
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: var(--font-size-xs);
    height: 22px;
}

.app-input-sm {
    height: 20px;
    padding: 2px 5px;
    font-size: 11px;
}

.app-textarea {
    width: 100%;
    min-height: 200px;
    font-family: var(--font-family-mono);
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    resize: vertical;
}

/* --- Compact buttons ------------------------------------------------------- */

.app-btn {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    font-size: var(--font-size-xs);
    cursor: pointer;
    white-space: nowrap;
    height: 22px;
    line-height: 1;
    transition: background var(--transition-fast);
}

.app-btn:hover:not(:disabled) {
    background: var(--color-bg-quaternary);
}

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

.app-btn-primary {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
}

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

.app-btn-danger {
    background: var(--color-danger);
    color: var(--color-text-inverse);
    border-color: var(--color-danger);
}

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

.app-btn-accent {
    background: var(--color-accent);
    color: var(--color-text-inverse);
    border-color: var(--color-accent);
}

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

.app-btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--color-text-secondary);
}

.app-btn-ghost:hover:not(:disabled) {
    color: var(--color-text-primary);
    background: var(--color-bg-tertiary);
}

.app-btn-icon {
    padding: 0 4px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    height: 22px;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.app-btn-icon:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-tertiary);
}

.app-btn-sm {
    padding: 1px 6px;
    font-size: 11px;
    height: 20px;
}

.app-btn-xs {
    padding: 0 4px;
    font-size: 10px;
    height: 18px;
}

.app-btn-block {
    width: 100%;
}

.app-btn-row {
    display: flex;
    gap: 4px;
}

.app-check-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--color-text-secondary);
    cursor: pointer;
    margin: 0;
}

.app-check-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.app-inline-label {
    font-size: 11px;
    color: var(--color-text-secondary);
    margin: 0;
    white-space: nowrap;
}

/* --- Mode toggle ----------------------------------------------------------- */

.app-mode-toggle {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    height: 22px;
    flex-shrink: 0;
}

.app-mode-btn {
    padding: 0 8px;
    border: none;
    background: var(--color-bg-primary);
    white-space: nowrap;
    color: var(--color-text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    height: 100%;
}

.app-mode-btn:not(:last-child) {
    border-right: 1px solid var(--color-border);
}

.app-mode-btn.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
}

.app-mode-btn:hover:not(.active) {
    background: var(--color-bg-tertiary);
}

.app-mode-separator {
    width: 1px;
    background: var(--color-border);
    margin: 3px 4px;
    flex-shrink: 0;
}

/* --- Workspace grid -------------------------------------------------------- */

.app-workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.app-panel-left,
.app-panel-right {
    flex-shrink: 0;
    background: var(--color-bg-secondary);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px;
    gap: 2px;
}

.app-panel-left {
    width: var(--panel-left-width);
    min-width: 0;
    border-right: none;
    display: none;
}

.panel-left-open .app-panel-left {
    display: flex;
}

.app-panel-left-resize {
    display: none;
    width: 5px;
    flex-shrink: 0;
    cursor: ew-resize;
    background: var(--color-border-light);
    transition: background var(--transition-fast);
    align-self: stretch;
}

.panel-left-open .app-panel-left-resize {
    display: block;
}

.app-panel-left-resize:hover,
.app-panel-left-resize:active {
    background: var(--color-primary);
}

.app-panel-right {
    width: 240px;
    border-left: 1px solid var(--color-border);
    display: none;
}

.panel-right-open .app-panel-right {
    display: flex;
}

.app-panel-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.app-panel-bottom {
    height: 180px;
    background: var(--color-terminal-bg);
    color: var(--color-terminal-text);
    font-family: var(--font-family-mono);
    font-size: var(--font-size-xs);
    border-top: 1px solid var(--color-primary);
    flex-shrink: 0;
    display: none;
    flex-direction: column;
}

.panel-bottom-open .app-panel-bottom {
    display: flex;
}

/* --- Panel sections -------------------------------------------------------- */

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 5px 3px;
}

.panel-section + .panel-section {
    border-top: 1px solid var(--color-border-light);
    padding-top: 6px;
}

.panel-section-separator {
    border-top: 2px solid var(--color-border);
    margin-top: 4px;
    padding-top: 8px;
}

.panel-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.panel-heading {
    margin: 0;
    font-size: 10px;
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--color-text-tertiary);
}

.panel-fields {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.panel-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.kg-pending-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-warning);
    margin-left: 4px;
    white-space: nowrap;
}

.kg-stats-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--color-text-secondary);
    padding-top: 4px;
}

/* --- Ontology tree drawer -------------------------------------------------- */

.ontology-tree {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 120px;
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-primary);
    padding: 4px 2px;
}

.ontology-tree-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 2px 6px 4px;
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: var(--color-bg-primary);
    z-index: 1;
}

.ontology-tree-count {
    font-size: 10px;
    color: var(--color-text-tertiary);
}

.ontology-tree-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ontology-tree-root-list {
    flex: 1;
    min-height: 24px;
}

.ontology-tree-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px 2px calc(6px + var(--depth, 0) * 14px);
    font-size: 11px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    user-select: none;
}

.ontology-tree-row:hover {
    background: var(--color-bg-hover);
}

.ontology-tree-folder-row {
    color: var(--color-text-primary);
    font-weight: 500;
}

.ontology-tree-leaf-row {
    color: var(--color-text-primary);
    padding-left: calc(22px + var(--depth, 0) * 14px);
}

.ontology-tree-leaf-selected,
.ontology-tree-leaf-selected:hover {
    background: var(--color-accent);
    color: var(--color-text-inverse);
}

.ontology-tree-toggle {
    width: 12px;
    color: var(--color-text-tertiary);
    text-align: center;
    flex-shrink: 0;
}

.ontology-tree-icon {
    flex-shrink: 0;
    width: 14px;
    text-align: center;
    color: var(--color-text-secondary);
}

.ontology-tree-children {
    display: none;
}

.ontology-tree-folder-open > .ontology-tree-children,
.ontology-tree-folder.ontology-tree-force-open > .ontology-tree-children {
    display: block;
}

.ontology-tree-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ontology-tree-actions {
    display: none;
    gap: 2px;
    flex-shrink: 0;
}

.ontology-tree-folder-row:hover .ontology-tree-actions {
    display: inline-flex;
}

.ontology-tree-action {
    padding: 0 4px;
    line-height: 1;
}

.ontology-tree-empty {
    padding: 6px 10px;
    color: var(--color-text-tertiary);
    font-size: 11px;
    font-style: italic;
}

.ontology-tree-dragging {
    opacity: 0.4;
}

.ontology-tree-drop-target {
    outline: 2px dashed var(--color-accent);
    outline-offset: -2px;
}

.ontology-tree-hidden {
    display: none;
}

.ontology-tree-force-open > .ontology-tree-list {
    display: block;
}

/* --- Results area ---------------------------------------------------------- */

.screener-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 8px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    flex-shrink: 0;
    height: 26px;
}

.results-count {
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-indicator {
    font-size: 10px;
    color: var(--color-text-tertiary);
    min-width: 60px;
    text-align: center;
}

.screener-results-body {
    flex: 1;
    overflow: auto;
}

.screener-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: var(--font-size-sm);
    color: var(--color-text-tertiary);
    padding: var(--spacing-md);
    text-align: center;
}

/* Handsontable theme overrides */
#hot-container .handsontable {
    font-size: 11px;
    font-family: var(--font-family-system);
    color: var(--color-text-primary);
}

#hot-container .handsontable th,
#hot-container .handsontable td {
    border-color: var(--color-border-light);
    padding: 0 4px;
    height: 22px;
    line-height: 22px;
    box-sizing: border-box;
}

#hot-container .handsontable th {
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-medium);
    font-size: 10px;
}

#hot-container .handsontable td {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#hot-container .handsontable tr:hover td {
    background: var(--color-bg-tertiary);
}

#hot-container .handsontable td.current-row {
    background: var(--color-bg-tertiary);
}

#hot-container .handsontable .ht_nestingLevel,
#hot-container .handsontable .ht_nestingButton,
#hot-container .handsontable .ht_nestingCollapse {
    vertical-align: middle;
    line-height: 22px;
}

#hot-container .handsontable thead tr:first-child th {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-tertiary);
    background: var(--color-bg-tertiary);
    border-bottom: 2px solid var(--color-border);
    height: 20px;
    line-height: 20px;
}

/* Lineage drawer */
.lineage-drawer {
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    max-height: 35vh;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.lineage-resize-handle {
    height: 5px;
    cursor: ns-resize;
    background: var(--color-border);
    flex-shrink: 0;
    transition: background 0.15s;
}

.lineage-resize-handle:hover,
.lineage-resize-handle:active {
    background: var(--color-primary);
}

.lineage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 8px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    z-index: 1;
    height: 24px;
    flex-shrink: 0;
}

.lineage-title {
    margin: 0;
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
}

.lineage-content {
    padding: 4px 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.lineage-item {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    margin-bottom: 4px;
    background: var(--color-bg-primary);
}

.lineage-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.lineage-chunk-id {
    font-weight: var(--font-weight-semibold);
    font-size: 10px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.lineage-badges {
    display: inline-flex;
    gap: 3px;
    flex-wrap: wrap;
}

.lineage-badge {
    display: inline-block;
    padding: 0 4px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    line-height: 16px;
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-light);
    white-space: nowrap;
}

.lineage-badge-primary {
    background: color-mix(in srgb, var(--color-primary) 12%, transparent);
    color: var(--color-primary);
    border-color: color-mix(in srgb, var(--color-primary) 25%, transparent);
}

.lineage-badge-confidence {
    background: color-mix(in srgb, var(--color-warning) 12%, transparent);
    color: var(--color-warning);
    border-color: color-mix(in srgb, var(--color-warning) 25%, transparent);
    font-variant-numeric: tabular-nums;
}

.lineage-badge-ontology {
    background: color-mix(in srgb, var(--color-info) 12%, transparent);
    color: var(--color-info);
    border-color: color-mix(in srgb, var(--color-info) 25%, transparent);
    font-weight: 600;
    text-transform: lowercase;
}

.lineage-item-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.lineage-meta-inline {
    font-size: 9px;
    color: var(--color-text-tertiary);
    white-space: nowrap;
}

.lineage-action {
    font-size: 10px;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.lineage-action:hover {
    text-decoration: underline;
}

.lineage-meta-row {
    font-size: 9px;
    color: var(--color-text-tertiary);
    margin-top: 2px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lineage-source-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 1px;
    flex-wrap: wrap;
}

.lineage-source-label {
    font-size: 9px;
    color: var(--color-text-tertiary);
    font-weight: 600;
    white-space: nowrap;
}

.lineage-source-actions {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
    font-size: 9px;
}

.lineage-source-sep {
    color: var(--color-text-tertiary);
}

.lineage-reasoning {
    margin-top: 4px;
    padding: 4px 6px;
    background: var(--color-primary-bg, rgba(59, 130, 246, 0.08));
    border-left: 2px solid var(--color-primary);
    border-radius: var(--radius-sm);
}

.lineage-reasoning-entry {
    font-size: 11px;
    color: var(--color-text-primary);
    line-height: 1.4;
    font-style: italic;
}

.lineage-reasoning-entry + .lineage-reasoning-entry {
    margin-top: 2px;
}

.lineage-text {
    font-size: 11px;
    color: var(--color-text-secondary);
    white-space: pre-wrap;
    max-height: 100px;
    overflow-y: auto;
    background: var(--color-bg-tertiary);
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    line-height: 1.4;
    margin-top: 4px;
}

.lineage-item-vetoed {
    opacity: 0.5;
    border-color: var(--color-text-tertiary);
}

.lineage-ref-badge {
    padding: 4px 8px;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--color-text-secondary);
    background: var(--color-bg-elevated);
    border-radius: var(--border-radius-sm);
}

.lineage-mini-hot-container {
    margin-bottom: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    overflow: visible;
}

.lineage-mini-hot-container .handsontable {
    font-size: 11px;
}

.handsontableEditor.autocompleteEditor.listbox {
    height: auto !important;
    overflow: visible !important;
    z-index: 9000;
}

.handsontableEditor.autocompleteEditor.listbox .wtHolder {
    height: auto !important;
    max-height: 200px;
    overflow-y: auto;
}

.handsontableInput {
    z-index: 9000;
}

.cell-edited-diff {
    background-color: var(--color-success-muted, rgba(46, 160, 67, 0.15));
}

.cell-fork-diff {
    background-color: var(--color-bg-secondary);
}

.cell-fork-diff .diff-base {
    color: var(--color-danger, #d73a49);
    text-decoration: line-through;
    opacity: 0.7;
}

.cell-fork-diff .diff-arrow {
    color: var(--color-text-tertiary);
    margin: 0 4px;
    font-size: 11px;
}

.cell-fork-diff .diff-edit {
    color: var(--color-success, #28a745);
    font-weight: 600;
}

.handsontable tr.fork-row td {
    background-color: var(--color-bg-tertiary, rgba(0, 0, 0, 0.03));
    border-left: 2px solid var(--color-success, #28a745);
}

.fork-indicator {
    display: inline-block;
    margin-right: 4px;
    color: var(--color-success, #28a745);
    font-size: 10px;
    font-weight: 600;
}

.lineage-veto-btn,
.lineage-unveto-btn {
    font-size: 10px;
    padding: 1px 6px;
    cursor: pointer;
}

.diagnostics-reprocess-btn {
    font-size: 10px;
    padding: 1px 6px;
    cursor: pointer;
}

.lineage-loading,
.lineage-empty {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: var(--font-size-sm);
}

.app-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--color-text-secondary);
    cursor: pointer;
    white-space: nowrap;
}

/* Content Scope */
.content-scope-status {
    font-size: 10px;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    margin-top: 2px;
}

.content-scope-ok {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.content-scope-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.content-scope-error {
    background: var(--color-error-bg);
    color: var(--color-error);
}

.content-scope-status--warn {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

/* Content scope Handsontable grid */
.cs-scope-grid {
    margin-top: 2px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    font-size: 11px;
}

.cs-scope-grid .handsontable {
    font-size: 11px;
}

.cs-ticker-btn {
    cursor: pointer;
    text-decoration: underline;
    font-weight: var(--font-weight-semibold);
    padding: 0 2px;
}

.cs-badge {
    font-size: 8px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.cs-badge--scraped {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.cs-badge--pending {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

/* Web Crawl Topic library + builder */
.web-crawl-topic-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.wct-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    background: var(--color-bg-primary);
    font-size: 11px;
    cursor: pointer;
}

.wct-chip:hover {
    background: var(--color-bg-tertiary);
}

.wct-chip-system {
    border-color: var(--color-primary);
}

.wct-chip-name {
    font-weight: var(--font-weight-medium);
}

.wct-chip-tag {
    font-size: 9px;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
}

.wct-results-container {
    margin-top: 3px;
    max-height: 240px;
    overflow-y: auto;
}

.wct-result-card {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    padding: 2px 5px;
    margin-bottom: 2px;
    background: var(--color-bg-primary);
    font-size: 10px;
}

.wct-result-title {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    display: block;
}

.wct-result-title:hover {
    text-decoration: underline;
}

.wct-result-url {
    color: var(--color-text-tertiary);
    font-size: 9px;
    word-break: break-all;
}

.wct-result-snippet {
    color: var(--color-text-secondary);
    margin-top: 1px;
}

.wct-error {
    color: var(--color-danger);
}

/* Schema info (compact) */
.schema-info {
    font-size: 10px;
    color: var(--color-text-secondary);
}

.schema-group {
    margin-bottom: 3px;
}

.schema-item {
    padding-left: 6px;
}

/* =========================================================================
   Fingerprint Matrix
   ========================================================================= */

.fingerprint-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fingerprint-empty {
    padding: 32px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.fingerprint-legend {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border-light);
    font-size: 11px;
}

.fingerprint-legend-label {
    color: var(--color-text-secondary);
    min-width: 20px;
    text-align: center;
}

.fingerprint-legend-track {
    display: flex;
    height: 12px;
    border-radius: 3px;
    overflow: hidden;
}

.fingerprint-legend-swatch {
    width: 28px;
    height: 100%;
}

.fingerprint-scroll {
    flex: 1 1 0;
    overflow: auto;
    min-height: 0;
}

.fingerprint-table {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
    font-size: 12px;
}

.fingerprint-th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-bg-secondary);
    padding: 5px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
    user-select: none;
}

.fingerprint-th-entity {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 180px;
    max-width: 260px;
}

.fingerprint-sortable {
    cursor: pointer;
}

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

.fingerprint-sortable.sort-asc::after {
    content: " \25B2";
    font-size: 8px;
}

.fingerprint-sortable.sort-desc::after {
    content: " \25BC";
    font-size: 8px;
}

.fingerprint-group-row {
    background: none;
}

.fingerprint-group-cell {
    padding: 6px 8px 3px;
    font-weight: 700;
    font-size: 11px;
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-top: 1px solid var(--color-border-light);
}

.fingerprint-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.fingerprint-td {
    padding: 3px 8px;
    border-bottom: 1px solid var(--color-border-light);
    white-space: nowrap;
}

.fingerprint-td-entity {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-weight: 500;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fingerprint-row:hover .fingerprint-td-entity {
    background: var(--color-bg-secondary);
}

.fingerprint-cell {
    position: relative;
    text-align: center;
    min-width: 48px;
    cursor: default;
    transition: opacity 0.12s;
}

.fingerprint-cell[data-count]:hover {
    opacity: 0.75;
    cursor: pointer;
}

.fingerprint-cell[data-count]:hover::after {
    content: attr(data-count);
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
    font-size: 10px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 5;
}

.fingerprint-td-total {
    color: var(--color-text-secondary);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.fingerprint-metric-select {
    font-size: 11px;
    padding: 2px 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    cursor: pointer;
}

/* =========================================================================
   Graph View
   ========================================================================= */

.graph-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--color-bg-graph-view);
}

.graph-container canvas {
    display: block;
}

.graph-empty {
    padding: 32px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.graph-top-n {
    width: 52px;
    text-align: center;
}

/* =========================================================================
   Temporal View
   ========================================================================= */

.temporal-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 12px 16px;
}

.temporal-org-section {
    margin-bottom: 24px;
}

.temporal-org-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 6px;
}

.temporal-chart-wrap {
    position: relative;
    height: 280px;
}

.temporal-empty {
    padding: 32px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 13px;
}

/* Universe Scope Builder */
.universe-drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    margin-top: 4px;
    padding: 6px 8px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-secondary);
    font-size: 10px;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.universe-drop-zone:hover,
.universe-drop-zone:focus {
    outline: none;
    border-color: var(--color-accent);
    color: var(--color-text-secondary);
}

.universe-drop-zone--drag {
    border-color: var(--color-accent);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

.universe-drop-zone--busy {
    pointer-events: none;
    opacity: 0.65;
}

.universe-drop-zone-label {
    text-align: center;
    line-height: 1.3;
    pointer-events: none;
}

.universe-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 0;
}

.universe-load-summary {
    flex-basis: 100%;
    width: 100%;
    font-size: 10px;
    line-height: 1.35;
    color: var(--color-text-muted);
}

.universe-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 6px;
    font-size: 10px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    max-width: 100%;
}

.universe-tag-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.universe-tag-remove {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 0 1px;
    flex-shrink: 0;
}

.universe-tag-remove:hover {
    color: var(--color-danger);
}

.universe-tag.universe-tag--error {
    border-color: var(--color-danger);
    color: var(--color-danger);
    background: color-mix(in srgb, var(--color-danger) 14%, var(--color-bg-secondary));
}

.universe-tag.universe-tag--error .universe-tag-remove {
    color: var(--color-danger);
}

.scope-rules {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.scope-rule-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.scope-rule-form-type {
    flex: 1;
    min-width: 0;
}

.scope-rule-remove {
    flex-shrink: 0;
    padding: 0 4px;
    font-size: 14px;
    line-height: 1;
    color: var(--color-text-muted);
}

.scope-rule-remove:hover {
    color: var(--color-danger);
}

.scope-date-range {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

.scope-date-sep {
    font-size: 11px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.scope-date-input {
    flex: 1;
    min-width: 0;
}

/* =========================================================================
   Ontology Build Wizard
   ========================================================================= */

.app-modal-xl {
    max-width: 820px;
    width: 95vw;
}

.wiz-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 420px;
}

.wiz-steps {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 12px;
    flex-wrap: wrap;
}

.wiz-step {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 16px;
    font-size: 11px;
    color: var(--color-text-muted);
    background: transparent;
    white-space: nowrap;
}

.wiz-step-active {
    background: var(--color-accent);
    color: var(--color-bg);
    font-weight: 600;
}

.wiz-step-completed {
    color: var(--color-text-secondary);
    text-decoration: line-through;
    opacity: 0.7;
}

.wiz-step-num {
    font-weight: 700;
    font-size: 11px;
}

.wiz-content {
    flex: 1;
    overflow-y: auto;
}

.wiz-content h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.wiz-content h4 {
    margin: 12px 0 4px;
    font-size: 13px;
}

.wiz-hint {
    color: var(--color-text-secondary);
    font-size: 13px;
    margin: 0 0 16px;
    line-height: 1.5;
}

.wiz-nav {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--color-border);
    padding-top: 12px;
}

.wiz-btn {
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    color: var(--color-text);
    transition: background 0.15s, opacity 0.15s;
}

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

.wiz-btn-primary {
    background: var(--color-accent);
    color: var(--color-bg);
    border-color: var(--color-accent);
}

.wiz-btn-primary:hover:not(:disabled) {
    opacity: 0.85;
}

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

/* Fields */

.wiz-field {
    margin-bottom: 14px;
}

.wiz-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--color-text-secondary);
}

.wiz-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 13px;
    box-sizing: border-box;
}

.wiz-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.wiz-json-preview {
    font-family: monospace;
    font-size: 11px;
    line-height: 1.5;
}

/* Cards (selectable options) */

.wiz-card-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wiz-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: var(--color-bg);
}

.wiz-card:hover {
    border-color: var(--color-text-muted);
}

.wiz-card-selected {
    border-color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 6%, var(--color-bg));
}

.wiz-card input[type="radio"] {
    width: auto;
    padding: 0;
    margin: 3px 0 0;
    flex-shrink: 0;
    cursor: pointer;
}

.wiz-card-body {
    flex: 1;
    min-width: 0;
}

.wiz-card-body strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.wiz-card-body p {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin: 2px 0 0;
    line-height: 1.4;
    overflow-wrap: break-word;
}

/* Entity and relation items inside cards */

.wiz-entity-item,
.wiz-rel-item {
    padding: 6px 0;
    border-top: 1px solid var(--color-border);
}

.wiz-entity-item:first-child,
.wiz-rel-item:first-child {
    border-top: none;
    padding-top: 0;
}

.wiz-entity-item strong,
.wiz-rel-item strong {
    font-size: 12px;
}

.wiz-entity-item p,
.wiz-rel-item p {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin: 2px 0 0;
    line-height: 1.4;
    overflow-wrap: break-word;
}

.wiz-rel-path {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-left: 6px;
}

.wiz-entity-anchors {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.wiz-anchor-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 11px;
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
}

/* Badges */

.wiz-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    background: var(--color-accent);
    color: var(--color-bg);
    vertical-align: middle;
    margin-left: 4px;
}

.wiz-badge-dim {
    background: var(--color-bg-secondary);
    color: var(--color-text-muted);
}

/* Checkboxes (form types, anchors) */

.wiz-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 6px;
}

.wiz-check-label {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.wiz-check-label input[type="checkbox"] {
    width: auto;
    padding: 0;
    margin: 2px 0 0;
    flex-shrink: 0;
    cursor: pointer;
}

.wiz-check-label:hover {
    background: var(--color-bg-hover);
}

.wiz-anchor-proposal {
    display: flex;
    gap: 8px;
    padding: 8px 10px;
}

.wiz-anchor-proposal div {
    flex: 1;
    min-width: 0;
}

.wiz-anchor-proposal strong {
    font-size: 12px;
}

.wiz-anchor-proposal p {
    font-size: 11px;
    color: var(--color-text-secondary);
    margin: 2px 0 0;
    line-height: 1.3;
}

/* Section headings and dividers */

.wiz-section-heading {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin: 0 0 6px;
}

.wiz-section-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 8px;
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wiz-section-divider::before,
.wiz-section-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* Reasoning / coverage blocks */

.wiz-reasoning {
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--color-bg-secondary);
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 14px;
    color: var(--color-text-secondary);
}

.wiz-reasoning strong {
    color: var(--color-text);
}

.wiz-coverage {
    display: flex;
    gap: 20px;
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--color-bg-secondary);
    font-size: 12px;
    margin-bottom: 14px;
    color: var(--color-text-secondary);
}

/* Review section */

.wiz-review-section {
    margin-bottom: 14px;
}

.wiz-review-section ul {
    margin: 4px 0;
    padding-left: 18px;
    font-size: 12px;
    line-height: 1.6;
}

/* Shape cards (Gate 0) */

.wiz-shape-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.wiz-shape-card {
    text-align: center;
}

.wiz-shape-card .wiz-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.wiz-shape-card .wiz-card-body strong {
    text-align: center;
}

.wiz-shape-card .wiz-card-body p {
    text-align: center;
}

.wiz-shape-icon {
    width: 80px;
    height: 40px;
    margin-bottom: 4px;
    stroke: var(--color-text-muted);
    fill: none;
}

.wiz-shape-icon rect,
.wiz-shape-icon circle {
    stroke: var(--color-text-secondary);
    fill: color-mix(in srgb, var(--color-accent) 10%, var(--color-bg));
}

.wiz-shape-icon line {
    stroke: var(--color-text-muted);
}

.wiz-shape-icon marker path {
    fill: var(--color-text-muted);
}

.wiz-card-selected .wiz-shape-icon rect,
.wiz-card-selected .wiz-shape-icon circle {
    stroke: var(--color-accent);
    fill: color-mix(in srgb, var(--color-accent) 20%, var(--color-bg));
}

.wiz-card-selected .wiz-shape-icon line {
    stroke: var(--color-accent);
}

.wiz-card-selected .wiz-shape-icon marker path {
    fill: var(--color-accent);
}

.wiz-shape-sub {
    font-size: 11px;
    font-family: monospace;
    color: var(--color-text-muted);
}

/* Measurement axis tag on domain cards */

.wiz-axis-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    background: color-mix(in srgb, var(--color-text-muted) 10%, transparent);
    padding: 1px 6px;
    border-radius: 3px;
    vertical-align: middle;
}

.wiz-card-selected .wiz-axis-tag {
    color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 12%, transparent);
}

/* Inline examples on domain cards */

.wiz-examples-inline {
    display: block;
    font-size: 11px;
    color: var(--color-text-muted);
    font-style: italic;
    margin-top: 4px;
    line-height: 1.4;
}

/* Optional label hint */

.wiz-optional {
    font-weight: 400;
    color: var(--color-text-muted);
}

/* Loading state */

.wiz-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--color-text-muted);
    font-size: 14px;
}

/* Confirm modal */
.confirm-modal .app-modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.confirm-intro {
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.confirm-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
}

.confirm-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--spacing-md);
    font-size: 13px;
}

.confirm-row-label {
    color: var(--color-text-secondary);
}

.confirm-row-value {
    color: var(--color-text-primary);
    font-weight: var(--font-weight-medium);
    font-variant-numeric: tabular-nums;
}

.confirm-line {
    font-size: 13px;
    color: var(--color-text-primary);
}

.confirm-silent {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-secondary);
    cursor: pointer;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--color-border-light);
}

/* Workflow stepper */
.workflow-step .panel-heading {
    display: none;
}

.workflow-step-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    user-select: none;
}

.workflow-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    flex-shrink: 0;
}

.workflow-step-title {
    flex: 1;
    font-size: 12px;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
}

.workflow-step-state {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--color-border);
}

.workflow-step-active .workflow-step-num {
    background: var(--color-primary);
    color: var(--color-text-inverse, #fff);
}

.workflow-step-active .workflow-step-title {
    color: var(--color-primary);
}

.workflow-step-active .workflow-step-state {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.workflow-step-complete .workflow-step-num {
    background: var(--color-success, #2e7d32);
    color: var(--color-text-inverse, #fff);
}

.workflow-step-complete .workflow-step-state {
    background: var(--color-success, #2e7d32);
    border-color: var(--color-success, #2e7d32);
}

.workflow-step-body {
    padding-top: 4px;
}

/* Recent runs sidebar */
.runs-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 360px;
    overflow-y: auto;
}

.runs-row {
    padding: 6px 8px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    background: var(--color-bg-primary);
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.runs-row-head {
    display: flex;
    align-items: center;
    gap: 6px;
}

.runs-row-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: var(--font-weight-bold);
    color: var(--color-text-inverse, #fff);
    background: var(--color-text-tertiary);
    flex-shrink: 0;
}

.runs-status-running {
    background: var(--color-primary);
    animation: runsPulse 1.4s ease-in-out infinite;
}

.runs-status-completed {
    background: var(--color-success, #2e7d32);
}

.runs-status-failed {
    background: var(--color-danger, #c62828);
}

.runs-status-cancelled {
    background: var(--color-text-tertiary);
}

@keyframes runsPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.runs-row-kind {
    flex: 1;
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
}

.runs-row-age {
    color: var(--color-text-tertiary);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.runs-row-cancel {
    margin-left: 4px;
}

.runs-row-meta {
    display: flex;
    gap: 8px;
    color: var(--color-text-secondary);
    font-size: 11px;
    padding-left: 22px;
}

.runs-row-duration {
    font-variant-numeric: tabular-nums;
}

.runs-row-error {
    padding-left: 22px;
    font-size: 11px;
    color: var(--color-danger, #c62828);
    word-break: break-word;
}

/* Org Seeds editor (per-CIK seed grid) */
.org-seeds-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.org-seeds-loading,
.org-seeds-error {
    padding: var(--spacing-md);
    color: var(--color-text-secondary);
}

.org-seeds-error {
    color: var(--color-danger);
}

.org-seeds-cell {
    vertical-align: top !important;
    padding: 4px 6px !important;
    white-space: normal !important;
}

.org-seeds-chip-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 4px;
}

.org-seeds-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 4px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    background: var(--color-bg-primary);
    font-size: 11px;
    max-width: 100%;
}

.org-seeds-chip-link {
    color: var(--color-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.org-seeds-chip-link:hover {
    text-decoration: underline;
}

.org-seeds-chip-remove {
    background: transparent;
    border: none;
    color: var(--color-danger);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}

.org-seeds-chip-remove:hover {
    color: var(--color-danger);
    background: var(--color-bg-secondary);
}

.org-seeds-add-row {
    display: flex;
    gap: 2px;
    margin-top: 2px;
}

.org-seeds-add-input {
    flex: 1;
    min-width: 0;
    font-size: 11px;
}

.org-seeds-add-btn {
    flex-shrink: 0;
}

