/**
 * Skill Library Sidebar & TreeView Styles
 * =========================================
 * Premium glassmorphism design matching existing sidebars.
 * Accent color: Sky Blue (var(--color-primary)) — consistent with app-wide theme.
 *
 * z-index: 100–999 (window range)
 */

/* ============================================================================
   MAIN WINDOW CONTAINER
   ============================================================================ */

#skill-library-window {
    position: fixed;
    left: max(20px, calc(50vw - 750px));
    top: max(30px, calc(50vh - 420px));
    width: min(1500px, 90vw);
    height: min(840px, 86vh);
    max-width: 90vw;
    max-height: 86vh;
    z-index: 500;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg-dark, rgba(15, 23, 42, 0.95));
    backdrop-filter: blur(var(--glass-blur-md, 24px));
    -webkit-backdrop-filter: blur(var(--glass-blur-md, 24px));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    border-radius: 20px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    overflow: hidden;
    pointer-events: auto;
    /* Nur visuelle Eigenschaften animieren – KEIN left/top/width/height, da sonst
       backdrop-filter beim Öffnen den 3D-Hintergrund versetzt (Browser-Compositing-Bug) */
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* GPU-Layer isolieren damit backdrop-filter nicht den darunter liegenden Canvas versetzt */
    will-change: transform;
    transform: translateZ(0);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

#skill-library-window:hover {
    box-shadow:
        0 12px 48px rgba(0, 0, 0, 0.6),
        0 0 24px rgba(var(--color-primary-rgb, 14, 165, 233), 0.08);
}

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

.skill-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(var(--color-primary-rgb, 14, 165, 233), 0.08);
    border-bottom: 1px solid rgba(var(--color-primary-rgb, 14, 165, 233), 0.2);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}

.skill-library-header:active {
    cursor: grabbing;
}

.skill-library-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.skill-library-header-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.skill-library-header-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-primary-light, #38bdf8);
    letter-spacing: 0.5px;
}

.skill-library-header-subtitle {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 400;
    margin-left: 2px;
}

.skill-library-header-controls {
    display: flex;
    gap: 4px;
}

.skill-library-ctrl-btn {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.2s ease;
    position: relative;
}

.skill-library-ctrl-btn:hover {
    background: rgba(var(--color-primary-rgb, 14, 165, 233), 0.2);
    border-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.4);
    color: rgba(255, 255, 255, 0.9);
}

/* Header Tooltips (Minimize / Fullscreen / Close) */
.skill-library-ctrl-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 6px;
    color: rgba(248, 250, 252, 0.95);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: var(--z-dropdown, 1200);
    transition: opacity 0.15s ease, visibility 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.skill-library-ctrl-btn[data-tooltip]::before {
    content: '';
    position: absolute;
    top: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: rgba(148, 163, 184, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: calc(var(--z-dropdown, 1200) - 1);
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.skill-library-ctrl-btn[data-tooltip]:hover::after,
.skill-library-ctrl-btn[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* ============================================================================
   GENERIC TOOLTIPS — alle [data-tooltip]-Elemente im Fenster
   Ausnahme: skill-library-ctrl-btn hat eigene Regeln weiter oben
   ============================================================================ */

#skill-library-window [data-tooltip]:not(.skill-library-ctrl-btn) {
    position: relative;
}

#skill-library-window [data-tooltip]:not(.skill-library-ctrl-btn)::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 6px;
    color: rgba(248, 250, 252, 0.95);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: var(--z-dropdown, 1200);
    transition: opacity 0.15s ease, visibility 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#skill-library-window [data-tooltip]:not(.skill-library-ctrl-btn)::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(148, 163, 184, 0.4);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: calc(var(--z-dropdown, 1200) - 1);
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

#skill-library-window [data-tooltip]:not(.skill-library-ctrl-btn):hover::after,
#skill-library-window [data-tooltip]:not(.skill-library-ctrl-btn):hover::before {
    opacity: 1;
    visibility: visible;
}

.skill-library-toolbar {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.skill-library-search {
    position: relative;
}

.skill-library-search input {
    width: 100%;
    padding: 8px 12px 8px 32px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.skill-library-search input:focus {
    border-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.5);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb, 14, 165, 233), 0.1);
}

.skill-library-search input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.skill-library-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    opacity: 0.4;
    pointer-events: none;
}

.skill-library-quick-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.skill-library-action-btn {
    flex: 1;
    min-width: 60px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.skill-library-action-btn:hover {
    background: rgba(var(--color-primary-rgb, 14, 165, 233), 0.25);
    border-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.5);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(var(--color-primary-rgb, 14, 165, 233), 0.2);
}

.skill-library-action-btn.primary {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb, 14, 165, 233), 0.3), rgba(var(--color-primary-rgb, 14, 165, 233), 0.2));
    border-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.5);
    color: var(--color-primary-light, #38bdf8);
}

.skill-library-action-btn.primary:hover {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb, 14, 165, 233), 0.4), rgba(var(--color-primary-rgb, 14, 165, 233), 0.3));
    border-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.7);
    box-shadow: 0 4px 16px rgba(var(--color-primary-rgb, 14, 165, 233), 0.3);
}

/* ============================================================================
   TABS (Skills / Teams)
   ============================================================================ */

