/* Global Styles & Unified Layout */
body {
    background-color: var(--body-bg);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.app-embedded .app-navbar,
.app-embedded .app-subnav,
.app-embedded .app-toolbar {
    display: none !important;
}

.app-embedded .app-page {
    padding-top: 0 !important;
    height: 100vh !important;
}

.app-embedded .app-workarea {
    height: 100% !important;
}

.app-embedded,
.app-embedded body {
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: auto !important;
    background-color: var(--surface-bg);
}

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

a:hover {
    text-decoration: underline;
}

/* Unified Page Layout (.app-page) */
.app-page {
    max-width: var(--page-max-width);
    margin: 0 auto;
    padding: 0 var(--page-padding-x);
    min-height: calc(100vh - 60px);
}

.app-subnav {
    padding: var(--space-3) 0;
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.app-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.app-page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.app-toolbar {
    margin-bottom: var(--space-3);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
}

.app-workarea {
    background: var(--color-bg-subtle);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    border: 1px solid var(--border-color);
}

.app-content {
    margin-bottom: var(--space-5);
}

.app-pagination {
    margin-top: var(--space-4);
    display: flex;
    justify-content: center;
}

.app-header {
    width: 100%;
}

.app-banner-wrap {
    width: 100%;
    background: linear-gradient(
        90deg,
        rgb(35, 37, 42) 0%,
        rgb(35, 37, 42) 50%,
        rgb(36, 39, 44) 50%,
        rgb(36, 39, 44) 100%
    );
    height: 169px;
    overflow: hidden;
}

.app-banner-container {
    width: 100%;
    max-width: var(--page-max-width);
    padding-left: var(--page-padding-x);
    padding-right: var(--page-padding-x);
    margin-left: auto;
    margin-right: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    height: 100%;
}

.app-banner {
    display: block;
    width: auto;
    height: 100%;
    max-width: 100%;
    flex: 0 1 auto;
    object-fit: contain;
}

/* Navbar Overrides (Refactored from legacy) */
.app-navbar {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    padding-top: .25rem;
    padding-bottom: .25rem;
}

.app-navbar.app-navbar--banner {
    background-color: rgb(35, 28, 43);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
}

@media (max-width: 576px) {
    .app-banner-wrap {
        height: 110px;
    }
}

.app-navbar.app-navbar--banner .navbar-brand {
    color: rgba(255, 255, 255, 0.95) !important;
}

.app-navbar.app-navbar--banner .navbar-nav .nav-link,
.app-navbar.app-navbar--banner .navbar-nav .nav-link.dropdown-toggle {
    color: rgba(255, 255, 255, 0.82) !important;
}

.app-navbar.app-navbar--banner .navbar-nav .nav-link:hover,
.app-navbar.app-navbar--banner .navbar-nav .nav-link.dropdown-toggle:hover {
    color: rgba(255, 255, 255, 0.95) !important;
    background-color: rgba(255, 255, 255, 0.10) !important;
}

.app-navbar.app-navbar--banner .navbar-nav .nav-link.active,
.app-navbar.app-navbar--banner .navbar-nav .nav-link.dropdown-toggle.active {
    color: rgba(255, 255, 255, 0.98) !important;
    background-color: rgba(56, 189, 248, 0.18) !important;
}

.app-navbar.app-navbar--banner .navbar-collapse .navbar-nav .nav-item > .nav-link {
    color: rgba(255, 255, 255, 0.82) !important;
}

.app-navbar.app-navbar--banner .navbar-toggler {
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.app-navbar.app-navbar--banner .navbar-toggler:hover {
    border-color: rgba(255, 255, 255, 0.45);
}

.app-navbar .container {
    max-width: var(--page-max-width);
    padding-left: var(--page-padding-x);
    padding-right: var(--page-padding-x);
}

.app-navbar .navbar-brand {
    font-weight: 600;
    font-size: 1.125rem;
    letter-spacing: 0.2px;
    color: var(--text-primary) !important;
}

.app-navbar .navbar-nav .nav-link,
.app-navbar .navbar-nav .nav-link.dropdown-toggle {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    background-color: transparent !important;
    margin: 0 0.125rem;
}

.app-navbar .navbar-nav .nav-link:hover,
.app-navbar .navbar-nav .nav-link.dropdown-toggle:hover {
    color: var(--text-primary);
    background-color: var(--hover-bg-subtle) !important;
}

.app-navbar .navbar-nav .nav-link.active,
.app-navbar .navbar-nav .nav-link.dropdown-toggle.active {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.08) !important;
}

.app-navbar .dropdown-menu,
.app-navbar .dropdown-menu.app-dropdown {
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-radius: var(--radius-md);
    overflow: hidden;
    background-color: var(--surface-bg);
    position: absolute;
    z-index: 1070;
}

.app-navbar .dropdown-menu .dropdown-item,
.app-navbar .dropdown-menu.app-dropdown .dropdown-item {
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
    color: var(--text-primary);
    padding: 0.5rem 1rem;
}

.app-navbar .dropdown-menu .dropdown-item:hover,
.app-navbar .dropdown-menu.app-dropdown .dropdown-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.app-navbar .dropdown-menu .dropdown-item.active,
.app-navbar .dropdown-menu .dropdown-item:active,
.app-navbar .dropdown-item.active,
.app-navbar .dropdown-item:active {
    background-color: rgba(13, 110, 253, 0.12);
    color: var(--text-primary);
}

.navbar-toggler {
    border: 1px solid var(--border-color);
}

.navbar-toggler:hover {
    border-color: var(--text-secondary);
}

/* Component Overrides */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    background-color: var(--surface-bg);
}

.card-header {
    background-color: var(--surface-bg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

.card-footer {
    background-color: var(--surface-bg);
    border-top: 1px solid var(--border-color);
}

/* Table Styles */
.table {
    background-color: var(--surface-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table thead th {
    background-color: var(--table-head-bg);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(0,0,0,0.02);
}

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-active);
}

/* Icon Box Styles for Dashboard */
.icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    margin-right: var(--space-2);
    flex-shrink: 0;
}

.icon-box-primary {
    background-color: var(--color-primary-soft-bg);
    color: var(--color-primary-soft-fg);
}

.icon-box-success {
    background-color: var(--color-success-soft-bg);
    color: var(--color-success-soft-fg);
}

.icon-box-warning {
    background-color: var(--color-warning-soft-bg);
    color: var(--color-warning-soft-fg);
}

.icon-box-danger {
    background-color: var(--color-danger-soft-bg);
    color: var(--color-danger-soft-fg);
}

.icon-box-info {
    background-color: var(--color-info-soft-bg);
    color: var(--color-info-soft-fg);
}

.icon-box-secondary {
    background-color: var(--color-neutral-soft-bg);
    color: var(--color-neutral-soft-fg);
}

/* Utility Classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transition-all {
    transition: all 0.3s ease;
}

.hover-shadow:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-2px);
}

/* Additional Utility Classes (Merged from backup) */
.app-maxw-160 { max-width: 160px; }
.app-maxw-240 { max-width: 240px; }
.app-maxw-320 { max-width: 320px; }
.app-w-70 { width: 70px; }
.app-w-80 { width: 80px; }
.app-w-160 { width: 160px; }
.app-w-180 { width: 180px; }
.app-w-220 { width: 220px; }
.app-w-200 { width: 200px; }
.app-w-240 { width: 240px; }
.app-h-400 { height: 400px; }
.app-maxh-240 { max-height: 240px; overflow: auto; }
.app-prewrap { white-space: pre-wrap; }
.app-col-actions-160 { width: 160px; }
.app-schema-scroll { max-height: 480px; overflow: auto; }
.app-maxh-260 { max-height: 260px; overflow: auto; }
.app-maxh-200 { max-height: 200px; overflow: auto; }
.app-break-words { word-break: break-word; }
.app-cursor-pointer { cursor: pointer; }
.app-col-select-40 { width: 40px; }
.app-filterbar { display: flex; flex-wrap: wrap; gap: var(--space-2, 8px); align-items: center; }

/* 课程列表卡片封面区域（统一高度与占位居中） - Consolidated to .card-img-container */
.card-img-container {
    height: 160px;
    background-color: var(--color-bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    border-bottom: 1px solid rgba(0,0,0,0.03);
}
.card-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-img-container .icon-placeholder {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}
/* Legacy support alias */
.card-img-wrapper {
    @extend .card-img-container; /* CSS preprocessor syntax not valid here, but conceptually */
    height: 160px;
    background-color: var(--color-bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    border-bottom: 1px solid rgba(0,0,0,0.03);
}
.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-img-wrapper .icon-placeholder {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

/* ==========================================================================
   Chapter Management & Context Menu Styles (Copied from style - 副本.css)
   ========================================================================== */

/* 章节管理树：行内菜单项实体背景 */
.chapter-item .chapter-title {
    display: inline-block;
    background-color: var(--container-bg, #ffffff);
    color: var(--text-primary);
    border: 1px solid var(--border-color, #e7e7e7);
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
    box-shadow: 0 2px 6px var(--shadow-color, rgba(0,0,0,0.12));
    transition: transform .15s ease, box-shadow .15s ease;
}

/* 鼠标移入时的样式 - 蓝色系 (Blue) */
.chapter-item:hover .chapter-title {
    background-color: var(--color-primary-soft-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* 任务状态徽章样式 (From tasks.html) */
.status-badge { padding: 0.25rem 0.5rem; border-radius: 0.5rem; font-size: 0.85rem; }
.status-pending { background-color: #fff3cd; color: #856404; }
.status-uploaded { background-color: #e2e3e5; color: #383d41; }
.status-parsing { background-color: #cce5ff; color: #004085; }
.status-parsed { background-color: #e2e3e5; color: #383d41; }
.status-chunking { background-color: #cce5ff; color: #004085; }
.status-chunked { background-color: #d4edda; color: #155724; }
.status-preprocessing { background-color: #cce5ff; color: #004085; }
.status-generating { background-color: #d4edda; color: #155724; }

/* ==========================================================================
   AI Chat Interface Styles (.aic-*)
   ========================================================================== */
.aic-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 70vh; /* Ensure reasonable height in standard layout */
    background-color: var(--bg-color, #f3f4f6);
}

.aic-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background-color: var(--surface-bg, #ffffff);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.aic-window {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
}

.aic-messages {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.aic-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    position: relative;
}

.aic-message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.aic-message.ai {
    align-self: flex-start;
    align-items: flex-start;
}

.aic-message .content {
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.aic-message.user .content {
    background-color: var(--primary-color, #2563EB);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

.aic-message.ai .content {
    background-color: var(--color-bg-subtle);
    color: var(--text-primary);
    border-bottom-left-radius: 0.25rem;
    border: 1px solid var(--border-color, #e5e7eb);
}

/* Thinking Panel */
.aic-thinking-panel {
    background-color: var(--color-warning-soft-bg);
    border: 1px solid var(--color-warning);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    max-height: 200px;
    overflow-y: auto;
}

.aic-thinking-panel h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #ef6c00;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Input Area */
.aic-input-container {
    padding: 1rem;
    background-color: var(--surface-bg, #ffffff);
    border-top: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    position: relative;
}

.aic-input-container textarea {
    flex: 1;
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 1.5rem;
    padding: 0.75rem 1.25rem;
    resize: none;
    max-height: 150px;
    min-height: 48px;
    font-size: 0.95rem;
    line-height: 1.5;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: var(--bg-color, #f9fafb);
}

.aic-input-container textarea:focus {
    border-color: var(--primary-color, #2563EB);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-color: #fff;
}

.aic-input-container button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background-color: transparent;
    color: var(--text-secondary, #6b7280);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.aic-input-container button:hover {
    background-color: var(--bg-color, #f3f4f6);
    color: var(--primary-color, #2563EB);
}

#aic-send-button {
    background-color: var(--primary-color, #2563EB);
    color: #fff;
}

#aic-send-button:hover {
    background-color: var(--primary-700, #1d4ed8);
    transform: scale(1.05);
}

#aic-send-button:disabled {
    background-color: var(--border-color, #e5e7eb);
    color: var(--text-secondary, #9ca3af);
    cursor: not-allowed;
    transform: none;
}

/* Upload Menu */
.aic-upload-menu {
    position: absolute;
    bottom: 100%;
    left: 1rem;
    margin-bottom: 0.5rem;
    background-color: #fff;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none; /* Toggled by JS */
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
}

.aic-upload-menu.show {
    display: flex;
}

.aic-upload-menu button {
    width: 100%;
    border-radius: 0;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    justify-content: flex-start;
    height: auto;
}

/* Attachments Preview */
.aic-current-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1rem 0.5rem;
}

.aic-attachment-preview {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 0.25rem;
    overflow: hidden;
    border: 1px solid var(--border-color, #e5e7eb);
}

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

.aic-attachment-remove {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0,0,0,0.5);
    color: #fff;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

/* Code Blocks */
.aic-code-wrapper {
    margin: 1rem 0;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.5rem;
    overflow: hidden;
    width: 85%;
}

.aic-code-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.25rem 0.5rem;
    background-color: var(--bg-color, #f9fafb);
    font-size: 0.85rem;
    color: var(--text-secondary, #6b7280);
    gap: 0.5rem;
}

.aic-code-toolbar.top {
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.aic-code-toolbar.bottom {
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.aic-code-btn {
    background: none;
    border: none;
    color: var(--primary-color, #2563EB);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aic-code-btn:hover {
    background-color: rgba(37, 99, 235, 0.1);
}

pre {
    margin: 0;
    padding: 1rem;
    background-color: #f8f9fa;
    overflow-x: hidden;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Navigation Dots */
.aic-nav-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 1rem;
    overflow-x: auto;
    min-height: 20px;
    background-color: var(--surface-bg, #ffffff);
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.aic-nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.aic-nav-dot.active {
    transform: scale(1.2);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.aic-nav-dot:hover {
    transform: scale(1.1);
}

/* Media Overlay */
.tti-media-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none; /* Toggled by JS */
    align-items: center;
    justify-content: center;
}

.tti-media-dialog {
    background-color: #fff;
    width: 80%;
    max-width: 800px;
    height: 70%;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.tti-media-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tti-media-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.tti-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

/* --- Context Menu Styles (Restored from system_style.css) --- */
.editor-context-menu {
    position: fixed; /* Ensure fixed positioning for context menu */
    background-color: var(--container-bg, #ffffff) !important; 
    border: 1px solid var(--border-color, #e7e7e7);
    border-radius: 10px;
    box-shadow: 0 16px 32px var(--shadow-color, rgba(0,0,0,0.2));
    min-width: 280px;
    max-width: 90vw;
    overflow: hidden;
    z-index: 10100; /* High z-index to be above overlays */
}

.editor-context-menu ul {
    list-style: none;
    margin: 0;
    padding: 6px;
}

.editor-context-menu li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    position: relative; /* For submenu positioning */
}

.editor-context-menu li:hover {
    background-color: var(--hover-bg-subtle);
}

.editor-context-menu li.danger {
    color: var(--color-danger);
}

.editor-context-menu li.danger:hover {
    background-color: var(--color-danger-soft-bg);
}

.editor-context-menu .item-label {
    flex: 1;
}

.editor-context-menu .has-sub {
    position: relative;
}

.editor-context-menu .submenu-arrow {
    margin-left: auto;
    color: #9aa0a6;
}

.editor-actions-submenu {
    position: fixed; /* Fixed to escape overflow of parent */
    background-color: var(--container-bg, #ffffff);
    border: 1px solid var(--border-color, #e7e7e7);
    border-radius: 8px;
    box-shadow: 0 12px 24px var(--shadow-color, rgba(0,0,0,0.18));
    padding: 6px;
    display: none;
    z-index: 10101; /* Above parent menu */
}

.editor-actions-submenu li {
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 6px;
}

.editor-actions-submenu li:hover {
    background-color: var(--hover-bg-subtle);
}

.context-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 10090; /* Below menu but above everything else */
    display: none;
}


/* ==========================================================================
   Merged Styles from style - 副本.css (Missing Components)
   ========================================================================== */

/* Chapter Item Hover Frame */
.chapter-item {
    position: relative;
}

.chapter-item .hover-frame {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    pointer-events: none;
}

/* Focus Visible Styles */
.btn:focus-visible,
.app-navbar .navbar-nav .nav-link:focus-visible,
.app-navbar .dropdown-menu.app-dropdown .dropdown-item:focus-visible {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25) !important;
    outline: none !important;
}

/* Toast Container & Notification Styles */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast {
    background-color: var(--surface-bg, #ffffff);
    border: 1px solid var(--border-color, #e0e0e0);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
    overflow: hidden;
}

.toast-header {
    background-color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #333);
}

.toast-body {
    padding: 0.75rem;
    color: var(--text-primary, #333);
}

.toast-success { border-left: 4px solid var(--color-success, #198754); }
.toast-info { border-left: 4px solid var(--color-info, #0dcaf0); }
.toast-warning { border-left: 4px solid var(--color-warning, #ffc107); }
.toast-danger { border-left: 4px solid var(--color-danger, #dc3545); }

.rt-chunk-text {
    white-space: pre-wrap;
    background: var(--color-bg-subtle);
    cursor: text;
}

.rt-chunk-text mark {
    background: rgba(245, 158, 11, 0.35);
    padding: 0 2px;
    border-radius: 2px;
}

.rt-code-quote {
    white-space: pre-wrap;
    background: var(--color-bg-subtle);
}

.rt-modal .modal-content {
    background-color: var(--surface-bg);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.rt-modal .modal-header {
    border-bottom: 1px solid var(--border-color);
}

.rt-modal .modal-footer {
    border-top: 1px solid var(--border-color);
}

.rt-pane {
    background-color: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.rt-chat-history {
    min-height: 320px;
    max-height: 420px;
    overflow: auto;
    background-color: var(--color-bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    white-space: pre-wrap;
}

.rt-chat-msg {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background-color: var(--surface-bg);
    border: 1px solid var(--border-color);
    margin-bottom: var(--space-2);
}

.rt-chat-msg.rt-chat-user {
    border-left: 4px solid var(--color-primary);
}

.rt-chat-msg.rt-chat-ai {
    border-left: 4px solid var(--color-info);
}

.rt-source-item:hover {
    background-color: var(--hover-bg-subtle);
}

/* Button Overrides */
.btn-success {
    background-color: var(--color-success);
    border-color: var(--color-success);
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    color: #fff;
}

.btn-success:hover {
    background-color: var(--color-success-hover);
    border-color: var(--color-success-active);
}

.app-btn-icon {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.app-btn-icon i {
    font-size: 1rem;
    line-height: 1;
}

/* Callout Styles */
.callout {
    padding: var(--space-4);
    margin-top: var(--space-4);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    border-radius: var(--radius-sm);
}

.callout-info {
    border-left-color: var(--callout-info-color);
}

.callout-warning {
    border-left-color: var(--callout-warning-color);
}

.callout-danger {
    border-left-color: var(--callout-danger-color);
}

/* Tree View Specific Styles (From student/view.html) */
.hover-bg-light:hover {
    background-color: var(--hover-bg-subtle);
}

.material-link-container:hover {
    background-color: var(--hover-bg-subtle);
    border-radius: var(--radius-sm);
}

.tree-prefix {
    font-family: monospace;
    white-space: pre;
}

.chapter-title {
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Utility Classes for Refactoring */
.h-viewport-offset-200 {
    height: calc(100vh - 200px);
}
.resize-none {
    resize: none;
}
.h-200px {
    height: 200px;
}
.h-150px {
    height: 150px;
}
.z-index-2 {
    z-index: 2;
}
.max-w-70 {
    max-width: 70%;
}
.log-area-text {
    font-family: monospace;
    font-size: 0.9rem;
}
/* ǿ  ѡ       ȼ      ⱻ Bootstrap        ʽ     (From backup) */
.app-navbar .navbar-collapse .navbar-nav .nav-item > .nav-link {
    background: transparent !important;
    color: var(--text-secondary) !important;
    border: none !important;
    border-radius: 4px !important;
}

.app-navbar .navbar-nav .nav-link:focus-visible,
.app-navbar .dropdown-menu .dropdown-item:focus-visible {
    outline: 2px solid rgba(13, 110, 253, 0.35);
    outline-offset: 2px;
}

/* Tools: Toolbox Cards */
.app-tools-card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-tools-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.08);
}

.app-tools-card:focus-visible {
    outline: 2px solid rgba(13, 110, 253, 0.35);
    outline-offset: 3px;
}

.app-tools-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(13, 110, 253, 0.1);
    color: var(--color-primary);
}

.app-tools-icon i {
    font-size: 2rem;
    line-height: 1;
}

.app-tools-icon.app-tools-icon-warning {
    background-color: rgba(255, 193, 7, 0.14);
    color: var(--color-warning);
}

.app-tools-icon.app-tools-icon-success {
    background-color: rgba(25, 135, 84, 0.12);
    color: var(--color-success);
}

.app-tools-icon.app-tools-icon-info {
    background-color: rgba(13, 202, 240, 0.14);
    color: var(--color-info);
}

/* Tools: Markdown & LaTeX Renderer */
.app-mdl-shell {
    background: var(--surface-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.app-mdl-split {
    --mdl-left: 50%;
    display: grid;
    grid-template-columns: var(--mdl-left) var(--space-3) 1fr;
    min-height: 66vh;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-bg);
}

.app-mdl-pane {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-mdl-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-subtle);
    border-bottom: 1px solid var(--border-color);
}

.app-mdl-pane-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    font-size: 0.95rem;
}

.app-mdl-editor {
    flex: 1;
    resize: none;
    border: 0;
    outline: none;
    padding: var(--space-4);
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    caret-color: var(--text-primary) !important;
    cursor: text;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--surface-bg);
}

.app-mdl-editor::selection {
    background: rgba(37, 99, 235, 0.32);
}

.app-mdl-editor:focus {
    outline: 2px solid rgba(37, 99, 235, 0.55);
    outline-offset: -2px;
}

.app-mdl-editor::placeholder {
    color: var(--text-muted);
}

.app-mdl-splitter {
    cursor: col-resize;
    background: var(--color-bg-subtle);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    position: relative;
}

.app-mdl-splitter:hover {
    background: var(--hover-bg-subtle);
}

.app-mdl-splitter::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: calc(var(--space-5) * 2);
    background: var(--border-color);
    border-radius: 999px;
}

.app-mdl-preview {
    flex: 1;
    overflow: auto;
    padding: var(--space-4);
    background: var(--surface-bg);
}

.app-mdl-editor.app-mdl-sync-active {
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.55), 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.app-mdl-preview.app-mdl-sync-active {
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.35);
}

.app-mdl-preview .mdl-sync-hl {
    background: rgba(37, 99, 235, 0.14);
    box-shadow: inset 0 -2px 0 rgba(37, 99, 235, 0.28);
    border-radius: 4px;
    padding: 0 0.05em;
}

.app-mdl-preview ul,
.app-mdl-preview ol {
    padding-left: 1.25rem;
}

.app-mdl-preview pre {
    background: var(--color-bg-subtle);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    overflow: auto;
}

.app-mdl-preview code {
    background: var(--color-bg-subtle);
    padding: 0.1rem 0.25rem;
    border-radius: var(--radius-sm);
}

.app-mdl-preview table {
    width: 100%;
}

.app-mdl-preview table th {
    background: var(--table-head-bg);
}

.app-mdl-preview table th,
.app-mdl-preview table td {
    border: 1px solid var(--border-color);
    padding: var(--space-2);
    vertical-align: top;
}

.app-mdl-modal-textarea {
    width: 100%;
    min-height: 45vh;
    resize: vertical;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.9rem;
}

@media (max-width: 992px) {
    .app-mdl-split {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .app-mdl-splitter {
        display: none;
    }
}

/* Tools: Remove BG */
.app-remove-bg-preview {
    min-height: 400px;
    height: 100%;
    background-color: var(--body-bg);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    cursor: default;
}

.app-remove-bg-preview:active {
    cursor: grabbing;
}

.app-remove-bg-preview.transparent-bg {
    background-image:
        linear-gradient(45deg, var(--border-color) 25%, transparent 25%),
        linear-gradient(-45deg, var(--border-color) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--border-color) 75%),
        linear-gradient(-45deg, transparent 75%, var(--border-color) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.app-remove-bg-empty {
    cursor: pointer;
}

.app-remove-bg-context-menu {
    display: none;
    position: absolute;
    z-index: 1000;
    background-color: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.175);
    min-width: 160px;
    padding: .5rem 0;
}

.app-remove-bg-context-menu-item {
    display: block;
    width: 100%;
    padding: .25rem 1.5rem;
    clear: both;
    font-weight: 400;
    color: var(--text-primary);
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    cursor: pointer;
}

.app-remove-bg-context-menu-item:hover {
    color: var(--text-primary);
    background-color: rgba(0,0,0,0.05);
}

.app-remove-bg-sam-point {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--surface-bg);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.app-remove-bg-sam-point.positive {
    background-color: var(--color-success);
}

.app-remove-bg-sam-point.negative {
    background-color: var(--color-danger);
}

.app-remove-bg-sam-controls {
    display: none;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
}

.app-remove-bg-dropzone-highlight {
    background-color: rgba(13, 110, 253, 0.06);
    border-color: rgba(13, 110, 253, 0.55);
}

.app-remove-bg-clear-btn {
    padding: 0 5px;
    font-size: 0.8rem;
}

.app-hidden {
    display: none;
}

.app-z-1050 {
    z-index: 1050;
}

.app-remove-bg-process-btn {
    min-width: 120px;
}

/* Tools: Editors common */
.app-h-600-min {
    min-height: 600px;
}

.app-tool-shell {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--surface-bg);
    overflow: hidden;
}

.tech-param-label {
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.app-help-underline {
    cursor: help;
    border-bottom: 1px dotted rgba(108, 117, 125, 0.8);
}

.app-bg-checkerboard {
    background-image:
        linear-gradient(45deg, var(--border-color) 25%, transparent 25%),
        linear-gradient(-45deg, var(--border-color) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--border-color) 75%),
        linear-gradient(-45deg, transparent 75%, var(--border-color) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.app-simple-remove-bg-layout {
    display: flex;
    min-height: 680px;
}

.app-simple-remove-bg-sidebar {
    flex: 0 0 340px;
    width: 340px;
    background-color: var(--surface-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.app-simple-remove-bg-params-panel {
    padding: var(--space-4);
    background-color: var(--color-bg-subtle);
    border-bottom: 1px solid var(--border-color);
    overflow-y: auto;
    max-height: 40vh;
}

.app-simple-remove-bg-param-input {
    width: 120px;
}

.app-simple-remove-bg-file-list-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-simple-remove-bg-file-list-header {
    padding: var(--space-3) var(--space-4);
    background-color: var(--surface-bg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-simple-remove-bg-file-list {
    flex: 1;
    overflow-y: auto;
}

.app-simple-remove-bg-action-bar {
    padding: var(--space-4);
    border-top: 1px solid var(--border-color);
    background-color: var(--surface-bg);
}

.app-simple-remove-bg-preview-area {
    flex: 1;
    background-color: var(--color-bg-subtle);
    position: relative;
    display: flex;
    flex-direction: column;
}

.app-simple-remove-bg-upload-placeholder {
    border: 2px dashed rgba(108, 117, 125, 0.5);
    border-radius: var(--radius-lg);
    margin: 40px;
    height: calc(100% - 80px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    background-color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    user-select: none;
}

.app-simple-remove-bg-upload-placeholder:hover {
    border-color: rgba(13, 110, 253, 0.55);
    background-color: rgba(13, 110, 253, 0.04);
    color: var(--color-primary);
}

.app-simple-remove-bg-preview-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.app-simple-remove-bg-preview-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.app-simple-remove-bg-file-name {
    max-width: 200px;
}

@media (max-width: 991.98px) {
    .app-simple-remove-bg-layout {
        flex-direction: column;
    }

    .app-simple-remove-bg-sidebar {
        width: 100%;
        flex: 0 0 auto;
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
    }
}

.app-page.app-page-editor {
    display: flex;
    flex-direction: column;
}

.app-page.app-page-editor .app-content {
    flex: 1;
    display: flex;
    min-height: 0;
}

.app-graphic-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--surface-bg);
    overflow: hidden;
}

.app-graphic-editor .toolbar.app-ge-toolbar {
    padding: var(--space-3) var(--space-4);
    background-color: var(--surface-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.app-graphic-editor .toolbar-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-right: var(--space-4);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.app-graphic-editor .toolbar-group:last-child {
    border-right: 0;
    padding-right: 0;
}

.app-graphic-editor .toolbar-group.app-ge-toolbar-group--no-divider {
    border-right: 0;
    padding-right: 0;
}

.app-graphic-editor .tool-btn {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border-color);
    background-color: var(--surface-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
    position: relative;
    padding: 0;
}

.app-graphic-editor .tool-btn:hover {
    background-color: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.14);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.app-graphic-editor .tool-btn:focus-visible {
    outline: 2px solid rgba(13, 110, 253, 0.35);
    outline-offset: 2px;
}

.app-graphic-editor .tool-btn.active {
    background-color: rgba(13, 110, 253, 0.12);
    border-color: rgba(13, 110, 253, 0.55);
    color: var(--color-primary);
}

.app-graphic-editor .tool-btn:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(-1 * (var(--space-5)));
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.app-graphic-editor .setting-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.app-graphic-editor .mode-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    background-color: var(--surface-bg);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-secondary);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-graphic-editor .mode-btn:hover {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.04);
}

.app-graphic-editor .mode-btn.active {
    background-color: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.app-graphic-editor .control-panel {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.app-graphic-editor #panelEditor {
    display: none;
}

.app-graphic-editor .param-group {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.75rem;
}

.app-graphic-editor .param-group input[type="range"] {
    width: 88px;
}

.app-ge-input-30 {
    width: 30px;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.app-ge-input-40 {
    width: 40px;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.app-ge-input-50 {
    width: 50px;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.app-ge-select {
    width: 140px;
}

.app-graphic-editor .app-ge-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--color-bg-subtle);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

.app-graphic-editor canvas {
    background-color: var(--surface-bg);
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.12);
    cursor: crosshair;
    display: none;
}

.app-graphic-editor #uploadPlaceholder {
    color: var(--text-secondary);
    font-size: 1.125rem;
    border: 2px dashed rgba(108, 117, 125, 0.45);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    background-color: rgba(255, 255, 255, 0.55);
    user-select: none;
}

.app-graphic-editor .loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1080;
}

.app-graphic-editor .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.08);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    animation: appGeSpin 1s linear infinite;
    margin-bottom: var(--space-2);
}

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

.app-graphic-editor #layerPicker {
    position: absolute;
    display: none;
    flex-direction: column;
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
    padding: var(--space-2);
    z-index: 2000;
    border-radius: var(--radius-sm);
    max-height: 240px;
    overflow-y: auto;
}

.app-graphic-editor .layer-item {
    width: 20px;
    height: 20px;
    margin-bottom: 2px;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.12);
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.app-graphic-editor .layer-item:hover {
    border-color: rgba(0, 0, 0, 0.35);
    transform: scale(1.08);
}


/* ---------------------------------------------------------- */
/*  Recovered Styles (Auto-synced from backup)                */
/* ---------------------------------------------------------- */
/* 全局容器最大宽度（与原布局一致） */
.btn-secondary {
    background-color: var(--color-neutral);
    border-color: var(--color-neutral);
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
}
.btn-secondary:hover {
    background-color: var(--text-secondary);
    border-color: var(--text-secondary);
}
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger {
    transition: background-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn-outline-primary:hover {
    box-shadow: none;
}
.btn-outline-secondary:hover {
    box-shadow: none;
}
.btn-outline-danger:hover {
    box-shadow: none;
}
/* 主题化反馈颜色（覆盖 Bootstrap 背景色类） */
.bg-success { background-color: var(--color-success) !important; }
.bg-info { background-color: var(--color-info) !important; }
.bg-secondary { background-color: var(--color-neutral) !important; }
.bg-warning { background-color: var(--color-warning) !important; }
.bg-danger { background-color: var(--color-danger) !important; }
.text-success { color: var(--color-success) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.border-success { border-color: var(--color-success) !important; }
/* 表单 */
.form-control {
    border-radius: var(--radius-sm);
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color, #ced4da);
    background-color: var(--container-bg, #ffffff);
}
.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}
.required-star {
    color: var(--color-danger);
    margin-left: 4px;
}
/* 课程列表卡片封面区域 - Consolidated to top of file */
.app-options { margin-bottom: var(--space-3); color: var(--color-text-secondary); }
/* 修正默认深色 Navbar 的视觉以适配主题（兼容旧类名） */
.navbar.navbar-dark.bg-dark {
    background-color: var(--surface-bg) !important;
    border-bottom: 1px solid var(--border-color);
}
.navbar.navbar-dark.bg-dark .navbar-brand,
.navbar.navbar-dark.bg-dark .nav-link,
.navbar.navbar-dark.bg-dark .navbar-nav .nav-link {
    color: var(--text-primary) !important;
}
.chapter-item:hover > .d-flex .chapter-title {
    background-color: var(--color-primary-soft-bg);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}
/* 课程列表标题与动作按钮对齐修复 */
.container > .d-flex.align-items-center.mb-2 .btn {
    margin-left: .5rem;
}
.btn-warning {
    background-color: var(--warning-500, #F59E0B);
    border-color: var(--warning-500, #F59E0B);
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: 10px;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    color: #111827;
}
.btn-warning:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--shadow-color, rgba(0,0,0,0.15));
}
.btn-danger {
    background-color: var(--danger-500, #DC2626);
    border-color: var(--danger-500, #DC2626);
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: 10px;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    color: #ffffff;
}
.btn-danger:hover {
    filter: brightness(0.92);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--shadow-color, rgba(0,0,0,0.15));
}
.task-list { margin-top: 20px; background: var(--container-bg, #fff); border-radius: 8px; padding: 20px; box-shadow: 0 2px 10px var(--shadow-color, rgba(0,0,0,0.07)); }
.log-panel { margin-top: 24px; }
.log-header { display: flex; justify-content: space-between; align-items: center; }
.log-container { max-height: 280px; overflow: auto; border: 1px solid var(--border-color, #dee2e6); border-radius: 6px; }
.log-item { padding: 8px 12px; border-bottom: 1px solid #eee; }
.log-item:last-child { border-bottom: none; }
.status-message { margin-top: 12px; }
.pagination-info { font-size: 0.875em; color: var(--color-text-secondary, #6c757d); }
.material-link .bi { color: var(--color-text-secondary, #6c757d); transition: color 0.2s ease-in-out; }
.material-link:hover .bi { color: var(--primary-700, #2563EB); }
/* 课程消息列表样式（统一命名 app- 前缀） */
.app-message-item { background-color: var(--container-bg, #fff); border: 1px solid var(--border-color, #e5e7eb); border-radius: .25rem; margin-bottom: 1rem; padding: 1.25rem; transition: all .2s ease-in-out; box-shadow: 0 2px 4px var(--shadow-color, rgba(0,0,0,0.08)); }
.app-message-item:hover { transform: translateY(-2px); box-shadow: 0 4px 8px var(--shadow-color, rgba(0,0,0,0.12)); }
.app-message-title { color: var(--primary-700, #2563EB); font-weight: 600; }
.app-message-meta { font-size: .875em; color: var(--color-text, #374151); opacity: .7; }
.app-message-snippet { color: var(--color-text, #374151); margin-top: .5rem; }
.app-message-stats { font-size: .875em; margin-top: 1rem; }
.app-message-stat { margin-right: 1.5rem; }
.app-message-stat-label { font-weight: 500; color: var(--primary-700, #2563EB); }
.app-message-stat-value { color: var(--color-text, #374151); }
.recipient-list-wrapper { position: relative; }
.recipient-search { margin-bottom: .5rem; }
.recipient-list { border: 1px solid var(--border-color, #e5e7eb); border-radius: .25rem; height: 200px; overflow-y: auto; padding: .5rem; background-color: var(--color-bg, #fff); }
/* 上传页面样式 (From upload.html) */
.upload-container { max-width: 800px; margin: 0 auto; padding: 20px; }
.upload-area { border: 2px dashed var(--border-color, #dee2e6); border-radius: var(--radius-lg); padding: 40px; text-align: center; background-color: var(--body-bg); transition: background-color 0.3s ease, border-color 0.3s ease; cursor: pointer; margin-bottom: 20px; }
.upload-area:hover { border-color: var(--color-primary); background-color: var(--color-primary-soft-bg); }
.upload-area.dragover { border-color: var(--color-primary); background-color: var(--color-primary-soft-bg); transform: none; }
.upload-area.disabled { pointer-events: none; opacity: 0.6; filter: grayscale(40%); }
.task-list.disabled { opacity: 0.6; }
.upload-icon { font-size: 3rem; color: var(--color-primary); margin-bottom: 15px; }
.file-info { background-color: var(--surface-bg); border: 1px solid var(--border-color, #dee2e6); border-radius: var(--radius-md); padding: 15px; margin-top: 15px; display: none; }
.progress-container { margin-top: 20px; display: none; }
.upload-progress { height: 8px; border-radius: 4px; }
.upload-progress-bar { background-color: var(--color-primary); }
.task-item { border: 1px solid var(--border-color, #dee2e6); border-radius: 6px; padding: 15px; margin-bottom: 10px; transition: all 0.2s ease; }
.task-item:hover { box-shadow: 0 2px 8px var(--shadow-color, rgba(0,0,0,0.07)); }
.action-buttons { margin-top: 15px; }
.plugin-preview-frame { width: 100%; height: 70vh; border: 0; }
.plugin-html-source { height: 30vh; }
.plugin-runner { height: calc(100vh - 260px); min-height: 520px; border-radius: 10px; overflow: hidden; border: 1px solid rgba(0,0,0,.08); background: #fff; }
.plugin-runner iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.plugin-params-collapsible { max-height: 0; opacity: 0; overflow: hidden; transition: max-height .25s ease, opacity .2s ease; }
.plugin-params-collapsible.is-open { max-height: 1200px; opacity: 1; }
.plugin-preview-frame-wrap { position: relative; min-height: 320px; }
.plugin-preview-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: var(--space-4, 16px); background: rgba(248, 250, 252, 0.88); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.plugin-preview-overlay.is-active { opacity: 1; pointer-events: auto; }
.plugin-preview-overlay-card { width: min(560px, 92%); background: var(--surface-bg, #fff); border: 1px solid var(--border-color, #e2e8f0); border-radius: var(--radius-md, 8px); box-shadow: 0 10px 30px rgba(15, 23, 42, .08); padding: 16px; }

.hr-progress { height: 10px; }
.hr-progress-bar { width: 0%; }
.hr-col-check { width: 40px; }
.hr-col-type { width: 80px; }
.hr-col-size { width: 100px; }
.hr-col-status { width: 140px; }
.hr-col-score { width: 80px; }
.hr-col-summary { width: 300px; }
.hr-col-actions { width: 100px; }
.hr-log-panel { height: 150px; overflow-y: auto; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.hr-json-modal-body { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12px; white-space: pre-wrap; }
.hr-prewrap { white-space: pre-wrap; }
.hr-truncate-200 { max-width: 200px; }
.hr-truncate-300 { max-width: 300px; }

.json-key { color: var(--color-primary); }
.json-string { color: var(--color-success); }
.json-number { color: var(--color-warning); }
.json-boolean { color: var(--color-info); }
.json-null { color: var(--text-muted); }

#resultContent {
    background-color: var(--color-bg-subtle);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    line-height: 1.5;
}

.pf-required-badge {
    display: inline-block;
    margin-left: 6px;
    font-size: 12px;
    color: #dc2626;
    vertical-align: middle;
}

.pf-help {
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
    line-height: 1.5;
}

.pf-field-line {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: nowrap;
}

.pf-field-label {
    margin: 0;
    min-width: 120px;
    max-width: 200px;
    flex-shrink: 0;
    padding-top: 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-field-control {
    flex: 1;
    min-width: 0;
}

.pf-field-control > .form-control,
.pf-field-control > .form-select,
.pf-field-control > .form-range,
.pf-field-control > .form-check,
.pf-field-control > .form-control-color,
.pf-field-control > .pf-combobox-wrap {
    width: 100%;
}

.pf-combobox-wrap { position: relative; }
.pf-combobox-toggle { min-width: 44px; }

.pf-combobox-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 1050;
    display: none;
    max-height: 320px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-bg);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    padding: 6px;
}

.pf-combobox-item {
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 8px 10px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
}

.pf-combobox-item:hover,
.pf-combobox-item:focus {
    outline: none;
    background: var(--hover-bg-subtle);
    border-color: var(--border-color);
}

.pf-run-btn {
    width: auto;
    min-width: 160px;
    max-width: 240px;
}

.pf-session-model-select {
    max-width: 280px;
}

.pf-session-model-label {
    white-space: nowrap;
}

.pf-run-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .pf-run-footer {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.pf-prewrap { white-space: pre-wrap; }
.pf-result-content { font-size: 0.9rem; }
.pf-output-schema-raw { font-size: 0.85rem; }
.pf-output-schema-col-id { width: 180px; }
.pf-output-schema-col-type { width: 120px; }
.pf-output-schema-col-title { width: 180px; }

.pf-json-viewer {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-bg);
    overflow: auto;
    max-height: 520px;
}

.pf-markdown-preview {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-bg);
    padding: 14px 16px;
    overflow: auto;
    max-height: 520px;
}

.pf-markdown-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--color-bg-subtle);
    margin: 8px 0;
}

.pf-markdown-preview pre {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--color-bg-subtle);
    padding: 12px 14px;
    overflow: auto;
}

.pf-markdown-preview code {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
}

.pf-json-row {
    display: grid;
    grid-template-columns: 28px 26px 1fr 2fr minmax(96px, 180px);
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
}

.pf-json-row:last-child { border-bottom: none; }
.pf-json-row:hover { background: var(--hover-bg-subtle); }

.pf-json-path {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-json-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pf-json-toggle {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
}

.pf-json-toggle:hover {
    border-color: var(--border-color);
    background: var(--color-bg-subtle);
    color: var(--text-primary);
}

.pf-json-toggle[disabled] {
    opacity: 0.35;
    pointer-events: none;
}

.pf-json-indent {
    display: inline-block;
    width: 12px;
    height: 1px;
}

.pf-json-type {
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 99px;
    padding: 2px 8px;
    background: var(--color-bg-subtle);
    color: var(--text-secondary);
    white-space: nowrap;
}

.pf-json-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.pf-json-actions .btn-icon {
    padding: 3px 6px;
    border-radius: 8px;
    font-size: 0.75rem;
}

.pf-html-preview-frame {
    width: 100%;
    height: 70vh;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-bg);
}

.app-editor-layout {
    display: flex;
    height: calc(100vh - 220px);
    gap: var(--space-4);
    min-height: 600px;
}

.editor-panel {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.editor-panel.main {
    flex: 1;
    min-width: 0;
}

.editor-panel.sidebar {
    width: 420px;
    flex-shrink: 0;
}

.panel-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    background: var(--color-bg-subtle);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
}

.panel-body.no-padding {
    padding: 0;
}

.panel-footer {
    padding: var(--space-2) var(--space-4);
    border-top: 1px solid var(--border-color);
    background: var(--body-bg);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.prompt-textarea {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    outline: none;
    font-family: "Menlo", "Monaco", "Courier New", monospace;
    font-size: 15px;
    line-height: 1.6;
    padding: var(--space-4);
    color: var(--text-primary);
    background-color: var(--surface-bg);
}

.json-editor {
    font-family: "Menlo", "Monaco", "Courier New", monospace;
    font-size: 13px;
    min-height: 120px;
    background-color: var(--body-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.pf-editor-json-h-100 { height: 100px; }
.pf-editor-json-h-150 { height: 150px; }
.pf-editor-json-h-160 { height: 160px; }

.pf-schema-check {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--color-bg-subtle);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-3);
    display: none;
}

.pf-schema-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pf-schema-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-bg);
    padding: 10px;
}

.pf-schema-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.pf-schema-item-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pf-schema-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.pf-schema-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pf-schema-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.pf-schema-help {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.45;
}

.pf-schema-advanced-toggle {
    cursor: pointer;
}

.pf-kv-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.06);
}

.pf-kv-line:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.pf-kv-label {
    width: 92px;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.pf-kv-control {
    flex: 1;
    min-width: 0;
}

.form-group {
    margin-bottom: var(--space-3);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-1);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.divider {
    height: 1px;
    background-color: var(--border-color);
    margin: var(--space-4) 0;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

.log-panel {
    margin-top: var(--space-4);
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.pf-log-body {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: var(--space-3);
    font-family: "Menlo", "Monaco", "Courier New", monospace;
    font-size: 13px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

.log-entry {
    margin-bottom: var(--space-3);
    border-bottom: 1px solid #333;
    padding-bottom: var(--space-2);
}

.log-entry:last-child { border-bottom: none; }
.log-title { font-weight: bold; margin-bottom: 4px; display: block; }
.log-req { color: #569cd6; }
.log-res { color: #ce9178; }
.log-err { color: #f44747; }

@media (min-width: 992px) {
    #rtThreeColRow {
        flex-wrap: nowrap;
    }
    #rtColMaterials {
        flex: 0 0 320px;
        max-width: 320px;
    }
    #rtColOutputs {
        flex: 0 0 320px;
        max-width: 320px;
    }
    #rtColWorkbench {
        flex: 1 1 auto;
        max-width: none;
    }

    #rtThreeColRow.rt-hide-left #rtColMaterials {
        flex: 0 0 48px;
        max-width: 48px;
    }
    #rtThreeColRow.rt-hide-left #rtColMaterials .card-body {
        padding: .5rem;
    }
    #rtThreeColRow.rt-hide-left #rtColMaterials .rt-side-title {
        writing-mode: vertical-rl;
        text-orientation: mixed;
        letter-spacing: .08em;
    }

    #rtThreeColRow.rt-hide-right #rtColOutputs {
        flex: 0 0 48px;
        max-width: 48px;
    }
    #rtThreeColRow.rt-hide-right #rtColOutputs .card-body {
        padding: .5rem;
    }
    #rtThreeColRow.rt-hide-right #rtColOutputs .rt-side-title {
        writing-mode: vertical-rl;
        text-orientation: mixed;
        letter-spacing: .08em;
    }
}

.rt-material-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: rgba(0, 0, 0, .45);
    cursor: pointer;
}

.list-group-item.active .rt-material-delete {
    color: rgba(255, 255, 255, .78);
}

.rt-material-delete:hover {
    color: var(--bs-danger);
}

.list-group-item.active .rt-material-delete:hover {
    color: var(--bs-danger);
}

.rt-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, .08);
    background: transparent;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.rt-icon-btn i {
    font-size: 14px;
}

.rt-icon-btn-primary {
    color: var(--bs-primary);
}

.rt-icon-btn-muted {
    color: rgba(0, 0, 0, .55);
}

.rt-icon-btn:hover {
    background: rgba(13, 110, 253, .06);
    border-color: rgba(13, 110, 253, .22);
}

.rt-icon-btn-muted:hover {
    background: rgba(108, 117, 125, .10);
    border-color: rgba(108, 117, 125, .25);
}

@media (min-width: 992px) {
    #rtThreeColRow.rt-hide-left #rtColMaterials .rt-side-actions {
        display: none !important;
    }
}

.rt-chunk-text {
    line-height: 1.75;
    white-space: pre-wrap;
}

.rt-coded {
    position: relative;
    display: inline;
    padding: 0 .08em;
    border-radius: .35em;
    background: rgba(25, 135, 84, .08);
    box-shadow: inset 0 0 0 1px rgba(25, 135, 84, .22);
    cursor: pointer;
}

.rt-coded:hover {
    background: rgba(25, 135, 84, .12);
    box-shadow: inset 0 0 0 1px rgba(25, 135, 84, .32);
}

.rt-coded-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4em;
    height: 1.4em;
    padding: 0 .35em;
    margin-right: .35em;
    border-radius: 999px;
    font-size: .78em;
    font-weight: 700;
    color: #0f5132;
    background: rgba(25, 135, 84, .16);
    border: 1px solid rgba(25, 135, 84, .30);
    transform: translateY(-.25em);
}

.settings-inline-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-inline-field .form-label {
    margin-bottom: 0;
    white-space: nowrap;
    min-width: 180px;
}

.settings-inline-field .form-control,
.settings-inline-field .form-select {
    flex: 1;
}

.settings-editor-scroll {
    max-height: 68vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
}

.json-fields-scroll {
    max-height: 48vh;
    overflow: auto;
    padding-right: 0.25rem;
}

.json-pagecontrol .nav-link {
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
}

.json-page-pane {
    max-height: 42vh;
    overflow: auto;
    padding-right: 0.25rem;
}

.json-field-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-body-bg);
}

.json-row-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px 44px;
    gap: 0.5rem;
    align-items: center;
}

.json-row-value .json-value-editor {
    flex: 1;
}

.json-row-value .field-value,
.json-row-value .field-json {
    width: 100%;
}

@media (max-width: 991.98px) {
    .settings-inline-field {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
    }

    .settings-inline-field .form-label {
        min-width: 0;
    }

    .json-row-top {
        grid-template-columns: 1fr;
    }
}

.app-h-240 {
    min-height: 240px;
    height: 240px;
}

.app-h-320 {
    min-height: 320px;
    height: 320px;
}

.app-h-360 {
    min-height: 360px;
    height: 360px;
}

.app-h-420 {
    min-height: 420px;
    height: 420px;
}

.app-h-520 {
    min-height: 520px;
    height: 520px;
}

.app-h-620 {
    min-height: 620px;
    height: 620px;
}

.app-chart-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: inherit;
    height: 100%;
    border: 1px dashed rgba(13, 110, 253, 0.22);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(13, 110, 253, 0.06), rgba(13, 110, 253, 0.02)),
        #f8fbff;
    padding: 20px;
    text-align: center;
}

.app-chart-empty-state__body {
    max-width: 320px;
}

.app-chart-empty-state__icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #0d6efd;
    background: rgba(13, 110, 253, 0.12);
    box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.08);
}

.app-chart-empty-state__title {
    margin-bottom: 6px;
    font-weight: 600;
    color: #1f2937;
}

.app-chart-empty-state__desc {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #6b7280;
}

.concept-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.concept-overview__item {
    min-width: 140px;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(59, 130, 246, 0.14);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(239, 246, 255, 0.9) 100%);
}

.concept-overview__label {
    color: #64748b;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.concept-overview__value {
    color: #0f172a;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.25;
}

.learning-path-panel {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border-color: rgba(148, 163, 184, 0.22) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.learning-path-control-group {
    min-width: min(100%, 560px);
}

.learning-path-control-group .form-select {
    min-width: 300px;
    max-width: 460px;
}

.learning-path-control-group #learningPathPageSelector {
    min-width: 300px;
    max-width: 460px;
}

.learning-path-control-group #learningPathPathSelector {
    min-width: 120px;
    max-width: 184px;
    flex: 0 1 184px;
}

.learning-path-viewport {
    position: relative;
    min-height: 680px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid #dbeafe;
    background:
        radial-gradient(circle at top left, rgba(191, 219, 254, 0.28), transparent 36%),
        linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
    overflow: hidden;
    transition: all 0.28s ease;
}

.learning-path-chart {
    width: 100%;
    height: 620px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.9);
}

.learning-path-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.learning-path-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid #dbeafe;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    color: #0f172a;
    font-size: 13px;
    line-height: 1.2;
}

.learning-path-legend__item--info {
    max-width: 100%;
}

.learning-path-legend__swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.learning-path-legend__text {
    font-weight: 600;
}

.learning-path-legend__meta {
    color: #64748b;
}

.learning-path-viewport.is-maximized {
    position: fixed;
    inset: 28px 24px 20px;
    z-index: 1081;
    padding: 20px 24px 24px;
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(219, 234, 254, 0.72), transparent 32%),
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 24px 72px rgba(15, 23, 42, 0.22);
}

.learning-path-viewport.is-maximized .learning-path-chart {
    height: calc(100vh - 164px) !important;
    min-height: 620px;
}

body.learning-path-viewport-open {
    overflow: hidden;
}

body.learning-path-viewport-open::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1080;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(4px);
    pointer-events: none;
}

@media (max-width: 768px) {
    .learning-path-control-group {
        width: 100%;
    }

    .learning-path-control-group .form-select {
        min-width: 100%;
        max-width: none;
    }

    .learning-path-control-group #learningPathPathSelector {
        flex-basis: 100%;
    }

    .learning-path-viewport.is-maximized {
        inset: 12px;
        padding: 16px;
        border-radius: 18px;
    }

    .learning-path-viewport.is-maximized .learning-path-chart {
        height: calc(100vh - 196px) !important;
        min-height: 520px;
    }
}

.learning-path-card {
    width: 100%;
    padding: 1rem 1rem 0.95rem;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
    text-align: left;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.learning-path-card:hover,
.learning-path-card:focus,
.learning-path-card.is-active {
    border-color: rgba(37, 99, 235, 0.34);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
    outline: none;
}

.learning-path-card__sequence {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    color: #0f172a;
    line-height: 1.7;
}

.learning-path-card__node {
    display: inline-flex;
    align-items: center;
    max-width: 180px;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.learning-path-card__arrow {
    color: #94a3b8;
    font-size: 0.8rem;
}

.learning-path-explorer {
    display: grid;
    gap: 0.85rem;
    max-height: 780px;
    overflow-y: auto;
    padding-right: 0.1rem;
}

.learning-path-layer {
    padding: 0.95rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
}

.learning-path-layer__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.learning-path-layer__title {
    color: #0f172a;
    font-weight: 700;
}

.learning-path-layer__source {
    color: #475569;
    font-size: 0.86rem;
    line-height: 1.55;
}

.learning-path-layer__source strong {
    color: #1e293b;
}

.learning-path-edge {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.75rem;
}

.learning-path-edge__line {
    display: inline-block;
    height: 6px;
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.03);
    flex: 0 0 auto;
}

.learning-path-edge__body {
    min-width: 0;
    flex: 1;
}

.learning-path-edge__target {
    display: block;
    color: #0f172a;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.learning-path-edge__meta {
    color: #64748b;
    font-size: 0.78rem;
    margin-top: 0.12rem;
}

.learning-path-edge.is-anchor .learning-path-edge__target {
    color: #1d4ed8;
}

.learning-path-layer__empty {
    margin-top: 0.75rem;
    color: #94a3b8;
    font-size: 0.84rem;
}

.app-info-icon-small {
    font-size: 0.9em;
}

.app-clickable-input {
    cursor: pointer;
}

.app-badge-xs {
    font-size: 0.7em;
}

.friction-link {
    min-width: 0;
}

.friction-link__title {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friction-link__meta {
    display: block;
    margin-top: 0.1rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.45;
}

.friction-details {
    border-top: 1px dashed var(--border-color);
    padding-top: 0.5rem;
}

.friction-details__summary {
    cursor: pointer;
    color: var(--color-primary);
    font-size: 0.82rem;
    font-weight: 600;
    list-style: none;
    user-select: none;
}

.friction-details__summary::-webkit-details-marker {
    display: none;
}

.friction-details__summary::before {
    content: "展开详细信息";
}

.friction-details[open] .friction-details__summary::before {
    content: "收起详细信息";
}
