/* Dashboard cards (favorites / popular) */
.dashboard-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: white;
    padding: 1rem 1.25rem 0.5rem;
    display: flex;
    flex-direction: column;
}

.dark .dashboard-card {
    background: #1f2937;
    border-color: #374151;
}

.dashboard-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.5rem;
}

.dashboard-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111827;
}

.dark .dashboard-card-title {
    color: #f3f4f6;
}

.dashboard-card-link {
    font-size: 0.8125rem;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.15s;
}

.dashboard-card-link:hover {
    color: #111827;
}

.dark .dashboard-card-link {
    color: #9ca3af;
}

.dark .dashboard-card-link:hover {
    color: #f3f4f6;
}

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

.dashboard-list > li + li {
    border-top: 1px solid #f3f4f6;
}

.dark .dashboard-list > li + li {
    border-top-color: #374151;
}

.dashboard-list-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.25rem;
    text-decoration: none;
    color: inherit;
    border-radius: 0.375rem;
    transition: background-color 0.15s;
}

.dashboard-list-row:hover {
    background-color: #f9fafb;
}

.dark .dashboard-list-row:hover {
    background-color: #374151;
}

.dashboard-list-icon {
    color: #9ca3af;
    font-size: 0.875rem;
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.dashboard-list-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.3;
}

.dark .dashboard-list-title {
    color: #f3f4f6;
}

.dashboard-list-meta {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.125rem;
}

.dark .dashboard-list-meta {
    color: #9ca3af;
}

.dashboard-list-meta-sep {
    margin: 0 0.25rem;
    color: #d1d5db;
}

.dark .dashboard-list-meta-sep {
    color: #4b5563;
}

.dashboard-empty {
    padding: 2rem 1rem;
    text-align: center;
}

/* Popular this month */
.popular-rank {
    font-size: 0.75rem;
    font-weight: 500;
    color: #9ca3af;
    flex-shrink: 0;
    width: 1.5rem;
    font-variant-numeric: tabular-nums;
}

.popular-bar-track {
    width: 5rem;
    height: 0.375rem;
    background: #f3f4f6;
    border-radius: 999px;
    overflow: hidden;
    flex-shrink: 0;
}

.dark .popular-bar-track {
    background: #374151;
}

.popular-bar-fill {
    height: 100%;
    background: #111827;
    border-radius: 999px;
}

.dark .popular-bar-fill {
    background: #f3f4f6;
}

.popular-stats {
    text-align: right;
    flex-shrink: 0;
    min-width: 3rem;
}

.popular-count {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

.dark .popular-count {
    color: #f3f4f6;
}

.popular-delta {
    font-size: 0.6875rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.popular-delta-up {
    color: #059669;
}

.popular-delta-down {
    color: #dc2626;
}

.dark .popular-delta-up {
    color: #34d399;
}

.dark .popular-delta-down {
    color: #f87171;
}

/* Recently updated table */
.recently-updated-card {
    padding: 1rem 1.25rem 1rem;
}

.ru-table-wrap {
    overflow-x: auto;
}

.ru-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.ru-table thead th {
    text-align: left;
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    color: #6b7280;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-top: 1px solid #f3f4f6;
    border-bottom: 1px solid #f3f4f6;
    white-space: nowrap;
}

.dark .ru-table thead th {
    color: #9ca3af;
    background: #111827;
    border-color: #374151;
}

.ru-table tbody td {
    padding: 0.625rem 0.75rem;
    border-top: 1px solid #f3f4f6;
    color: #374151;
    vertical-align: middle;
}

.dark .ru-table tbody td {
    color: #d1d5db;
    border-top-color: #374151;
}

.ru-row {
    cursor: pointer;
    transition: background-color 0.15s;
}

.ru-row:hover {
    background-color: #f9fafb;
}

.dark .ru-row:hover {
    background-color: #374151;
}

.ru-row:hover .ru-title-cell {
    color: #0284c7;
}

.dark .ru-row:hover .ru-title-cell {
    color: #38bdf8;
}

.ru-col-views {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #111827;
    width: 1%;
    white-space: nowrap;
}

.dark .ru-col-views {
    color: #f3f4f6;
}

.ru-table th.ru-col-views {
    text-align: right;
    font-weight: 500;
    color: #6b7280;
}

.ru-title-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #111827;
    font-weight: 600;
    max-width: 100%;
    transition: color 0.15s;
}

.dark .ru-title-cell {
    color: #f3f4f6;
}

.ru-title-icon {
    color: #9ca3af;
    flex-shrink: 0;
}

.ru-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 14rem;
}