.skill-library-tabs {
    display: flex;
    padding: 0 12px;
    gap: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.skill-library-tab {
    flex: 0 0 auto;
    min-width: 120px;
    max-width: 220px;
    padding: 8px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.skill-library-tab:hover {
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.03);
}

.skill-library-tab.active {
    color: var(--color-primary-light, #38bdf8);
    border-bottom-color: var(--color-primary, #0ea5e9);
}

.skill-library-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: rgba(var(--color-primary-rgb, 14, 165, 233), 0.2);
    color: var(--color-primary-light, #38bdf8);
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
}

/* ============================================================================
   STATS DASHBOARD
   ============================================================================ */

.skill-library-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.stat-card {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.3);
    box-shadow: 0 2px 8px rgba(var(--color-primary-rgb, 14, 165, 233), 0.1);
    transform: translateY(-1px);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary-light, #38bdf8);
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card.warning .stat-value {
    color: #fb923c;
}

.stat-card.warning:hover {
    border-color: rgba(251, 146, 60, 0.3);
    box-shadow: 0 2px 8px rgba(251, 146, 60, 0.15);
}

/* ============================================================================
   FILTER CHIPS
   ============================================================================ */

.skill-library-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.filter-chip {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.4);
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.filter-chip.active {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb, 14, 165, 233), 0.35), rgba(var(--color-primary-rgb, 14, 165, 233), 0.25));
    border-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.6);
    color: var(--color-primary-light, #38bdf8);
    box-shadow:
        0 2px 8px rgba(var(--color-primary-rgb, 14, 165, 233), 0.2),
        0 0 0 1px rgba(var(--color-primary-rgb, 14, 165, 233), 0.2) inset;
}

.filter-chip.active:hover {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb, 14, 165, 233), 0.45), rgba(var(--color-primary-rgb, 14, 165, 233), 0.35));
    border-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.75);
    transform: translateY(-1px);
    box-shadow:
        0 3px 12px rgba(var(--color-primary-rgb, 14, 165, 233), 0.25),
        0 0 0 1px rgba(var(--color-primary-rgb, 14, 165, 233), 0.3) inset;
}

.filter-chip-clear {
    padding: 6px 10px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #fca5a5;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.filter-chip-clear:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fecaca;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.filter-chip-clear.hidden {
    display: none;
}

/* ============================================================================
   TREE VIEW CONTAINER
   ============================================================================ */

.skill-library-tree {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.3) transparent;
}

.skill-library-tree::-webkit-scrollbar {
    width: 6px;
}

.skill-library-tree::-webkit-scrollbar-track {
    background: transparent;
}

.skill-library-tree::-webkit-scrollbar-thumb {
    background: rgba(var(--color-primary-rgb, 14, 165, 233), 0.25);
    border-radius: 3px;
}

.skill-library-tree::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-primary-rgb, 14, 165, 233), 0.4);
}

/* ============================================================================
   TREE CATEGORY NODE (collapsible folder)
   ============================================================================ */

.skill-tree-category {
    margin: 2px 0;
}

.skill-tree-category-header {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    cursor: pointer;
    gap: 8px;
    transition: background 0.15s ease;
    user-select: none;
}

.skill-tree-category-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.skill-tree-chevron {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.2s ease;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}

.skill-tree-category.expanded .skill-tree-chevron {
    transform: rotate(90deg);
}

.skill-tree-category-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.skill-tree-category-name {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.75);
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.skill-tree-category-count {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 6px;
    border-radius: 8px;
    flex-shrink: 0;
}

.skill-tree-category-bar {
    height: 2px;
    margin: 0 12px 2px;
    border-radius: 1px;
    opacity: 0.5;
}

/* ============================================================================
   TREE SKILL NODE (leaf item)
   ============================================================================ */

.skill-tree-children {
    display: none;
    padding-left: 8px;
}

.skill-tree-category.expanded .skill-tree-children {
    display: block;
}

.skill-tree-item {
    display: flex;
    align-items: center;
    padding: 5px 12px 5px 22px;
    cursor: pointer;
    gap: 8px;
    transition: all 0.15s ease;
    border-left: 2px solid transparent;
    position: relative;
}

.skill-tree-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.4);
}

.skill-tree-item.selected {
    background: rgba(var(--color-primary-rgb, 14, 165, 233), 0.1);
    border-left-color: var(--color-primary, #0ea5e9);
}

.skill-tree-item-icon {
    font-size: 15px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.skill-tree-item-avatar {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.skill-tree-item-name {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skill-tree-item-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 6px;
    font-weight: 600;
    flex-shrink: 0;
}

.skill-tree-item-badge.builtin {
    background: rgba(59, 130, 246, 0.2);
    color: rgba(59, 130, 246, 0.9);
}

.skill-tree-item-badge.custom {
    background: rgba(var(--color-primary-rgb, 14, 165, 233), 0.2);
    color: var(--color-primary-light, #38bdf8);
}

.skill-tree-item-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.skill-tree-item:hover .skill-tree-item-actions {
    opacity: 1;
}

.skill-tree-item-action {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.15s ease;
}

.skill-tree-item-action:hover {
    background: rgba(var(--color-primary-rgb), 0.2);
    color: rgba(255, 255, 255, 0.9);
}

.skill-tree-item-action.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: rgba(239, 68, 68, 0.9);
}

/* ============================================================================
   DETAIL PANEL (bottom section, slides up)
   ============================================================================ */

/* ============================================================================
   MAIN BODY (Two-Pane)
   ============================================================================ */

.skill-library-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.1);
}

.skill-library-nav {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
    min-height: 0;
}

/* Nav Sidebar Footer (Audio Guide) */
.skill-library-nav-footer {
    flex-shrink: 0;
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.1);
}

.skill-library-nav-audio-guide {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(139, 92, 246, 0.12));
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 10px;
    color: #c4b5fd;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.skill-library-nav-audio-guide:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.3), rgba(139, 92, 246, 0.2));
    border-color: rgba(168, 85, 247, 0.5);
    color: #e0d4ff;
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.2);
}

.skill-library-nav-audio-guide.speaking {
    animation: audioGuidePulse 1.5s infinite;
}

@keyframes audioGuidePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(168, 85, 247, 0); }
}

.skill-library-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: rgba(var(--color-primary-rgb), 0.02);
}

/* Tree, Personalities and Teams now live inside Nav */
.skill-library-tree,
.skill-library-personalities,
.skill-library-teams {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.skill-template-section {
    padding: 0 16px 18px;
}

.skill-template-section + .skill-template-section {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 18px;
}

.skill-template-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.skill-template-section-header h3 {
    margin: 0;
    font-size: 13px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.72);
}

.skill-template-section-count {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.72);
}

.skill-template-section-grid {
    display: grid;
    gap: 10px;
}

.skill-library-empty--compact {
    min-height: 120px;
    padding: 24px 18px;
    border: 1px dashed rgba(255,255,255,0.10);
    border-radius: 16px;
    background: rgba(255,255,255,0.02);
}

.skill-template-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 14px;
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.skill-template-card:hover,
.skill-template-card.selected {
    border-color: rgba(var(--color-primary-rgb), 0.35);
    background: rgba(var(--color-primary-rgb), 0.10);
    transform: translateY(-1px);
}

.skill-template-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.skill-template-card-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.skill-template-card-subtitle {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(255,255,255,0.68);
}

.skill-template-card-meta,
.skill-template-consumers,
.skill-template-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-template-meta-pill,
.skill-template-consumer-pill {
    font-size: 11px;
    line-height: 1;
    padding: 6px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.78);
}

.skill-template-consumers {
    margin-top: 10px;
}

.skill-template-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.skill-template-detail-copy {
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255,255,255,0.84);
}

.skill-template-bullet-list {
    margin: 0;
    padding-left: 18px;
    color: rgba(255,255,255,0.84);
}

.skill-template-bullet-list li + li {
    margin-top: 6px;
}

.skill-template-inline-link {
    border: none;
    background: rgba(var(--color-primary-rgb), 0.14);
    color: var(--color-primary-light);
    border-radius: 999px;
    padding: 6px 10px;
    cursor: pointer;
}

.skill-template-inline-link:hover {
    background: rgba(var(--color-primary-rgb), 0.22);
}

/* Personalities info banner */
.skill-personalities-subtitle {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    font-style: italic;
    padding: 8px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 4px;
    line-height: 1.4;
}

/* Redefine detail panel as the content area */
.skill-library-detail {
    display: contents; /* Let children flow into .skill-library-content */
}

.skill-library-detail-inner {
    padding: 20px 24px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.skill-detail-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.25);
    text-align: center;
    padding: 40px;
}

.skill-detail-empty-icon {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.skill-detail-empty-text {
    font-size: 14px;
    max-width: 240px;
    line-height: 1.5;
}

@media (max-width: 1100px) {
    .skill-template-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   TOP BAR — Avatar + Name + LLM Chip + Toolbar
   ============================================================================ */

.skill-detail-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.skill-detail-topbar-right {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.skill-detail-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.skill-detail-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.skill-detail-avatar {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 2px solid rgba(var(--color-primary-rgb), 0.2);
    flex-shrink: 0;
}

.skill-detail-meta {
    flex: 1;
    min-width: 0;
}

.skill-detail-name {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skill-detail-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
    flex-shrink: 0;
}

.skill-detail-badge.editable {
    background: rgba(var(--color-primary-rgb), 0.15);
    color: var(--color-primary-light);
    border: 1px solid rgba(var(--color-primary-rgb), 0.25);
}

.skill-detail-badge.readonly {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.skill-detail-subtitle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
}

.skill-detail-category {
    white-space: nowrap;
}

/* LLM Chip — inline model indicator */
.skill-detail-llm-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skill-detail-llm-chip.has-model {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.skill-detail-llm-chip.no-model {
    background: rgba(251, 191, 36, 0.1);
    color: #fcd34d;
    border: 1px solid rgba(251, 191, 36, 0.15);
}

/* ============================================================================
   TOOLBAR — Compact icon-only buttons
   ============================================================================ */

.skill-detail-toolbar {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.skill-toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.skill-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: translateY(-1px);
}

.skill-toolbar-btn.primary {
    background: rgba(var(--color-primary-rgb), 0.12);
    border-color: rgba(var(--color-primary-rgb), 0.25);
    color: var(--color-primary-light);
}

.skill-toolbar-btn.primary:hover {
    background: rgba(var(--color-primary-rgb), 0.25);
    border-color: var(--color-primary);
}

.skill-toolbar-btn.highlighted {
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.25), rgba(var(--color-primary-rgb), 0.12));
    border: 1px solid var(--color-primary);
    color: #fff;
    animation: highlightPulse 2s infinite;
}

@keyframes highlightPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(var(--color-primary-rgb), 0.15); }
    50% { box-shadow: 0 0 16px rgba(var(--color-primary-rgb), 0.3); }
}

.skill-toolbar-btn.danger {
    color: rgba(255, 100, 100, 0.7);
}

.skill-toolbar-btn.danger:hover {
    background: rgba(255, 68, 68, 0.15);
    border-color: rgba(255, 68, 68, 0.3);
    color: #ff6666;
}

/* ============================================================================
   DESCRIPTION BAR — Compact one-liner
   ============================================================================ */

.skill-detail-desc-bar {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
    padding: 8px 0 10px;
    flex-shrink: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.skill-detail-status-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    max-width: 520px;
}