.ru-col-updated {
    color: #6b7280;
    white-space: nowrap;
}

.dark .ru-col-updated {
    color: #9ca3af;
}

.ru-author {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ru-author-name {
    font-weight: 500;
    color: #374151;
}

.dark .ru-author-name {
    color: #d1d5db;
}

/* Recently viewed cards */
.recently-viewed-card {
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: white;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.recently-viewed-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.08);
}

.dark .recently-viewed-card {
    background: #1f2937;
    border-color: #374151;
}

.dark .recently-viewed-card:hover {
    border-color: #4b5563;
}

.recently-viewed-card-top {
    height: 5rem;
    padding: 0.75rem;
    display: flex;
    align-items: flex-start;
    background: linear-gradient(180deg, var(--rv-color, #f3f4f6) 0%, rgba(255, 255, 255, 0.6) 100%);
}

.dark .recently-viewed-card-top {
    background: linear-gradient(180deg, var(--rv-color-dark, #374151) 0%, rgba(31, 41, 55, 0.6) 100%);
}

.recently-viewed-tag {
    background: rgba(255, 255, 255, 0.85);
    color: #1f2937;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.2rem 0.55rem;
    border-radius: 0.375rem;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.dark .recently-viewed-tag {
    background: rgba(17, 24, 39, 0.7);
    color: #f3f4f6;
    border-color: rgba(255, 255, 255, 0.06);
}

.recently-viewed-color-green   { --rv-color: #d1fae5; --rv-color-dark: #064e3b; }
.recently-viewed-color-yellow  { --rv-color: #fef3c7; --rv-color-dark: #78350f; }
.recently-viewed-color-pink    { --rv-color: #fce7f3; --rv-color-dark: #831843; }
.recently-viewed-color-blue    { --rv-color: #dbeafe; --rv-color-dark: #1e3a8a; }
.recently-viewed-color-purple  { --rv-color: #ede9fe; --rv-color-dark: #4c1d95; }
.recently-viewed-color-red     { --rv-color: #fee2e2; --rv-color-dark: #7f1d1d; }
.recently-viewed-color-teal    { --rv-color: #ccfbf1; --rv-color-dark: #134e4a; }
.recently-viewed-color-lime    { --rv-color: #ecfccb; --rv-color-dark: #365314; }
.recently-viewed-color-slate   { --rv-color: #e5e7eb; --rv-color-dark: #374151; }

.recently-viewed-YKc5d0e7f2gYK {
    padding: 0.875rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.5rem;
}

.recently-viewed-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark .recently-viewed-title {
    color: #f3f4f6;
}

.recently-viewed-excerpt {
    font-size: 0.8125rem;
    color: #6b7280;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.dark .recently-viewed-excerpt {
    color: #9ca3af;
}

.recently-viewed-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Knowledge Editor Styles */

.knowledge-content-inner {
    max-width: 800px;
    margin: 0 auto;
}

.knowledge-content-inner.full-width {
    max-width: 100%;
}

/* Tree sidebar */
.tree-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    padding: 0.75rem 1rem 0.25rem;
    font-weight: 600;
}

.dark .tree-section-title {
    color: #9ca3af;
}

.tree-row {
    display: flex;
    align-items: center;
    min-width: 0;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 0.3rem 0.5rem;
    margin: 0 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.15s;
    gap: 0.5rem;
    min-width: 0;
}

.tree-item:hover {
    background-color: #e5e7eb;
}

.dark .tree-item {
    color: #d1d5db;
}

.dark .tree-item:hover {
    background-color: #374151;
}

.tree-item.active {
    background-color: #dbeafe;
    color: #1d4ed8;
    font-weight: 500;
}

.dark .tree-item.active {
    background-color: #1e3a5f;
    color: #60a5fa;
}

.tree-item-icon {
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.dark .tree-item-icon {
    color: #9ca3af;
}

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

.tree-row-folder .tree-item {
    color: #111827;
}

.dark .tree-row-folder .tree-item {
    color: #f3f4f6;
}

.tree-row-folder .tree-item-title {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
}

.tree-item-count {
    font-size: 0.75rem;
    color: #9ca3af;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 0.5rem;
}

.dark .tree-item-count {
    color: #6b7280;
}

.tree-row:hover .tree-item-count {
    display: none;
}

.tree-toggle {
    width: 1rem;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #9ca3af;
    transition: transform 0.15s;
    cursor: pointer;
    border-radius: 0.25rem;
}

.tree-toggle:hover {
    background-color: #d1d5db;
}

.dark .tree-toggle:hover {
    background-color: #4b5563;
}

.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-children {
    padding-left: 1rem;
}

.tree-item-actions {
    display: none;
    align-items: center;
    gap: 0.25rem;
}

.tree-item:hover .tree-item-actions {
    display: flex;
}

.tree-action-btn {
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    color: #9ca3af;
    font-size: 0.75rem;
    border: none;
    background: none;
    cursor: pointer;
}

.tree-action-btn:hover {
    background-color: #d1d5db;
    color: #374151;
}

.dark .tree-action-btn:hover {
    background-color: #4b5563;
    color: #d1d5db;
}

/* Editor toolbar */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.125rem;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0;
    background: #f9fafb;
}

.dark .editor-toolbar {
    background: #1f2937;
    border-color: #374151;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.375rem;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.toolbar-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.dark .toolbar-btn:hover {
    background: #374151;
    color: #d1d5db;
}

.toolbar-btn-active {
    background: #dbeafe;
    color: #2563eb;
}

.dark .toolbar-btn-active {
    background: #1e3a5f;
    color: #60a5fa;
}

.toolbar-separator {
    width: 1px;
    height: 1.5rem;
    background: #e5e7eb;
    margin: 0.25rem 0.25rem;
    align-self: center;
}

.dark .toolbar-separator {
    background: #374151;
}

/* Editor content area */
.editor-wrapper {
    position: relative;
}

.knowledge-editor-content {
    min-height: 400px;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0 0 0.5rem 0.5rem;
    outline: none;
    font-size: 1rem;
    line-height: 1.75;
    color: #111827;
}

.dark .knowledge-editor-content {
    border-color: #374151;
    color: #f3f4f6;
    background: #111827;
}

.knowledge-editor-content:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* TipTap content styles */
.knowledge-editor-content h1 {
    font-size: 2em;
    font-weight: 700;
    margin: 1rem 0 0.5rem;
    line-height: 1.2;
}

.knowledge-editor-content h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem;
    line-height: 1.3;
}

.knowledge-editor-content h3 {
    font-size: 1.25em;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem;
    line-height: 1.4;
}

.knowledge-editor-content p {
    margin: 0.5rem 0;
}

.knowledge-editor-content ul,
.knowledge-editor-content ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.knowledge-editor-content li {
    margin: 0.25rem 0;
}

.knowledge-editor-content ul[data-type="taskList"] {
    list-style: none;
    padding-left: 0;
}

.knowledge-editor-content ul[data-type="taskList"] li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.knowledge-editor-content ul[data-type="taskList"] li label {
    margin-top: 0.25rem;
}

.knowledge-editor-content blockquote {
    border-left: 3px solid #d1d5db;
    padding-left: 1rem;
    margin: 0.5rem 0;
    color: #6b7280;
}

.dark .knowledge-editor-content blockquote {
    border-left-color: #4b5563;
    color: #9ca3af;
}

.knowledge-editor-content pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
    overflow-x: auto;
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.875rem;
}

.knowledge-editor-content code {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.875em;
}

.dark .knowledge-editor-content code {
    background: #374151;
}

.knowledge-editor-content pre code {
    background: none;
    padding: 0;
}

.knowledge-editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
}

.knowledge-editor-content hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 1.5rem 0;
}

.dark .knowledge-editor-content hr {
    border-top-color: #374151;
}

.knowledge-editor-content mark {
    background-color: #fef08a;
    padding: 0.125rem 0;
    border-radius: 0.125rem;
}

.dark .knowledge-editor-content mark {
    background-color: #854d0e;
}

.knowledge-editor-content a {
    color: #2563eb;
    text-decoration: underline;
}

.dark .knowledge-editor-content a {
    color: #60a5fa;
}

.knowledge-editor-content .is-empty::before {
    content: attr(data-placeholder);
    float: left;
    color: #9ca3af;
    pointer-events: none;
    height: 0;
}

/* Slash command menu */
.slash-menu {
    position: fixed;
    z-index: 50;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 0.25rem;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.dark .slash-menu {
    background: #1f2937;
    border-color: #374151;
}

.slash-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #374151;
    text-align: left;
}

.slash-menu-item:hover {
    background: #f3f4f6;
}

.dark .slash-menu-item {
    color: #d1d5db;
}

.dark .slash-menu-item:hover {
    background: #374151;
}

.slash-menu-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.dark .slash-menu-icon {
    background: #374151;
}

/* Save indicator */
.save-indicator {
    transition: opacity 0.3s;
    font-size: 0.75rem;
    color: #6b7280;
}

/* Article title input */
.article-title-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    background: transparent;
    padding: 0;
    line-height: 1.2;
}

.article-title-input::placeholder {
    color: #d1d5db;
}

.dark .article-title-input {
    color: #f3f4f6;
}

.dark .article-title-input::placeholder {
    color: #4b5563;
}

/* Article detail header */
.article-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.dark .article-breadcrumb {
    color: #9ca3af;
}

.article-breadcrumb-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #6b7280;
    text-decoration: none;
    transition: color 0.15s;
    border-radius: 0.25rem;
    padding: 0.1rem 0.25rem;
}

.article-breadcrumb-link:hover {
    color: #0284c7;
    background: #f3f4f6;
}

.dark .article-breadcrumb-link {
    color: #9ca3af;
}

.dark .article-breadcrumb-link:hover {
    color: #38bdf8;
    background: #374151;
}

.article-breadcrumb-sep {
    color: #d1d5db;
    font-size: 0.625rem;
}

.dark .article-breadcrumb-sep {
    color: #4b5563;
}

.article-breadcrumb-current {
    color: #111827;
    font-weight: 500;
    padding: 0.1rem 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 22rem;
}

.dark .article-breadcrumb-current {
    color: #f3f4f6;
}

.article-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.article-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.article-header-icon {
    font-size: 1.5rem;
    color: #6b7280;
    flex-shrink: 0;
    line-height: 1;
}

.dark .article-header-icon {
    color: #9ca3af;
}

.article-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    padding-top: 0.4rem;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.6rem;
    margin-bottom: 1.5rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

.dark .article-meta {
    color: #9ca3af;
}

.article-meta-author {
    font-weight: 500;
    color: #374151;
}

.dark .article-meta-author {
    color: #d1d5db;
}

.article-meta-sep {
    color: #d1d5db;
}

.dark .article-meta-sep {
    color: #4b5563;
}

/* Search */
.knowledge-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: white;
    outline: none;
}

.knowledge-search-input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark .knowledge-search-input {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

/* Empty state */
.knowledge-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    text-align: center;
    padding: 2rem;
}

.knowledge-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