.skill-detail-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.skill-detail-status-pill.quality.strong,
.skill-detail-status-pill.healthy {
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.2);
    background: rgba(34, 197, 94, 0.08);
}

.skill-detail-status-pill.quality.solid {
    color: #7dd3fc;
    border-color: rgba(14, 165, 233, 0.2);
    background: rgba(14, 165, 233, 0.08);
}

.skill-detail-status-pill.quality.partial,
.skill-detail-status-pill.warning {
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.2);
    background: rgba(251, 191, 36, 0.08);
}

.skill-detail-status-pill.quality.fragile,
.skill-detail-status-pill.needs-attention,
.skill-detail-status-pill.variant {
    color: #fda4af;
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.08);
}

.skill-detail-core-data {
    margin-bottom: 10px;
}

.skill-detail-core-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.skill-detail-core-item {
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    min-width: 0;
}

.skill-detail-core-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.42);
    margin-bottom: 4px;
}

.skill-detail-core-value {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.82);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skill-detail-core-value.mono {
    font-family: Consolas, 'Courier New', monospace;
}

.skill-detail-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding: 8px 0 16px;
}

.skill-detail-panel-card {
    padding: 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skill-detail-panel-card.compact {
    justify-content: center;
}

.skill-detail-panel-card.healthy,
.skill-detail-panel-card.quality.strong {
    border-color: rgba(34, 197, 94, 0.2);
    background: rgba(34, 197, 94, 0.06);
}

.skill-detail-panel-card.warning,
.skill-detail-panel-card.quality.partial,
.skill-detail-panel-card.quality.solid {
    border-color: rgba(251, 191, 36, 0.2);
    background: rgba(251, 191, 36, 0.06);
}

.skill-detail-panel-card.needs-attention,
.skill-detail-panel-card.quality.fragile {
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.06);
}

.skill-detail-panel-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.45);
}

.skill-detail-panel-value {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
}

.skill-detail-panel-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

.skill-detail-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.skill-detail-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.55);
}

.skill-detail-pill.active {
    background: rgba(var(--color-primary-rgb), 0.18);
    color: var(--color-primary-light, #38bdf8);
}

.skill-detail-pill.mono {
    font-family: Consolas, 'Courier New', monospace;
}

.skill-detail-core-pill-row {
    margin-top: 8px;
}

.skill-detail-supporting-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.skill-detail-supporting-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.skill-detail-supporting-meta-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.38);
}

.skill-detail-supporting-meta-value {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.78);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.skill-detail-supporting-meta-value.mono {
    font-family: Consolas, 'Courier New', monospace;
}

.skill-detail-health-panel {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.skill-detail-health-panel.compact {
    padding: 10px 12px;
    margin-bottom: 12px;
}

.skill-detail-health-panel.subdued {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.06);
}

.skill-detail-override-panel {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(var(--color-primary-rgb), 0.08);
    border: 1px solid rgba(var(--color-primary-rgb), 0.16);
}

.skill-detail-override-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.skill-detail-override-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(var(--color-primary-rgb), 0.16);
    color: var(--color-primary-light);
    border: 1px solid rgba(var(--color-primary-rgb), 0.25);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.skill-detail-override-panel-copy {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.72);
}

.skill-detail-override-pill-row {
    margin-top: 10px;
}

.skill-detail-override-panel-meta {
    margin-top: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.52);
}

.skill-detail-health-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.skill-detail-health-list.compact {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.skill-detail-health-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.72);
}

.skill-detail-health-list.compact .skill-detail-health-item {
    padding: 6px 8px;
    font-size: 11px;
}

.skill-detail-health-item.warning {
    border: 1px solid rgba(251, 191, 36, 0.18);
}

.skill-detail-health-item.critical {
    border: 1px solid rgba(239, 68, 68, 0.22);
}

.skill-detail-health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.8;
}

.skill-detail-health-empty {
    margin-top: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

/* ============================================================================
   DOCUMENTATION AREA — Prominent content section
   ============================================================================ */

.skill-detail-doc-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0 14px;
}

.skill-detail-doc-area.prominent {
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.skill-detail-doc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 2px;
}

.skill-detail-doc-header .skill-detail-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(var(--color-primary-rgb), 0.7);
    margin-bottom: 0;
}

.skill-detail-inline-edit {
    background: rgba(var(--color-primary-rgb), 0.1);
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
    color: var(--color-primary-light);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.skill-detail-inline-edit:hover {
    background: var(--color-primary);
    color: #fff;
}

/* LEGACY — keep for backward compat, hidden in new layout */
.skill-detail-header { display: none; }
.skill-detail-actions { display: none; }
.skill-detail-body { display: none; }
.skill-detail-description { display: none; }
.skill-detail-llm { display: none; }
.skill-detail-close { display: none; }
.skill-lock-notice { display: none; }

.readonly-mode {
    filter: grayscale(0.2) contrast(0.9);
    position: relative;
}

.readonly-mode .skill-detail-section-title {
    opacity: 0.6;
}

/* ============================================================================
   MCP (MODEL CONTEXT PROTOCOL) SECTION
   ============================================================================ */

.skill-detail-mcp-section {
    flex-shrink: 0;
    margin: 0 16px 16px;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    overflow: hidden;
}

/* Body hidden when collapsed */
.skill-detail-mcp-section.collapsed .skill-detail-mcp-body {
    display: none;
}

.skill-detail-mcp-section.collapsed .skill-detail-mcp-header {
    border-bottom: none;
}

/* Chevron indicator in header */
.skill-detail-mcp-header::after {
    content: '▾';
    margin-left: 8px;
    font-size: 12px;
    color: rgba(52, 211, 153, 0.6);
    transition: transform 0.2s ease;
    line-height: 1;
}

.skill-detail-mcp-section.collapsed .skill-detail-mcp-header::after {
    transform: rotate(-90deg);
}

.skill-detail-mcp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(16, 185, 129, 0.08);
    border-bottom: 1px solid rgba(16, 185, 129, 0.15);
    cursor: pointer;
    user-select: none;
}

.skill-detail-mcp-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #34d399;
}

.skill-detail-mcp-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 2px 7px;
    border-radius: 4px;
}

.skill-detail-mcp-badge.active {
    background: rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.skill-detail-mcp-badge.inactive {
    background: rgba(100, 116, 139, 0.2);
    color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.skill-detail-mcp-toggle-wrap {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.skill-detail-mcp-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    transition: transform 0.2s ease;
}

.skill-detail-mcp-toggle:hover {
    transform: scale(1.15);
}

.skill-detail-mcp-toggle-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.skill-detail-mcp-body {
    padding: 12px 14px;
}

.skill-detail-mcp-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    margin: 0 0 10px;
    line-height: 1.5;
}

.skill-detail-mcp-field {
    margin-bottom: 10px;
}

.skill-detail-mcp-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 5px;
}

.skill-detail-mcp-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    line-height: 1.5;
    padding: 8px 10px;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.skill-detail-mcp-textarea:focus {
    outline: none;
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(0, 0, 0, 0.4);
}

.skill-detail-mcp-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.readonly-mode .skill-detail-markdown-preview {
    border-style: dashed;
    background: rgba(0, 0, 0, 0.15);
}

/* Structured Markdown Preview in Details */
.skill-detail-markdown-preview {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 24px;
    font-size: 14px;
    color: #e2e8f0;
    line-height: 1.7;
    flex: 1;
    min-height: 200px;
    overflow-y: auto;
    font-family: inherit;
}

.skill-detail-markdown-preview h1,
.skill-detail-markdown-preview h2,
.skill-detail-markdown-preview h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--color-primary-light);
}

.skill-detail-markdown-preview p {
    margin-bottom: 12px;
}

.skill-detail-markdown-preview ul {
    padding-left: 20px;
    margin-bottom: 12px;
}

.skill-detail-markdown-preview li {
    margin-bottom: 6px;
}

.skill-detail-markdown-preview code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono, monospace);
    font-size: 90%;
}

/* ============================================================================
   MARKDOWN ACCORDION SECTIONS
   ============================================================================ */

.skill-md-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
}

.skill-md-toolbar {
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
    padding-bottom: 4px;
}

.skill-md-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    flex: 1;
    min-height: 0;
    align-content: start;
}

.skill-md-section {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    transition: border-color 0.2s ease;
}

.skill-md-section.open {
    border-color: rgba(var(--color-primary-rgb), 0.2);
}

.skill-md-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
    background: rgba(255, 255, 255, 0.02);
}

.skill-md-section-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.skill-md-section-chevron {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
    transition: transform 0.25s ease;
    flex-shrink: 0;
    width: 14px;
    text-align: center;
}

.skill-md-section.open .skill-md-section-chevron {
    transform: rotate(90deg);
    color: var(--color-primary-light, #38bdf8);
}

.skill-md-section-title {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    flex: 1;
}

.skill-md-section.open .skill-md-section-title {
    color: var(--color-primary-light, #38bdf8);
}

.skill-md-section-badge {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 8px;
    flex-shrink: 0;
}

.skill-md-section-body {
    display: none;
    padding: 0 18px;
    font-size: 14px;
    color: #e2e8f0;
    line-height: 1.7;
}

.skill-md-section.open .skill-md-section-body {
    display: block;
    padding: 12px 18px 18px;
}

.skill-md-section-body h3 {
    margin-top: 16px;
    margin-bottom: 8px;
    color: var(--color-primary-light);
    font-size: 13px;
    font-weight: 700;
}

.skill-md-section-body p {
    margin-bottom: 10px;
}

.skill-md-section-body ul {
    padding-left: 20px;
    margin-bottom: 10px;
}

.skill-md-section-body li {
    margin-bottom: 4px;
}

.skill-md-section-body code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono, monospace);
    font-size: 90%;
    color: #e879f9;
}

.skill-md-section-body pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
}

.skill-md-section-body pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #e2e8f0;
    display: block;
}

.skill-md-section-body strong {
    color: #fff;
    font-weight: 700;
}

.skill-md-expand-all {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin-bottom: 8px;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-end;
    flex-shrink: 0;
}

.skill-md-expand-all:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Sidebar Tabs */
.skill-library-tabs {
    flex-shrink: 0;
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px;
}

.skill-library-tab {
    flex: 0 0 auto;
    min-width: 120px;
    max-width: 220px;
    padding: 10px 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.skill-library-tab.active {
    background: rgba(var(--color-primary-rgb), 0.15);
    color: var(--color-primary-light);
}

.skill-library-tab-badge {
    pointer-events: none;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10px;
    color: #fff;
}

.skill-library-tab.active .skill-library-tab-badge {
    background: rgba(var(--color-primary-rgb), 0.3);
}

/* ============================================================================
   TREE BITS
   ============================================================================ */

.skill-tree-category {
    margin-bottom: 2px;
}

.skill-tree-category-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
    gap: 8px;
}

.skill-tree-category-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.skill-tree-chevron {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.2);
    transition: transform 0.3s;
    width: 12px;
    display: flex;
    justify-content: center;
}

.skill-tree-category.expanded .skill-tree-chevron {
    transform: rotate(90deg);
}

.skill-tree-category-icon {
    font-size: 18px;
}

.skill-tree-category-name {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.75);
}

.skill-tree-category-count {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
}

.skill-tree-children {
    display: none;
    padding-left: 12px;
}

.skill-tree-category.expanded .skill-tree-children {
    display: block;
}

.skill-tree-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
    margin: 2px 8px;
}

.skill-tree-item:hover {
    background: rgba(var(--color-primary-rgb), 0.08);
}

.skill-tree-item.active {
    background: rgba(var(--color-primary-rgb), 0.15);
    border: 1px solid rgba(var(--color-primary-rgb), 0.2);
}

.skill-tree-item-icon {
    font-size: 14px;
    width: 20px;
    display: flex;
    justify-content: center;
}

.skill-tree-item-name {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.skill-tree-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.skill-tree-item-preview {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.skill-tree-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.skill-tree-item-metric {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.2px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.65);
}

.skill-tree-item-metric.quality.strong {
    background: rgba(34, 197, 94, 0.16);
    color: #86efac;
}

.skill-tree-item-metric.quality.solid {
    background: rgba(14, 165, 233, 0.16);
    color: #7dd3fc;
}

.skill-tree-item-metric.quality.partial {
    background: rgba(251, 191, 36, 0.14);
    color: #fcd34d;
}

.skill-tree-item-metric.quality.fragile,
.skill-tree-item-metric.variant {
    background: rgba(244, 114, 182, 0.14);
    color: #f9a8d4;
}

.skill-tree-item-metric.signal {
    background: rgba(168, 85, 247, 0.14);
    color: #d8b4fe;
}

.skill-tree-item-llm-dot {
    font-size: 10px;
    flex-shrink: 0;
    opacity: 0.6;
}

.skill-tree-item-badge.system {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.skill-tree-item.system:not(.selected) {
    opacity: 0.7;
}

.skill-tree-item:focus-visible {
    outline: 2px solid rgba(var(--color-primary-rgb), 0.5);
    outline-offset: -2px;
}

.skill-tree-item.active .skill-tree-item-name,
.skill-tree-item.selected .skill-tree-item-name {
    color: #fff;
    font-weight: 600;
}

.skill-tree-item.selected .skill-tree-item-preview {
    color: rgba(255, 255, 255, 0.5);
}

/* TEAMS LIST: styling handled by combined rule + TEAMS VIEW section below */

.team-list-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    gap: 10px;
}

.team-list-item:hover {
    background: rgba(var(--color-primary-rgb), 0.1);
    border-color: rgba(var(--color-primary-rgb), 0.2);
}

.team-list-item.active {
    background: rgba(var(--color-primary-rgb), 0.15);
    border-color: rgba(var(--color-primary-rgb), 0.4);
}

.team-item-icon {
    font-size: 20px;
}

.team-item-info {
    flex: 1;
}

.team-item-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}

.team-item-stat {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 4px;
}

.skill-detail-llm-value {
    font-size: 11px;
    font-weight: 600;
    color: rgba(139, 92, 246, 0.9);
    background: rgba(139, 92, 246, 0.15);
    padding: 2px 8px;
    border-radius: 6px;
}

.skill-detail-llm-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
}

/* Tags */
.skill-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.skill-detail-tag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* LEGACY action buttons — no longer used in new toolbar layout */

/* ============================================================================
   TEAMS VIEW
   ============================================================================ */

.skill-library-teams {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.skill-team-card {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.skill-team-card:hover {
    background: rgba(var(--color-primary-rgb, 14, 165, 233), 0.08);
    border-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.25);
}

/* Drag & Drop states */
.skill-tree-item.dragging {
    opacity: 0.4;
    border-color: var(--color-primary);
}

.skill-tree-item[draggable="true"] {
    cursor: grab;
}

.skill-tree-item[draggable="true"]:active {
    cursor: grabbing;
}

.skill-team-card.drop-target,
.team-member-list[data-team-drop-target].drop-target {
    border-style: dashed;
    border-color: rgba(var(--color-primary-rgb), 0.4);
}

.skill-team-card.drag-over,
.team-member-list[data-team-drop-target].drag-over {
    background: rgba(var(--color-primary-rgb), 0.15) !important;
    border-color: var(--color-primary) !important;
    border-style: solid;
    box-shadow: 0 0 16px rgba(var(--color-primary-rgb), 0.25);
}

.skill-team-card.drag-over {
    transform: scale(1.02);
}

.skill-team-card.selected {
    border-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.5);
    background: rgba(var(--color-primary-rgb, 14, 165, 233), 0.1);
}

/* Team Card Header: name + action buttons */
.skill-team-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.skill-team-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.skill-team-card:hover .skill-team-actions {
    opacity: 1;
}

.skill-team-action-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 6px);
    color: var(--text-muted, #94a3b8);
    font-size: 13px;
    line-height: 1;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.skill-team-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-primary, #f8fafc);
}
.skill-team-action-btn.danger:hover {
    background: rgba(var(--color-error-rgb, 239, 68, 68), 0.12);
    border-color: rgba(var(--color-error-rgb, 239, 68, 68), 0.25);
    color: var(--color-error-light, #f87171);
}

.skill-team-name {
    font-size: 13px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 4px;
}

.skill-team-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 8px;
}

.skill-team-members {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.skill-team-member-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.65);
}

.skill-team-member-chip .chip-icon {
    font-size: 12px;
}

/* ============================================================================
   TEAM DETAIL PANEL — Member list
   ============================================================================ */

.team-member-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    overflow-y: auto;
}

.team-member-list[data-team-drop-target] {
    min-height: 92px;
    padding: 4px;
    border-radius: 12px;
    transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.team-member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.team-member-row:hover {
    background: rgba(var(--color-primary-rgb), 0.06);
    border-color: rgba(var(--color-primary-rgb), 0.15);
}

.team-member-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.team-member-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.team-member-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-member-cat {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
}

.team-member-llm {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.team-member-llm.has-model {
    background: rgba(34, 197, 94, 0.1);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.15);
}

.team-member-llm.no-model {
    background: rgba(251, 191, 36, 0.08);
    color: #fcd34d;
    border: 1px solid rgba(251, 191, 36, 0.12);
}

.team-member-remove {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.25);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    padding: 0;
    opacity: 0;
}

.team-member-row:hover .team-member-remove {
    opacity: 1;
}

.team-member-remove:hover {
    background: rgba(255, 68, 68, 0.15);
    border-color: rgba(255, 68, 68, 0.3);
    color: #ff6666;
}

/* ============================================================================
   SKILL TEMPLATES DIALOG
   ============================================================================ */

.skill-templates-dialog {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.skill-templates-intro {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
}

.skill-templates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.skill-template-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 12px 14px;
    transition: all 0.15s ease;
}

.skill-template-card:not(.disabled):hover {
    background: rgba(var(--color-primary-rgb), 0.05);
    border-color: rgba(var(--color-primary-rgb), 0.15);
}

.skill-template-card.disabled {
    opacity: 0.5;
}

.skill-template-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.skill-template-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.skill-template-title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.skill-template-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.skill-template-match {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
}

.skill-template-apply-btn {
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid rgba(var(--color-primary-rgb), 0.3);
    background: rgba(var(--color-primary-rgb), 0.1);
    color: var(--color-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.skill-template-apply-btn:hover {
    background: rgba(var(--color-primary-rgb), 0.2);
    border-color: rgba(var(--color-primary-rgb), 0.5);
}

.skill-template-exists {
    font-size: 11px;
    color: #86efac;
    font-weight: 600;
    flex-shrink: 0;
}

.skill-template-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.4;
    margin-top: 6px;
}

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

.skill-library-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.skill-library-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.skill-library-empty-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.5;
}

/* ============================================================================
   FOOTER STATUS BAR
   ============================================================================ */

.skill-library-footer {
    padding: 6px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.skill-library-footer-stat {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
}

.skill-library-footer-stat strong {
    color: rgba(var(--color-primary-rgb), 0.8);
}

.skill-library-footer-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.35);
}

.skill-library-progress-bar {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.skill-library-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary, #0ea5e9), #38bdf8);
    border-radius: 2px;
    transition: width 0.5s ease;
    display: block;
    width: 0%;
}

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

@media (max-width: 960px) {
    .skill-library-stats-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .skill-detail-overview-grid,
    .skill-detail-core-grid,
    .skill-detail-health-list {
        grid-template-columns: 1fr;
    }

    .skill-detail-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .skill-detail-topbar-right,
    .skill-detail-status-cluster {
        width: 100%;
        max-width: none;
        justify-content: flex-start;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    #skill-library-window {
        left: 0;
        top: 60px;
        width: 100vw;
        height: calc(100vh - 60px);
        border-radius: 0;
        max-height: none;
    }
}

/* ============================================================================
   ANIMATION
   ============================================================================ */

@keyframes skill-lib-slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#skill-library-window {
    animation: skill-lib-slide-in 0.3s ease-out;
}

/* Skeleton loading */
.skill-tree-skeleton {
    padding: 6px 12px;
}

.skill-tree-skeleton-item {
    height: 28px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.04) 25%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 75%);
    background-size: 200% 100%;
    animation: skill-skeleton-pulse 1.5s ease infinite;
}

@keyframes skill-skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ============================================================================
   GLASSMORPHISM DIALOG SYSTEM
   ============================================================================ */

/* Overlay — MUSS über dem Fenster-Fokus-z-index (70000) liegen */
.sl-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150000;
    opacity: 0;
    transition: opacity 0.25s ease;
    padding: 20px;
    overflow-y: auto;
}
.sl-dialog-overlay--visible {
    opacity: 1;
}

/* Modal Card */
.sl-dialog {
    font-family: var(--font-sans, 'Montserrat', 'Inter', system-ui, sans-serif);
    background: rgba(18, 24, 38, 0.96);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl, 16px);
    box-shadow:
        0 12px 48px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    width: 560px;
    max-width: 92vw;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    transform: translateY(16px) scale(0.97);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    overflow: hidden;
}
.sl-dialog--visible {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.sl-dialog--wide {
    width: 600px;
    max-height: 90vh; /* Increased from 80vh */
}
.sl-dialog--danger .sl-dialog-header {
    border-bottom-color: rgba(239, 68, 68, 0.25);
}

/* Header */
.sl-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}
.sl-dialog-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}
.sl-dialog-icon {
    font-size: 22px;
    line-height: 1;
}
.sl-dialog-title {
    font-size: var(--text-lg, 16px);
    font-weight: var(--weight-semibold, 600);
    color: var(--text-primary, #f8fafc);
}
.sl-dialog-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
    flex-shrink: 0;
}
.sl-dialog-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Body */
.sl-dialog-body {
    padding: 16px 20px;
    flex: 1;
    overflow-y: auto;
    max-height: 75vh; /* Increased from 60vh to allow more room */
    min-height: 50px;
}
.sl-dialog-body--scroll {
    max-height: 70vh; /* Increased from 55vh */
}
.sl-dialog-message {
    margin: 0 0 14px;
    font-size: var(--text-md, 13px);
    color: var(--text-muted, #94a3b8);
    line-height: var(--leading-normal, 1.5);
}

/* Form Fields */
.sl-dialog-field {
    margin-bottom: 14px;
}
.sl-dialog-label {
    display: block;
    font-size: var(--text-xs, 11px);
    font-weight: var(--weight-semibold, 600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 6px;
}
.sl-dialog-input,
.sl-dialog-textarea,
.sl-dialog-select {
    width: 100%;
    padding: var(--padding-input, 12px 14px);
    font-size: var(--text-base, 14px);
    font-family: var(--font-sans, inherit);
    color: var(--text-primary, #f8fafc);
    background: var(--glass-bg-light, rgba(255, 255, 255, 0.06));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: var(--radius-md, 8px);
    outline: none;
    transition: border-color var(--transition-fast, 0.15s ease), box-shadow var(--transition-fast, 0.15s ease);
    box-sizing: border-box;
}
.sl-dialog-input:focus,
.sl-dialog-textarea:focus,
.sl-dialog-select:focus {
    border-color: var(--color-primary, #0ea5e9);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb, 14, 165, 233), 0.18);
}
.sl-dialog-input::placeholder,
.sl-dialog-textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
}
.sl-dialog-textarea {
    resize: vertical;
    min-height: 56px;
}
.sl-dialog-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='%23ffffff60' d='M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
}
.sl-dialog-select option {
    background: #1e2738;
    color: #fff;
}

/* Select Grid (for LLM models, teams) */
.sl-dialog-select-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 4px 20px 4px;
    margin-top: 8px;
}

.sl-dialog-select-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    min-height: 80px; /* Ensure enough height for info icon */
}
.sl-dialog-select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    text-align: left;
}
.sl-dialog-select-option:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #fff;
}
.sl-dialog-select-option.selected {
    background: rgba(var(--color-primary-rgb, 14, 165, 233), 0.12);
    border-color: rgba(var(--color-primary-rgb, 14, 165, 233), 0.5);
    color: var(--color-primary-light, #38bdf8);
    box-shadow: 0 0 0 1px rgba(var(--color-primary-rgb, 14, 165, 233), 0.2);
}
.sl-dialog-option-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    overflow: hidden;
}
.sl-dialog-option-icon {
    font-size: 16px;
    flex-shrink: 0;
}
.sl-dialog-option-label {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sl-dialog-option-info-btn {
    opacity: 0.4;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.sl-dialog-option-info-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.2);
}

/* Footer */
.sl-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.sl-dialog-btn {
    padding: var(--padding-button-md, 12px 20px);
    font-size: var(--text-md, 13px);
    font-weight: var(--weight-semibold, 600);
    font-family: var(--font-sans, inherit);
    border-radius: var(--radius-md, 8px);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast, 0.15s ease);
}
.sl-dialog-btn--cancel {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}
.sl-dialog-btn--cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.sl-dialog-btn--confirm {
    background: linear-gradient(135deg, var(--color-primary, #0ea5e9), var(--color-primary-dark, #0369a1));
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(var(--color-primary-rgb, 14, 165, 233), 0.3);
}
.sl-dialog-btn--confirm:hover {
    background: linear-gradient(135deg, var(--color-primary-light, #38bdf8), var(--color-primary, #0ea5e9));
    box-shadow: 0 4px 14px rgba(var(--color-primary-rgb, 14, 165, 233), 0.4);
    transform: translateY(-1px);
}
.sl-dialog-btn--danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}
.sl-dialog-btn--danger:hover {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

/* Markdown Viewer */
.sl-dialog-markdown {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.75);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    padding: 0;
    background: transparent;
}
/* ============================================================================
   STRUCTURED MARKDOWN EDITOR (Anthropic Skill Format)
   ============================================================================ */

.sl-dialog-overlay--large {
    z-index: 100001;
}

.sl-dialog--large {
    min-width: 900px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.sl-dialog--large .sl-dialog-body {
    max-height: calc(90vh - 180px);
    overflow-y: auto;
}

/* Section Container */
.sl-md-sections-container {
    margin-top: 20px;
}

.sl-md-section-title {
    font-size: 14px;
    font-weight: 600;
    color: rgba(var(--color-primary-rgb), 0.9);
    margin: 0 0 10px 0;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sl-md-section-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin: 5px 0 15px 0;
    line-height: 1.4;
}

/* Individual Section */
.sl-md-section {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.sl-md-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sl-md-section-heading {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    outline: none;
    transition: all 0.2s ease;
}

.sl-md-section-heading:focus {
    border-color: rgba(var(--color-primary-rgb), 0.5);
    background: rgba(0, 0, 0, 0.4);
}

.sl-md-section-remove {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: rgba(239, 68, 68, 0.8);
}

.sl-md-section-remove:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.05);
}

.sl-md-section-content {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.6;
}

.sl-md-field-hint {
    display: block;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 5px;
    font-style: italic;
}

/* Add Section Button */
.sl-md-add-section-btn {
    width: 100%;
    background: rgba(var(--color-primary-rgb), 0.1);
    border: 2px dashed rgba(var(--color-primary-rgb), 0.3);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(var(--color-primary-rgb), 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
}

.sl-md-add-section-btn:hover {
    background: rgba(var(--color-primary-rgb), 0.15);
    border-color: rgba(var(--color-primary-rgb), 0.5);
    color: rgba(var(--color-primary-rgb), 0.95);
    transform: scale(1.01);
}

.sl-md-add-section-btn:active {
    transform: scale(0.98);
}
