body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
}

.sidebar {
    width: 50px;
    background: linear-gradient(160deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar a {
    color: rgba(173, 216, 230, 0.8);
    text-decoration: none;
    margin: 10px 0;
    font-size: 18px;
    display: block;
    padding: 10px 6px;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    width: 38px;
    text-align: center;
}

.sidebar a:hover {
    color: #e0f7ff;
    background: rgba(0, 150, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 150, 255, 0.4);
    transform: translateY(-1px);
    font-size: 20px;
}

.sidebar a.active {
    color: #fff;
    background: rgba(0, 150, 255, 0.3);
    box-shadow: 0 0 12px rgba(0, 150, 255, 0.5);
}

.sidebar a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(45deg, transparent, rgba(0, 150, 255, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar a:hover::before {
    opacity: 1;
}

.sidebar a.active::before {
    opacity: 1;
    background: linear-gradient(45deg, transparent, rgba(0, 150, 255, 0.2));
}

.sidebar .theme-toggle {
    color: rgba(173, 216, 230, 0.8);
    margin: 10px 0;
    font-size: 18px;
    display: block;
    padding: 10px 6px;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    width: 38px;
    text-align: center;
    background: transparent;
    border: none;
    cursor: pointer;
}

.sidebar .theme-toggle:hover {
    color: #e0f7ff;
    background: rgba(0, 150, 255, 0.2);
    box-shadow: 0 0 10px rgba(0, 150, 255, 0.4);
    transform: translateY(-1px);
    font-size: 20px;
}

.sidebar .theme-toggle.active {
    color: #fff;
    background: rgba(0, 150, 255, 0.3);
    box-shadow: 0 0 12px rgba(0, 150, 255, 0.5);
}

.sidebar .theme-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(45deg, transparent, rgba(0, 150, 255, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar .theme-toggle:hover::before,
.sidebar .theme-toggle.active::before {
    opacity: 1;
}

main {
    margin-left: 50px;
    padding: 20px;
    width: calc(100vw - 120px);
    box-sizing: border-box;
    overflow-x: auto;
}

.home-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.edit-mode-btn {
    padding: 6px 14px;
    border: 1px solid #007bff;
    background: #fff;
    color: #007bff;
    border-radius: 4px;
    cursor: pointer;
}

.edit-mode-btn:hover {
    background: #f0f7ff;
}

.add-link-form form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.add-link-form input[type="text"] {
    min-width: 220px;
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.add-link-form button {
    padding: 8px 16px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.links-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.links-group {
    background: #f7f7f7;
    border-radius: 8px;
    padding: 8px 12px;
}

.links-group.is-drag-over {
    outline: 2px dashed #007bff;
    background: #eef6ff;
}

.links-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    cursor: grab;
}

.links-group-header:active {
    cursor: grabbing;
}

.links-group-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.links-group-title i {
    margin-right: 6px;
    color: #999;
}

.group-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    transition: all 0.2s ease;
    opacity: 0.65;
}

.links-group-header:hover .group-add-btn,
.group-add-btn:hover {
    opacity: 1;
}

.group-add-btn:hover {
    background: #e2e8f0;
    color: #007bff;
    transform: scale(1.1);
}

.links-group-count {
    color: #666;
    font-size: 11px;
}

/* Home Bookmark Add Modal */
.home-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
    animation: homeModalFadeIn 0.2s ease;
}

.home-modal-card {
    background: #ffffff;
    border-radius: 10px;
    width: 460px;
    max-width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    animation: homeModalScaleIn 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes homeModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes homeModalScaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.home-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #eef2f6;
    background: #f8fafc;
}

.home-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.home-modal-header h3 i {
    color: #007bff;
    font-size: 14px;
}

.home-modal-group-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e0f2fe;
    color: #0284c7;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.home-modal-close:hover {
    color: #334155;
}

.home-modal-form {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.home-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.home-form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
}

.home-form-group .required-star {
    color: #ef4444;
}

.home-form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.home-form-group input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.home-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 6px;
}

.home-modal-actions .btn-cancel {
    padding: 7px 15px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.home-modal-actions .btn-cancel:hover {
    background: #f1f5f9;
}

.home-modal-actions .btn-submit {
    padding: 7px 18px;
    border: none;
    background: #007bff;
    color: #ffffff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.home-modal-actions .btn-submit:hover {
    background: #0069d9;
}

.home-modal-actions .btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.links-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 4px;
}

.link-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 3px 6px;
    gap: 2px;
    min-height: 28px;
}

.link-item.is-dragging {
    opacity: 0.6;
}

.link-item.is-drag-over {
    border-color: #007bff;
    background: #f0f7ff;
}

.link-main {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
}

.link-title {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-main a:hover {
    text-decoration: underline;
}

.link-url {
    color: #666;
    font-size: 10px;
    word-break: break-all;
}


.link-main input[type="text"] {
    padding: 3px 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
}

.link-note-input {
    font-size: 10px;
    padding: 3px 5px;
    border: 1px dashed #ddd;
    border-radius: 4px;
}

.link-note-save-row {
    display: flex;
    justify-content: flex-end;
}

.link-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.link-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6c757d;
    font-size: 12px;
    padding: 2px 4px;
}

.link-action-btn:hover {
    color: #007bff;
}

.link-action-save {
    color: #28a745;
}

.link-action-cancel {
    color: #6c757d;
}

.link-action-delete {
    color: #dc3545;
}

.navigation, .tools, .tools-section {
    background: #f4f4f4;
    padding: 20px;
    border-radius: 8px;
}

.tools-section h2 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.tools-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}

.tool-item {
    background: white;
    padding: 10px 15px;
    border-radius: 6px;
    border-left: 4px solid #007bff;
    transition: all 0.3s ease;
}

.tool-item:hover {
    background: #e3f2fd;
    transform: translateX(5px);
}

.tool-item a {
    text-decoration: none;
    color: #007bff;
    font-weight: 500;
    display: block;
}

.tool-item a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.tasks {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task {
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
}

.subtasks {
    margin-left: 20px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    min-width: 800px;
    max-width: 1200px;
    border-radius: 8px;
}

.notes-container {
    width: 100%;
    margin: 0;
}

.notes-layout {
    display: flex;
    gap: 20px;
    min-width: 0;
}

.notes-main {
    flex: 1 1 auto;
    min-width: 0;
}

.notes-sidebar {
    flex: 0 0 300px; /* Fixed width of 300px, don't grow or shrink */
    background: #f8f8f8;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.add-note {
    margin-bottom: 20px;
}

.add-note textarea {
    width: 100%;
    height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
}

.add-note input[type="text"] {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.tags-input-with-button {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
}

.note-created-date-picker {
    position: relative;
}

.note-created-date-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.note-created-date-btn {
    white-space: nowrap;
    min-width: 90px;
}

.note-created-date-reset-btn {
    margin-left: 6px;
    white-space: nowrap;
}

.tags-input-container {
    position: relative;
    flex: 1;
}

.tags-input-container input[type="text"] {
    width: 80%;
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-height: none;
    overflow: visible;
    z-index: 1000;
    margin-top: 4px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}

.tag-suggestions.task-tag-suggestions {
    padding: 6px;
    gap: 6px;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
}

.tag-suggestion {
    padding: 6px 8px;
    cursor: pointer;
    border: 1px solid #e5e5e5;
    background: #f8f9fa;
    color: #333;
    text-align: center;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    gap: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-suggestion.active {
    background: #e2e8f5;
    border-color: #c9d2e3;
}

.tag-suggestions.task-tag-suggestions .tag-suggestion {
    padding: 4px 6px;
    font-size: 11px;
    border-radius: 10px;
}

.tag-suggestion:hover {
    background: #e9ecef;
}

.tag-suggestion:active {
    background: #dde1e6;
}

.tag-suggestion-name {
    font-weight: 600;
}

.tag-suggestion-count {
    color: #666;
    font-size: 11px;
}

.tag-suggestions.task-tag-suggestions .tag-suggestion-count {
    font-size: 10px;
}

.stock-container {
    background: #f8f8f8;
    padding: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stock-header {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.stock-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.stock-toolbar input {
    flex: 1;
    min-width: 220px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.stock-toolbar button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: #007bff;
    color: white;
    cursor: pointer;
}

.stock-toolbar button.secondary {
    background: #6c757d;
}

.stock-search-results {
    margin-top: 10px;
    border: 1px solid #eee;
    border-radius: 6px;
    background: #fff;
    max-height: 200px;
    overflow-y: auto;
}

.stock-search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.stock-search-item:last-child {
    border-bottom: none;
}

.stock-search-main {
    display: flex;
    gap: 8px;
    align-items: center;
}

.stock-search-hint {
    margin-top: 6px;
    color: #888;
    font-size: 0.85em;
}

.stock-sync-message {
    margin-top: 8px;
    color: #2b7a2f;
    font-size: 0.9em;
}

.stock-list {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.stock-indices {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stock-indices-total {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 14px;
    margin: -8px 0 16px;
    padding: 8px 12px;
    background: #f7f8fa;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 0.85em;
}

.stock-indices-total-label {
    font-weight: 600;
    color: #444;
}

.stock-indices-total-item {
    color: #333;
    font-variant-numeric: tabular-nums;
}

.stock-indices-total-hint {
    margin-left: auto;
    color: #98a1ad;
    font-size: 0.9em;
}

.stock-index {
    background: #fff;
    border: 1px solid #eee;
    border-left: 3px solid #d8dde5;
    border-radius: 8px;
    padding: 10px 12px;
    min-width: 0;
}

.stock-index.is-up {
    border-left-color: #d9534f;
}

.stock-index.is-down {
    border-left-color: #28a745;
}

.stock-index-name {
    font-size: 0.8em;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-index-value {
    font-size: 1.25em;
    font-weight: 600;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}

.stock-index-change {
    font-size: 0.8em;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stock-index-change .fa-minus {
    font-size: 0.8em;
}

.stock-index-percent {
    margin-left: 2px;
}

.stock-index.is-up .stock-index-value,
.stock-index.is-up .stock-index-change {
    color: #d9534f;
}

.stock-index.is-down .stock-index-value,
.stock-index.is-down .stock-index-change {
    color: #28a745;
}

.stock-list-title {
    display: flex;
    gap: 10px;
    align-items: center;
    font-weight: 600;
    margin-bottom: 8px;
}

.stock-loading {
    font-size: 0.85em;
    color: #666;
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.stock-table th,
.stock-table td {
    padding: 8px 6px;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
}

.stock-table th {
    color: #666;
    font-weight: 600;
}

.stock-code {
    color: #888;
    font-size: 0.8em;
}

.stock-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.stock-actions .icon {
    background: #f1f3f5;
    border: 1px solid #ddd;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
}

.stock-actions .icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.stock-actions .icon i {
    pointer-events: none;
}

.stock-actions .icon-unfollow {
    color: #dc3545;
    background: #fdf3f4;
    border-color: #f0c4c7;
}

.stock-actions .icon-unfollow:hover {
    color: #fff;
    background: #dc3545;
    border-color: #dc3545;
}

.stock-up {
    color: #d9534f;
    font-weight: 600;
}

.stock-down {
    color: #28a745;
    font-weight: 600;
}

.stock-muted {
    color: #aaa;
}

.stock-market-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 8px;
    font-size: 12px;
    font-weight: 400;
    color: #8a94a6;
}

.stock-market-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #b6bfcc;
    flex: 0 0 auto;
}

.stock-market-status.is-open .stock-market-dot {
    background: #d9534f;
    animation: stock-market-pulse 1.6s ease-in-out infinite;
}

.stock-market-status.is-open {
    color: #d9534f;
}

.stock-market-status.is-closed .stock-market-dot {
    background: #b6bfcc;
}

@keyframes stock-market-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.stock-holding-cell {
    white-space: nowrap;
}

.stock-actions .icon-edit {
    color: #0d6efd;
    background: #eff5ff;
    border-color: #cfe0fb;
}

.stock-actions .icon-edit:hover {
    color: #fff;
    background: #0d6efd;
    border-color: #0d6efd;
}

.stock-actions .icon-advice {
    color: #4f46e5;
    background: #eef2ff;
    border-color: #c7d2fe;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11.5px;
    font-weight: 500;
}

.stock-actions .icon-advice:hover {
    color: #fff;
    background: #4f46e5;
    border-color: #4f46e5;
}

/* 持仓录入弹框 */
.stock-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.stock-modal-panel {
    width: min(420px, 92vw);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    color: #333;
}

.stock-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid #e5e7eb;
}

.stock-modal-title {
    font-size: 16px;
    font-weight: 600;
}

.stock-modal-subtitle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    color: #666;
}

.stock-modal-close {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #666;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    flex: 0 0 auto;
}

.stock-modal-close:hover {
    color: #333;
    border-color: #cbd5e1;
}

.stock-modal-body {
    padding: 16px 18px;
    display: grid;
    gap: 12px;
}

.stock-field {
    display: grid;
    gap: 4px;
    font-size: 13px;
    color: #555;
}

.stock-field input {
    padding: 7px 9px;
    border: 1px solid #d5d9e0;
    border-radius: 6px;
    font-size: 14px;
}

.stock-modal-preview {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #f7f9fc;
    border: 1px solid #e8ecf3;
    font-size: 13px;
}

.stock-modal-preview > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.stock-modal-preview span {
    color: #6b7280;
}

.stock-modal-hint {
    font-size: 12px;
    color: #8a94a6;
    line-height: 1.5;
}

.stock-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px 16px;
    border-top: 1px solid #e5e7eb;
}

.stock-empty {
    color: #888;
    font-size: 0.9em;
    padding: 12px 0;
}

.stock-error {
    margin-top: 10px;
    color: #dc3545;
    font-size: 0.9em;
}

/* AI建议弹框样式 */
.stock-advice-panel {
    width: min(760px, 94vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}

.stock-advice-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.advice-model-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.stock-advice-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    vertical-align: middle;
}

.stock-advice-tag.is-买入 {
    background: #fdf3f4;
    color: #d9534f;
    border: 1px solid #f0c4c7;
}

.stock-advice-tag.is-卖出 {
    background: #f0fdf4;
    color: #28a745;
    border: 1px solid #bbf7d0;
}

.stock-advice-tag.is-观望 {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.stock-advice-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stock-advice-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 36px 20px;
    color: #4f46e5;
    font-size: 18px;
}

.stock-advice-loading-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    color: #4b5563;
}

.stock-advice-loading-sub {
    font-size: 12px;
    color: #9ca3af;
}

.stock-advice-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    background: #fdf2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 13px;
}

.stock-advice-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
}

.stock-advice-banner-icon {
    font-size: 26px;
    line-height: 1;
}

.stock-advice-banner-title {
    font-size: 16px;
    font-weight: 600;
}

.stock-advice-banner-desc {
    font-size: 12px;
    margin-top: 3px;
    opacity: 0.85;
}

.stock-advice-banner.is-买入 {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.stock-advice-banner.is-卖出 {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}

.stock-advice-banner.is-观望 {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}

.stock-advice-markdown {
    font-size: 13.5px;
    line-height: 1.7;
    color: #374151;
    word-break: break-word;
}

.stock-advice-markdown h1,
.stock-advice-markdown h2,
.stock-advice-markdown h3,
.stock-advice-markdown h4 {
    margin: 14px 0 6px;
    font-size: 14.5px;
    font-weight: 600;
    color: #111827;
}

.stock-advice-markdown p {
    margin: 6px 0;
}

.stock-advice-markdown ul,
.stock-advice-markdown ol {
    margin: 6px 0;
    padding-left: 20px;
}

.stock-advice-markdown li {
    margin: 3px 0;
}

.stock-advice-markdown strong,
.stock-advice-markdown b {
    color: #111827;
    font-weight: 600;
}

.stock-advice-stream {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.7;
    margin: 0;
    color: #374151;
}

.stock-advice-streaming-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6366f1;
    margin-top: 8px;
}

.stock-advice-prompt-section {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 8px;
}

.stock-advice-prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 12.5px;
    user-select: none;
}

.stock-advice-prompt-header:hover {
    background: #f1f5f9;
}

.stock-advice-prompt-content {
    padding: 10px 12px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

.stock-advice-prompt-textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 12px;
    line-height: 1.5;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    resize: vertical;
    background: #f9fafb;
    color: #1f2937;
}

.stock-advice-prompt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 11px;
}

.stock-advice-prompt-tip {
    color: #6b7280;
}

.stock-advice-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.stock-advice-disclaimer {
    font-size: 11px;
    color: #9ca3af;
    line-height: 1.4;
    flex: 1;
}

.stock-advice-btn-group {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.stock-advice-tag.is-mini {
    margin-left: 0;
    font-family: inherit;
    font-size: 11.5px;
    padding: 1px 6px;
    cursor: pointer;
    line-height: 1.5;
}

/* 提示词模板编辑器 */
.stock-tpl-panel {
    width: min(900px, 96vw);
}

.stock-tpl-textarea {
    min-height: 320px;
    font-size: 12.5px;
}

.stock-tpl-hint {
    font-size: 11.5px;
    color: #64748b;
    line-height: 1.6;
}

.stock-tpl-hint code {
    font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 11px;
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 4px;
}

.stock-tpl-vars {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.stock-tpl-var {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    font-size: 11.5px;
    border: 1px solid #dbe1ea;
    border-radius: 12px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
}

.stock-tpl-var:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

.stock-tpl-var code {
    font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 11px;
}

.stock-tpl-var-desc {
    font-size: 10.5px;
    color: #94a3b8;
}

/* 条件标志类变量：跟普通取数变量区分开 */
.stock-tpl-var-flag {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

.stock-tpl-var-flag:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
}

.stock-his-main .stock-advice-tag {
    margin-left: 0;
}

.stock-ai-cell {
    text-align: center;
}

.stock-actions .icon-history {
    color: #0f766e;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.stock-actions .icon-history:hover {
    color: #fff;
    background: #0f766e;
    border-color: #0f766e;
}

/* 历史建议弹框 */
.stock-his-panel {
    width: min(860px, 96vw);
}

.stock-his-filter {
    font-size: 12px;
    padding: 3px 6px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    max-width: 160px;
}

.stock-his-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.stock-his-item.is-active {
    border-color: #6366f1;
}

.stock-his-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 9px 12px;
    cursor: pointer;
    background: #fbfcfe;
    font-size: 12.5px;
}

.stock-his-main:hover {
    background: #f5f7fb;
}

.stock-his-main > i {
    margin-left: auto;
    color: #9ca3af;
    font-size: 11px;
}

.stock-his-name {
    font-weight: 600;
    color: #111827;
}

.stock-his-meta {
    color: #6b7280;
}

.stock-his-time {
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
}

.stock-his-detail {
    padding: 12px 14px;
    border-top: 1px solid #eef0f4;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stock-his-block h5 {
    margin: 0 0 6px;
    font-size: 12.5px;
    color: #111827;
}

.stock-his-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.stock-his-table th,
.stock-his-table td {
    border: 1px solid #eceff3;
    padding: 4px 7px;
    text-align: left;
}

.stock-his-table th {
    background: #f8fafc;
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
}

.stock-his-pre {
    margin: 6px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 11.5px;
    line-height: 1.55;
    color: #4b5563;
    background: #f9fafb;
    border: 1px solid #eef0f4;
    border-radius: 6px;
    padding: 8px;
}

.stock-his-line {
    font-size: 12px;
    color: #4b5563;
    margin-top: 6px;
}

.stock-his-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn-xs {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
}

.add-note button {
    margin-top: 10px;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.filters {
    margin-bottom: 20px;
}

.filters input, .filters select {
    padding: 8px;
    margin-right: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.filters button {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.note {
    background: #fff;
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.note-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.note-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 0;
}

.note-meta-left {
    flex: 1;
}

.note-meta-right {
    flex-shrink: 0;
    text-align: right;
}

.note-content {
    margin-bottom: 10px;
    overflow-x: auto;
}

/* Note Content Tables Beautification */
.note-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.6;
    text-align: left;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.note-content table th,
.note-content table td {
    padding: 10px 16px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
}

/* Remove right border on the last column */
.note-content table th:last-child,
.note-content table td:last-child {
    border-right: none;
}

/* Remove bottom border on the last row */
.note-content table tr:last-child td {
    border-bottom: none;
}

/* Header styling */
.note-content table th {
    background-color: #f8fafc;
    color: #334155;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #cbd5e1;
}

/* Alternating zebra stripes */
.note-content table tr:nth-child(even) {
    background-color: #f8fafc;
}

/* Row Hover effect */
.note-content table tr:hover {
    background-color: #f1f5f9;
    transition: background-color 0.15s ease;
}

/* Dark Mode Note Content Tables Styling */
body.dark-mode .note-content table {
    background-color: #1b2230;
    border-color: #2b3242;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

body.dark-mode .note-content table th,
body.dark-mode .note-content table td {
    border-color: #2b3242;
}

body.dark-mode .note-content table th {
    background-color: #151b27;
    color: #cbd5e0;
    border-bottom-color: #3a4759;
}

body.dark-mode .note-content table tr:nth-child(even) {
    background-color: #1f2838;
}

body.dark-mode .note-content table tr:hover {
    background-color: #273245;
}

.note-tags {
    margin-bottom: 0;
    display: inline-block;
}

.note-tags-edit input[type="text"] {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 220px;
}

.note-tags-edit {
    position: relative;
    display: flex;
    align-items: center;
}

.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.tag {
    display: inline-block;
    background: #e9ecef;
    padding: 2px 8px;
    margin-right: 5px;
    border-radius: 12px;
    font-size: 0.8em;
}
.note-tags .tag {
    cursor: pointer;
}
.note-tags .tag:hover {
    background: #dfe3e7;
}
.note-tags .tag.active {
    background: #cfd8e3;
    border: 1px solid #b9c6d4;
}

.note-actions {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    float: right;
}

.note-date {
    font-size: 0.8em;
    color: #888;
    margin-right: 5px;
}

.note-actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.note-actions button:first-child {
    background: transparent;
    color: #007bff;
    border: none;
}

.note-actions button:last-child {
    background: transparent;
    color: #dc3545;
    border: none;
}

.note-actions form {
    display: inline-block;
    margin: 0;
}

.pagination {
    text-align: center;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 100%;
}

.page-link {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 2px;
    border: 1px solid #ddd;
    background: #fff;
    color: #007bff;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.page-link:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.page-link.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.page-ellipsis {
    color: #666;
    padding: 0 8px;
    font-style: italic;
}

.page-jump {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
    flex-shrink: 0;
}

.page-jump-date {
    margin-left: 0;
}

.page-input {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 60px;
    text-align: center;
}

.page-date-input {
    width: 150px;
}

.page-jump-btn {
    padding: 6px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.page-jump-btn:hover {
    background: #218838;
}

.page-jump-hint {
    color: #666;
    font-size: 13px;
    white-space: nowrap;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: black;
}

#edit-content {
    width: 100%;
    height: 400px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: monospace;
    font-size: 14px;
}

#edit-tags {
    width: 100%;
    padding: 10px;
    margin-top: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#edit-form button {
    margin-top: 15px;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#edit-form button:hover {
    background: #0056b3;
}

.add-note button {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.add-note button:hover {
    background: #218838;
}

#add-content {
    width: 100%;
    height: 400px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: monospace;
    font-size: 14px;
}

#add-tags {
    width: 100%;
    padding: 10px;
    margin-top: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#add-form button {
    margin-top: 15px;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#add-form button:hover {
    background: #0056b3;
}

.search-and-add {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-and-add input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.search-and-add button {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.search-and-add button:hover {
    background: #218838;
}

.edit-footer {
    display: flex;
    gap: 10px;
    align-items: center;
}

.edit-footer input {
    flex: 1;
}

.add-footer {
    display: flex;
    gap: 10px;
    align-items: center;
}

.add-footer input {
    flex: 1;
}

.tags-cloud h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-cloud {
    display: inline-flex;
    align-items: center;
    background: #fff;
    color: #333;
    padding: 4px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid #ddd;
}

.tag-cloud:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.tag-cloud.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.tag-cloud-count {
    font-size: 0.8em;
    opacity: 0.8;
    margin-left: 6px;
    background: #e9ecef;
    color: #555;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 400;
}

.tag-cloud.active .tag-cloud-count {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Pygments syntax highlighting */
.codehilite { background: #f8f8f8; border: 1px solid #ddd; border-radius: 4px; padding: 10px; }
.codehilite .c { color: #408080; font-style: italic } /* Comment */
.codehilite .err { border: 1px solid #FF0000 } /* Error */
.codehilite .k { color: #008000; font-weight: bold } /* Keyword */
.codehilite .o { color: #666666 } /* Operator */
.codehilite .ch { color: #408080; font-style: italic } /* Comment.Hashbang */
.codehilite .cm { color: #408080; font-style: italic } /* Comment.Multiline */
.codehilite .cp { color: #BC7A00 } /* Comment.Preproc */
.codehilite .cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */
.codehilite .c1 { color: #408080; font-style: italic } /* Comment.Single */
.codehilite .cs { color: #408080; font-style: italic } /* Comment.Special */
.codehilite .gd { color: #A00000 } /* Generic.Deleted */
.codehilite .ge { font-style: italic } /* Generic.Emph */
.codehilite .gr { color: #FF0000 } /* Generic.Error */
.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.codehilite .gi { color: #00A000 } /* Generic.Inserted */
.codehilite .go { color: #888888 } /* Generic.Output */
.codehilite .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
.codehilite .gs { font-weight: bold } /* Generic.Strong */
.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.codehilite .gt { color: #0044DD } /* Generic.Traceback */
.codehilite .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
.codehilite .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
.codehilite .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
.codehilite .kp { color: #008000; font-weight: bold } /* Keyword.Pseudo */
.codehilite .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
.codehilite .kt { color: #B00040 } /* Keyword.Type */
.codehilite .m { color: #666666 } /* Literal.Number */
.codehilite .s { color: #BA2121 } /* Literal.String */
.codehilite .na { color: #7D9029 } /* Name.Attribute */
.codehilite .nb { color: #008000 } /* Name.Builtin */
.codehilite .nc { color: #0000FF; font-weight: bold } /* Name.Class */
.codehilite .no { color: #880000 } /* Name.Constant */
.codehilite .nd { color: #AA22FF } /* Name.Decorator */
.codehilite .ni { color: #999999; font-weight: bold } /* Name.Entity */
.codehilite .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
.codehilite .nf { color: #0000FF } /* Name.Function */
.codehilite .nl { color: #A0A000 } /* Name.Label */
.codehilite .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
.codehilite .nt { color: #008000; font-weight: bold } /* Name.Tag */
.codehilite .nv { color: #19177C } /* Name.Variable */
.codehilite .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
.codehilite .w { color: #bbbbbb } /* Text.Whitespace */
.codehilite .mb { color: #666666 } /* Literal.Number.Bin */
.codehilite .mf { color: #666666 } /* Literal.Number.Float */
.codehilite .mh { color: #666666 } /* Literal.Number.Hex */
.codehilite .mi { color: #666666 } /* Literal.Number.Integer */
.codehilite .mo { color: #666666 } /* Literal.Number.Oct */
.codehilite .sa { color: #BA2121 } /* Literal.String.Affix */
.codehilite .sb { color: #BA2121 } /* Literal.String.Backtick */
.codehilite .sc { color: #BA2121 } /* Literal.String.Char */
.codehilite .dl { color: #BA2121 } /* Literal.String.Delimiter */
.codehilite .sd { color: #BA2121 } /* Literal.String.Doc */
.codehilite .s2 { color: #BA2121 } /* Literal.String.Double */
.codehilite .se { color: #BA2121 } /* Literal.String.Escape */
.codehilite .sh { color: #BA2121 } /* Literal.String.Heredoc */
.codehilite .si { color: #BA2121 } /* Literal.String.Interpol */
.codehilite .sx { color: #BA2121 } /* Literal.String.Other */
.codehilite .sr { color: #BA2121 } /* Literal.String.Regex */
.codehilite .s1 { color: #BA2121 } /* Literal.String.Single */
.codehilite .ss { color: #BA2121 } /* Literal.String.Symbol */
.codehilite .bp { color: #008000 } /* Name.Builtin.Pseudo */
.codehilite .fm { color: #0000FF } /* Name.Function.Magic */
.codehilite .vc { color: #19177C } /* Name.Variable.Class */
.codehilite .vg { color: #19177C } /* Name.Variable.Global */
.codehilite .vi { color: #19177C } /* Name.Variable.Instance */
.codehilite .vm { color: #19177C } /* Name.Variable.Magic */
.codehilite .il { color: #666666 } /* Literal.Number.Integer.Long */

/* Tasks styles */
.tasks-container {
    width: 100%;
    margin: 0;
}

.tasks-layout {
    display: flex;
    gap: 15px;
    min-width: 0;
}

.tasks-main {
    flex: 2 1 auto;
    min-width: 0;
}

.tasks-sidebar {
    flex: 0 0 300px; /* Fixed width of 300px, don't grow or shrink */
    background: #f8f8f8;
    padding: 15px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 300px;
}

.search-section {
    margin-bottom: 8px;
}

.search-section input {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.other-filters {
    display: flex;
    gap: 8px;
    align-items: center;
}

.add-task-form form {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.add-task-form input[name="content"] {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex: 3;
    min-width: 300px;
    font-size: 0.9em;
}

.add-task-form input[name="tags"] {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex: 1;
    min-width: 120px;
    font-size: 0.9em;
}

.add-task-form select {
    padding: 3px 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex: 0 0 60px;
    font-size: 0.85em;
}

.add-task-form textarea {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    height: 40px;
    flex: 2;
    min-width: 150px;
    font-size: 0.9em;
}

.add-task-form button {
    padding: 5px 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}



.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    background: #f8f8f8;
    padding: 10px;
    border-radius: 6px;
}

.filters {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filters button {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.add-task button {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.add-task button:hover {
    background: #218838;
}

.filters input, .filters select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.filters button {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 5px;
}

.task-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.task-content {
    flex: 1;
    font-weight: bold;
    font-size: 0.95em;
}

.task-meta {
    display: flex;
    gap: 4px;
    align-items: center;
}





.task-notes {
    margin-bottom: 6px;
    font-size: 0.9em;
    color: #444;
    line-height: 1.6;
    padding: 8px 10px;
    border: 1px solid #eee;
    border-radius: 6px;
    background: #f8f9fa;
}

.task-notes p {
    margin: 0 0 8px 0;
}

.task-notes p:last-child {
    margin-bottom: 0;
}

.task-notes ul,
.task-notes ol {
    margin: 6px 0 8px 20px;
}

.task-notes pre {
    margin: 8px 0;
    overflow-x: auto;
}

.task-notes blockquote {
    margin: 8px 0;
    padding-left: 10px;
    border-left: 3px solid #ced4da;
    color: #5f6368;
}

.task-notes table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
}

.task-notes table th,
.task-notes table td {
    border: 1px solid #d9dee3;
    padding: 4px 8px;
    text-align: left;
}

.task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-right: 8px;
}

.task-tags-edit {
    position: relative;
    margin-right: 8px;
}

.task-meta .tag {
    font-size: 0.75em;
    padding: 1px 5px;
    background: #e9ecef;
    border-radius: 10px;
    white-space: nowrap;
}



.task-meta select {
    padding: 2px 3px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.75em;
}

.task-meta button {
    padding: 3px 6px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    color: #dc3545;
    font-size: 0.75em;
}

.task-meta button i {
    font-size: 0.9em;
}

.task-meta form button {
    background: #dc3545;
    color: white;
}

.subtasks {
    margin-top: 8px;
}

.subtask {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.subtask input[type="checkbox"] {
    margin: 0;
    transform: scale(0.9);
}

#add-content, #edit-content {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

#add-tags, #edit-tags {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

#add-notes, #edit-notes {
    width: 100%;
    height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    margin-bottom: 10px;
}

#add-form select, #edit-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 20px;
}

.login-container input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.login-container button {
    width: 100%;
    padding: 10px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.login-container button:hover {
    background: #0056b3;
}

.note-content img {
    max-width: 200px;
    max-height: 200px;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 5px;
}

.note-content audio {
    display: block;
    width: 100%;
    max-width: 420px;
    margin: 6px 0;
}

#image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
}

#image-modal-content {
    max-width: 90%;
    max-height: 90%;
}

/* Responsive design for wide screens */
@media (min-width: 1920px) {
    .notes-layout {
        gap: 30px;
    }

    .notes-main {
        flex: 1 1 800px; /* Allow main area to grow up to 800px on wide screens */
    }

    .notes-sidebar {
        flex: 0 0 320px; /* Slightly wider sidebar on large screens */
    }

    .tasks-layout {
        gap: 30px;
    }

    .tasks-main {
        flex: 2 1 1000px; /* Allow main area to grow up to 1000px on wide screens */
    }

    .tasks-sidebar {
        flex: 1 0 320px; /* Slightly wider sidebar on large screens */
    }
}

@media (min-width: 2560px) {
    .notes-main {
        flex: 1 1 1000px; /* Allow main area to grow up to 1000px on very wide screens */
    }

    .notes-sidebar {
        flex: 0 0 350px; /* Even wider sidebar on ultra-wide screens */
    }

    .tasks-main {
        flex: 2 1 1200px; /* Allow main area to grow up to 1200px on very wide screens */
    }

    .tasks-sidebar {
        flex: 1 0 350px; /* Even wider sidebar on ultra-wide screens */
    }
}
.calendar-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.calendar-nav a {
    margin-left: 10px;
    padding: 5px 10px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
}

.calendar-nav a:hover {
    background: #0056b3;
}

/* Month View Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.week-header {
    display: contents;
}

.day-header {
    background: #f8f9fa;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    color: #333;
}

.week-row {
    display: contents;
}

.day {
    background: white;
    padding: 10px;
    min-height: 80px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.day:hover {
    background: #f0f8ff;
}

.day.current-month {
    background: white;
}

.day.current-month:hover {
    background: #e3f2fd;
}

.day:not(.current-month) {
    background: #f8f9fa;
    color: #999;
}

.day.today {
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.day-number {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.day-stats {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.stat-badge {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
    color: white;
    background: #007bff;
}

.stat-badge.task-count {
    background: #28a745;
}

.stat-badge.note-count {
    background: #6f42c1;
}

.stat-badge.schedule-count {
    background: #e67e22;
}

/* Week View Styles */
.week-view {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.day-column {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
}

.day-header {
    text-align: center;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.day-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.week-view .day-number {
    font-size: 18px;
    font-weight: bold;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: #333;
    display: inline-block;
    min-width: auto;
    text-align: center;
}

.week-view .day-number.today {
    background: transparent;
    color: #333;
    font-weight: bold;
}

.day-content {
    flex: 1;
}

.completed-tasks, .notes-list, .schedules-list {
    margin: 10px 0;
}

.completed-tasks h4, .notes-list h4, .schedules-list h4 {
    margin: 0 0 5px 0;
    color: #007bff;
}

.completed-tasks ul, .notes-list ul, .schedules-list ul {
    padding-left: 20px;
    margin: 5px 0;
}

.completed-tasks li, .notes-list li, .schedules-list li {
    margin-bottom: 3px;
}

.no-data {
    text-align: center;
    color: #999;
    font-style: italic;
    margin-top: 20px;
}

/* Calendar Simple Theme */
.calendar-theme {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    color: #333;
}

.calendar-theme .calendar-header {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    color: #333;
}

.calendar-theme .calendar-nav a {
    background: #007bff;
    color: #fff;
    font-weight: 500;
    border: 1px solid #007bff;
    box-shadow: none;
}

.calendar-theme .calendar-nav a:hover {
    background: #0056b3;
    color: #fff;
}

.calendar-theme .calendar-grid {
    background: #e5e7eb;
    border: 1px solid #e5e7eb;
    box-shadow: none;
}

.calendar-theme .day-header {
    background: #f8f9fa;
    color: #333;
    border-bottom: 1px solid #e5e7eb;
}

.calendar-theme .day {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.calendar-theme .day:hover {
    background: #f8f9ff;
    border-color: #cfe2ff;
}

.calendar-theme .day.current-month {
    color: #333;
}

.calendar-theme .day:not(.current-month) {
    background: #f8f9fa;
    color: #999;
}

.calendar-theme .day.today {
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.calendar-theme .day-number {
    color: #333;
}

.calendar-theme .stat-badge {
    background: #007bff;
    color: #fff;
    border: none;
}

.calendar-theme .stat-badge.task-count {
    background: #28a745;
    color: #fff;
}

.calendar-theme .stat-badge.note-count {
    background: #6f42c1;
    color: #fff;
}

.calendar-theme .stat-badge.schedule-count {
    background: #e67e22;
    color: #fff;
}

.calendar-theme .week-view {
    gap: 12px;
}

.calendar-theme .day-column {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: none;
}

.calendar-theme .day-header {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    color: #333;
}


.calendar-theme .completed-tasks h4,
.calendar-theme .notes-list h4,
.calendar-theme .schedules-list h4 {
    color: #007bff;
}

.calendar-theme .no-data {
    color: #999;
}

/* Calendar modal */
.calendar-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.calendar-modal-content {
    width: min(920px, 92vw);
    max-height: 85vh;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    color: #333;
}

.calendar-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px 12px;
    border-bottom: 1px solid #e5e7eb;
}

.calendar-modal-title {
    font-size: 16px;
    font-weight: 600;
}

.calendar-modal-subtitle {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.calendar-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #dbe4f3;
    background: #f1f5fb;
    color: #374151;
}

.calendar-pill.task {
    border-color: #cfe9d6;
    background: #e8f6ed;
    color: #1f7a3a;
}

.calendar-pill.note {
    border-color: #e5d6f6;
    background: #f3ecfd;
    color: #5a2ea6;
}

.calendar-pill.schedule {
    border-color: #f3d2b2;
    background: #fff2e6;
    color: #b85d12;
}

.calendar-modal-close {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #666;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-modal-close:hover {
    color: #333;
    border-color: #cbd5e1;
}

.calendar-modal-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 14px 22px 22px;
}

.calendar-modal-section {
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.calendar-section-header {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.calendar-modal-section-wide {
    grid-column: 1 / -1;
    min-height: auto;
}

.calendar-inline-form {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.calendar-text-input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #333;
}

.calendar-text-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.calendar-submit-btn {
    flex-shrink: 0;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: #e67e22;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

.calendar-submit-btn:hover {
    background: #cf711d;
}

.calendar-submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.calendar-form-error {
    color: #c0392b;
    font-size: 13px;
    margin-bottom: 10px;
}

.calendar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 45vh;
}

.calendar-list li {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #eef1f5;
}

.calendar-list-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #007bff;
}

.calendar-list-dot.task {
    background: #28a745;
}

.calendar-list-dot.note {
    background: #6f42c1;
}

.calendar-list-dot.schedule {
    background: #e67e22;
}

.calendar-list-text {
    flex: 1;
    color: #333;
}

.calendar-list-input {
    flex: 1;
    min-width: 140px;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: #333;
}

.calendar-list-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.calendar-list-meta {
    font-size: 12px;
    color: #666;
}

.calendar-edit-btn,
.calendar-cancel-btn,
.calendar-delete-btn {
    flex-shrink: 0;
    padding: 5px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
}

.calendar-edit-btn {
    border: 1px solid #b6cef5;
    background: #eef4ff;
    color: #2f66d0;
}

.calendar-edit-btn:hover {
    background: #e3edff;
}

.calendar-cancel-btn {
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #4b5563;
}

.calendar-cancel-btn:hover {
    background: #f3f4f6;
}

.calendar-delete-btn {
    border: 1px solid #f1b3ad;
    background: #fff5f5;
    color: #c0392b;
}

.calendar-delete-btn:hover {
    background: #fdeaea;
}

.calendar-edit-btn:disabled,
.calendar-cancel-btn:disabled,
.calendar-delete-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.calendar-empty {
    color: #999;
    text-align: center;
    padding: 20px 0;
}

.calendar-day-preview {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-day-preview-item,
.calendar-day-preview-more {
    font-size: 12px;
    line-height: 1.3;
    padding: 3px 6px;
    border-radius: 6px;
    background: #fff2e6;
    color: #b85d12;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.calendar-day-preview-more {
    background: #f5f5f5;
    color: #666;
}

.calendar-clickable {
    cursor: pointer;
}

@media (max-width: 900px) {
    .calendar-modal-body {
        grid-template-columns: 1fr;
    }

    .calendar-inline-form {
        flex-direction: column;
    }

    .calendar-submit-btn {
        width: 100%;
    }
}

/* Add to bottom of CSS file */
.drag-drop-area {
    position: relative;
    border: 2px dashed #ddd;
    border-radius: 4px;
    padding: 10px;
    transition: all 0.3s ease;
}

.drag-drop-area.drag-over {
    border-color: #007bff;
    background-color: #f8f9ff;
}

.drag-drop-area textarea {
    border: none;
    outline: none;
    width: 100%;
    resize: vertical;
}

.drag-drop-area:hover {
    border-color: #007bff;
}

/* Dark mode */
body.dark-mode {
    background: #0f1115;
    color: #e6e6e6;
}

body.dark-mode main {
    color: inherit;
}

body.dark-mode a {
    color: inherit;
}

body.dark-mode .notes-container,
body.dark-mode .tasks-container,
body.dark-mode .stock-container,
body.dark-mode .calendar-container,
body.dark-mode .home-container,
body.dark-mode .bookmarks-container,
body.dark-mode .dict-container {
    background: #141922;
}

body.dark-mode .note,
body.dark-mode .task,
body.dark-mode .stock-header,
body.dark-mode .stock-list,
body.dark-mode .top-bar,
body.dark-mode .tags-cloud,
body.dark-mode .pagination,
body.dark-mode .calendar-theme,
body.dark-mode .calendar-theme .calendar-header,
body.dark-mode .calendar-theme .calendar-grid,
body.dark-mode .calendar-theme .day,
body.dark-mode .calendar-theme .day-header,
body.dark-mode .calendar-theme .week-view,
body.dark-mode .calendar-theme .day-column,
body.dark-mode .bookmark-item,
body.dark-mode .bookmarks-list,
body.dark-mode .add-bookmark-form,
body.dark-mode .add-task-form,
body.dark-mode .add-note-form,
body.dark-mode .note-meta,
body.dark-mode .task-notes {
    background: #1b2230;
    border-color: #2b3242;
    color: #e6e6e6;
}

body.dark-mode .calendar-modal-content,
body.dark-mode .calendar-modal-section,
body.dark-mode .calendar-list li,
body.dark-mode .calendar-list-input,
body.dark-mode .calendar-text-input,
body.dark-mode .calendar-edit-btn,
body.dark-mode .calendar-cancel-btn,
body.dark-mode .calendar-modal-close,
body.dark-mode .calendar-delete-btn {
    background: #1b2230;
    border-color: #2b3242;
    color: #e6e6e6;
}

body.dark-mode .calendar-pill,
body.dark-mode .calendar-day-preview-more {
    background: #253044;
    border-color: #364152;
    color: #e6e6e6;
}

body.dark-mode .calendar-day-preview-item {
    background: rgba(230, 126, 34, 0.18);
    color: #f6c796;
}

body.dark-mode .calendar-list-meta,
body.dark-mode .calendar-empty {
    color: #9aa4b2;
}

body.dark-mode .stock-table th,
body.dark-mode .stock-table td,
body.dark-mode .tasks-table th,
body.dark-mode .tasks-table td {
    border-color: #2b3242;
}

body.dark-mode .stock-actions .icon-edit {
    color: #7ab0ff;
    background: #1c2536;
    border-color: #2c3d59;
}

body.dark-mode .stock-actions .icon-edit:hover {
    color: #fff;
    background: #0d6efd;
    border-color: #0d6efd;
}

body.dark-mode .stock-modal-panel {
    background: #1b2230;
    border-color: #2b3242;
    color: #e6e6e6;
}

body.dark-mode .stock-modal-header,
body.dark-mode .stock-modal-actions {
    border-color: #2b3242;
}

body.dark-mode .stock-modal-subtitle,
body.dark-mode .stock-field {
    color: #9aa4b2;
}

body.dark-mode .stock-field input {
    background: #151b27;
    border-color: #2b3242;
    color: #e6e6e6;
}

body.dark-mode .stock-modal-preview {
    background: #151b27;
    border-color: #2b3242;
}

body.dark-mode .stock-modal-close {
    background: #151b27;
    border-color: #2b3242;
    color: #9aa4b2;
}

body.dark-mode .stock-muted {
    color: #6b7482;
}

body.dark-mode .stock-indices-total {
    background: #1a202a;
    border-color: #2c3644;
}

body.dark-mode .stock-indices-total-label {
    color: #c8d0dc;
}

body.dark-mode .stock-indices-total-item {
    color: #aab4c2;
}

body.dark-mode .stock-indices-total-hint {
    color: #5f6b7c;
}

body.dark-mode .stock-index {
    background: #1e2530;
    border-color: #2c3644;
    border-left-color: #3d4a5c;
}

body.dark-mode .stock-index-name {
    color: #8a94a6;
}

body.dark-mode .stock-index.is-up {
    border-left-color: #ef7b80;
}

body.dark-mode .stock-index.is-down {
    border-left-color: #4fbf72;
}

body.dark-mode .stock-index.is-up .stock-index-value,
body.dark-mode .stock-index.is-up .stock-index-change {
    color: #ef7b80;
}

body.dark-mode .stock-index.is-down .stock-index-value,
body.dark-mode .stock-index.is-down .stock-index-change {
    color: #4fbf72;
}

@media (max-width: 900px) {
    .stock-indices {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .stock-indices {
        grid-template-columns: repeat(2, 1fr);
    }
}

body.dark-mode .stock-market-status {
    color: #7f8a9c;
}

body.dark-mode .stock-market-status.is-open {
    color: #ef7b80;
}

body.dark-mode .stock-market-dot,
body.dark-mode .stock-market-status.is-closed .stock-market-dot {
    background: #4a5568;
}

body.dark-mode .stock-actions .icon {
    background: #232a38;
    border-color: #2b3242;
    color: #c3cbd8;
}

body.dark-mode .stock-actions .icon-unfollow {
    color: #ef7b80;
    background: #2a1f24;
    border-color: #4a2b30;
}

body.dark-mode .stock-actions .icon-unfollow:hover {
    color: #fff;
    background: #dc3545;
    border-color: #dc3545;
}

body.dark-mode .stock-actions .icon-advice {
    color: #a5b4fc;
    background: #1e2140;
    border-color: #3b3f6e;
}

body.dark-mode .stock-actions .icon-advice:hover {
    color: #fff;
    background: #4f46e5;
    border-color: #4f46e5;
}

body.dark-mode .advice-model-badge {
    background: #1b2230;
    border-color: #2b3242;
    color: #9aa4b2;
}

body.dark-mode .stock-advice-markdown,
body.dark-mode .stock-advice-stream {
    color: #c9d1dc;
}

body.dark-mode .stock-advice-markdown h1,
body.dark-mode .stock-advice-markdown h2,
body.dark-mode .stock-advice-markdown h3,
body.dark-mode .stock-advice-markdown h4,
body.dark-mode .stock-advice-markdown strong,
body.dark-mode .stock-advice-markdown b {
    color: #f0f3f7;
}

body.dark-mode .stock-advice-prompt-section,
body.dark-mode .stock-advice-prompt-content {
    border-color: #2b3242;
}

body.dark-mode .stock-advice-prompt-header {
    background: #161d2a;
    color: #9aa4b2;
}

body.dark-mode .stock-advice-prompt-header:hover {
    background: #1b2230;
}

body.dark-mode .stock-advice-prompt-content {
    background: #151b27;
}

body.dark-mode .stock-advice-prompt-textarea {
    background: #10151f;
    border-color: #2b3242;
    color: #d5dbe4;
}

body.dark-mode .stock-advice-loading-text {
    color: #b6c0cd;
}

body.dark-mode .stock-advice-error {
    background: #2a1a1d;
    border-color: #5b2a30;
    color: #f0a7ad;
}

body.dark-mode .stock-advice-banner.is-买入 {
    background: #2a1a1d;
    border-color: #5b2a30;
    color: #f0a7ad;
}

body.dark-mode .stock-advice-banner.is-卖出 {
    background: #16281d;
    border-color: #2c5138;
    color: #93d8a8;
}

body.dark-mode .stock-advice-banner.is-观望 {
    background: #262019;
    border-color: #574526;
    color: #e6c37a;
}

body.dark-mode .stock-actions .icon-history {
    color: #5eead4;
    background: #10231f;
    border-color: #234b43;
}

body.dark-mode .stock-actions .icon-history:hover {
    color: #042f2a;
    background: #5eead4;
    border-color: #5eead4;
}

body.dark-mode .stock-tpl-var {
    background: #1b2230;
    border-color: #2b3242;
    color: #c3cbd8;
}

body.dark-mode .stock-tpl-var:hover {
    background: #232a4a;
    border-color: #45407a;
    color: #c7d2fe;
}

body.dark-mode .stock-tpl-var-desc {
    color: #6b7482;
}

body.dark-mode .stock-tpl-hint {
    color: #8b95a5;
}

body.dark-mode .stock-tpl-hint code {
    background: #1b2230;
    color: #b8c2cf;
}

body.dark-mode .stock-tpl-var-flag {
    background: #232a4a;
    border-color: #45407a;
    color: #c7d2fe;
}

body.dark-mode .stock-his-filter {
    background: #151b27;
    border-color: #2b3242;
    color: #d5dbe4;
}

body.dark-mode .stock-his-item {
    border-color: #2b3242;
}

body.dark-mode .stock-his-item.is-active {
    border-color: #6366f1;
}

body.dark-mode .stock-his-main,
body.dark-mode .stock-his-main:hover {
    background: #161d2a;
}

body.dark-mode .stock-his-name {
    color: #f0f3f7;
}

body.dark-mode .stock-his-detail {
    border-top-color: #2b3242;
}

body.dark-mode .stock-his-table th,
body.dark-mode .stock-his-table td {
    border-color: #2b3242;
}

body.dark-mode .stock-his-table th {
    background: #1b2230;
    color: #9aa4b2;
}

body.dark-mode .stock-his-pre {
    background: #10151f;
    border-color: #2b3242;
    color: #b8c2cf;
}

body.dark-mode .stock-his-line,
body.dark-mode .stock-his-meta {
    color: #9aa4b2;
}

body.dark-mode .tag-suggestions,
body.dark-mode .tag-suggestion,
body.dark-mode .stock-search-results,
body.dark-mode .stock-search-item {
    background: #1b2230;
    border-color: #2b3242;
    color: #e6e6e6;
}

body.dark-mode .tag-suggestion:hover {
    background: #253044;
}

body.dark-mode .task-notes blockquote {
    border-left-color: #4b5568;
    color: #c6cdd8;
}

body.dark-mode .task-notes table th,
body.dark-mode .task-notes table td {
    border-color: #3a4358;
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
    background: #151b27;
    color: #e6e6e6;
    border-color: #2b3242;
}

body.dark-mode .filters input,
body.dark-mode .filters select,
body.dark-mode .search-section input,
body.dark-mode .page-input {
    background: #151b27;
    color: #e6e6e6;
    border-color: #2b3242;
}

body.dark-mode .page-link {
    color: #e6e6e6;
    border-color: #2b3242;
}

body.dark-mode .note {
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

body.dark-mode .links-group {
    background: #1b2230;
    border: 1px solid #2b3242;
}

body.dark-mode .links-group.is-drag-over {
    outline-color: #4ea1ff;
    background: #223047;
}

body.dark-mode .links-group-header {
    color: #e6e6e6;
}

body.dark-mode .links-group-title i {
    color: #8c97ab;
}

body.dark-mode .links-group-count {
    color: #b0b6c4;
}

body.dark-mode .group-add-btn {
    color: #8c97ab;
}

body.dark-mode .group-add-btn:hover {
    background: #2b3242;
    color: #4ea1ff;
}

/* Dark mode for Home Modal */
body.dark-mode .home-modal-card {
    background: #1b2230;
    border-color: #2b3242;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

body.dark-mode .home-modal-header {
    background: #151b27;
    border-bottom-color: #2b3242;
}

body.dark-mode .home-modal-header h3 {
    color: #e6e6e6;
}

body.dark-mode .home-modal-header h3 i {
    color: #4ea1ff;
}

body.dark-mode .home-modal-group-badge {
    background: #1e3a5f;
    color: #7dd3fc;
}

body.dark-mode .home-modal-close {
    color: #8c97ab;
}

body.dark-mode .home-modal-close:hover {
    color: #ffffff;
}

body.dark-mode .home-form-group label {
    color: #b0b6c4;
}

body.dark-mode .home-form-group input {
    background: #151b27;
    border-color: #2b3242;
    color: #e6e6e6;
}

body.dark-mode .home-form-group input:focus {
    border-color: #4ea1ff;
    box-shadow: 0 0 0 3px rgba(78, 161, 255, 0.2);
}

body.dark-mode .home-modal-actions .btn-cancel {
    background: #151b27;
    border-color: #2b3242;
    color: #b0b6c4;
}

body.dark-mode .home-modal-actions .btn-cancel:hover {
    background: #20293a;
    color: #ffffff;
}

body.dark-mode .home-modal-actions .btn-submit {
    background: #007bff;
    color: #ffffff;
}

body.dark-mode .home-modal-actions .btn-submit:hover {
    background: #0069d9;
}

body.dark-mode .link-item {
    background: #151b27;
    border-color: #2b3242;
    color: #e6e6e6;
}

body.dark-mode .link-item.is-drag-over {
    border-color: #4ea1ff;
    background: #1d2b3f;
}

body.dark-mode .link-title {
    color: #8cc0ff;
}

body.dark-mode .link-url {
    color: #a1a9b6;
}

body.dark-mode .link-action-btn {
    color: #a1a9b6;
}

body.dark-mode .link-action-btn:hover {
    color: #8cc0ff;
}

body.dark-mode .link-main input[type="text"],
body.dark-mode .link-note-input {
    background: #151b27;
    border-color: #2b3242;
    color: #e6e6e6;
}

body.dark-mode .tasks-sidebar {
    background: #1b2230;
    border: 1px solid #2b3242;
    color: #e6e6e6;
}

body.dark-mode .tags-cloud h3 {
    color: #e6e6e6;
}

body.dark-mode .tag-cloud {
    background: #151b27;
    color: #d7dbe3;
    border-color: #2b3242;
    box-shadow: none;
}

body.dark-mode .tag-cloud:hover {
    background: #1d2636;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

body.dark-mode .tag-cloud.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

body.dark-mode .tag-cloud-count {
    background: #253044;
    color: #c0c6d4;
}

body.dark-mode .tag-cloud.active .tag-cloud-count {
    background: rgba(255,255,255,0.2);
    color: white;
}

body.dark-mode .notes-sidebar {
    background: #1b2230;
    border: 1px solid #2b3242;
    color: #e6e6e6;
}

body.dark-mode .note-tags .tag,
body.dark-mode .task-tags .tag,
body.dark-mode .task-meta .tag {
    background: #253044;
    color: #d7dbe3;
    border: 1px solid #2b3242;
}

body.dark-mode .note-tags .tag:hover,
body.dark-mode .task-tags .tag:hover {
    background: #2c3a52;
}

body.dark-mode .note-tags .tag.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

/* Mindmap */
.mindmap-page {
    padding: 20px;
}

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

.mindmap-title {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mindmap-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    cursor: pointer;
}

.mindmap-actions button {
    margin-left: 8px;
}

.mindmap-theme {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}

.mindmap-theme select {
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 12px;
    background: #fff;
}

.mindmap-save-status {
    font-size: 12px;
    color: #888;
    margin-right: 8px;
}

.mindmap-save-status.saved {
    color: #16a34a;
}

.mindmap-save-status.error {
    color: #dc2626;
}

.mindmap-toast-container {
    position: fixed;
    top: 16px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1200;
    pointer-events: none;
}

.mindmap-toast {
    min-width: 180px;
    max-width: 320px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
    font-size: 13px;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.mindmap-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.mindmap-toast.success {
    background: rgba(22, 163, 74, 0.94);
}

.mindmap-toast.error {
    background: rgba(220, 38, 38, 0.94);
}

.mindmap-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.mindmap-filters input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.mindmap-list {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 12px;
}

.mindmap-tags-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.mindmap-tag-chip {
    border: 1px solid #e5e5e5;
    background: #f8fafc;
    color: #333;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}

.mindmap-tag-chip:hover {
    background: #eef2f7;
}

.mindmap-empty {
    color: #777;
}

.mindmap-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mindmap-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 10px 12px;
    gap: 12px;
}

.mindmap-item-title {
    font-weight: 600;
    color: #222;
    text-decoration: none;
}

.mindmap-item-title:hover {
    text-decoration: underline;
}

.mindmap-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    color: #666;
    font-size: 12px;
}

.mindmap-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mindmap-edit-btn {
    border: 1px solid #e5e5e5;
    background: #f8fafc;
    color: #334155;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.mindmap-edit-btn:hover {
    background: #eef2f7;
}

.mindmap-delete-btn {
    border: 1px solid #e5e5e5;
    background: #fff0f0;
    color: #b91c1c;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.mindmap-delete-btn:hover {
    background: #fee2e2;
}

.mindmap-item-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mindmap-tag {
    background: #f3f4f6;
    color: #333;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.mindmap-tags.empty {
    color: #999;
}

.mindmap-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.mindmap-canvas {
    width: 100%;
    height: calc(100vh - 240px);
    min-height: 420px;
    border: 1px solid #e5e5e5;
    background: #fff;
    border-radius: 6px;
    cursor: grab;
}

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

.mindmap-canvas.mindmap-panning {
    cursor: grabbing;
}

.mindmap-canvas .jsmind-inner {
    overflow: hidden !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.mindmap-canvas .jmnode-overflow-wrap jmnode {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.mindmap-canvas .jsmind-inner::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.mindmap-canvas jmnode.mindmap-drag-source {
    opacity: 0.6;
}

.mindmap-canvas jmnode.mindmap-drop-target {
    outline: 2px dashed #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

body.dark-mode .mindmap-canvas {
    border-color: #2b3242;
    background: #1b2230;
}

body.dark-mode .mindmap-canvas jmnode.mindmap-drop-target {
    outline-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35);
}

body.dark-mode .mindmap-filters input {
    border-color: #2b3242;
    background: #1b2230;
    color: #e6e6e6;
}

body.dark-mode .mindmap-list {
    background: #1b2230;
    border-color: #2b3242;
}

body.dark-mode .mindmap-item {
    border-color: #2b3242;
}

body.dark-mode .mindmap-item-title {
    color: #e6e6e6;
}

body.dark-mode .mindmap-tag {
    background: #253044;
    color: #d7dbe3;
}

body.dark-mode .mindmap-tag-chip {
    border-color: #2b3242;
    background: #1b2230;
    color: #d7dbe3;
}

body.dark-mode .mindmap-tag-chip:hover {
    background: #253044;
}

body.dark-mode .mindmap-save-status {
    color: #9aa4b2;
}

body.dark-mode .mindmap-theme {
    color: #9aa4b2;
}

body.dark-mode .mindmap-theme select {
    border-color: #2b3242;
    background: #1b2230;
    color: #e6e6e6;
}

body.dark-mode .mindmap-toast {
    background: rgba(15, 23, 42, 0.96);
    color: #e5e7eb;
}

body.dark-mode .mindmap-toast.success {
    background: rgba(22, 163, 74, 0.95);
}

body.dark-mode .mindmap-toast.error {
    background: rgba(220, 38, 38, 0.95);
}

body.dark-mode .mindmap-edit-btn {
    border-color: #2b3242;
    background: #1b2230;
    color: #d7dbe3;
}

body.dark-mode .mindmap-edit-btn:hover {
    background: #253044;
}

body.dark-mode .mindmap-delete-btn {
    border-color: #2b3242;
    background: #3a1f24;
    color: #fca5a5;
}

body.dark-mode .mindmap-delete-btn:hover {
    background: #4a1f24;
}

/* Doc module */
.doc-page {
    padding: 20px;
}

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

.doc-header h1 {
    margin: 0;
}

.doc-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.doc-title-filter {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 600;
}

.doc-header-subtitle {
    margin-top: 6px;
    color: #6b7280;
    font-size: 13px;
}

.doc-header-actions {
    display: flex;
    gap: 10px;
}

.doc-new-btn.timeline {
    background-color: #10b981;
}

.doc-new-btn.timeline:hover {
    background-color: #059669;
}

.doc-type-badge {
    display: inline-block;
    padding: 2px 6px;
    background: #ecfdf5;
    color: #059669;
    font-size: 11px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 600;
}

.doc-edit-event-at {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-edit-event-at label {
    font-size: 13px;
    color: #4b5563;
}

.doc-edit-event-at input {
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
}

/* Timeline View */
.doc-timeline-page {
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.doc-timeline-container {
    position: relative;
    padding: 20px 0;
}

.doc-timeline-container::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e5e7eb;
}

.doc-timeline-item {
    position: relative;
    padding-left: 40px;
    margin-bottom: 30px;
}

.doc-timeline-marker {
    position: absolute;
    left: 0;
    top: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #3b82f6;
    z-index: 1;
}

.doc-timeline-content-wrapper {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.doc-timeline-meta {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 12px;
}

.doc-timeline-time {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.doc-timeline-entry-title {
    margin: 0;
    font-size: 16px;
    color: #1f2937;
    flex-grow: 1;
}

.doc-timeline-entry-actions {
    display: flex;
    gap: 12px;
    font-size: 14px;
}

.doc-timeline-entry-actions a,
.doc-timeline-entry-actions button {
    color: #9ca3af;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.doc-timeline-entry-actions a:hover { color: #3b82f6; }
.doc-timeline-entry-actions button:hover { color: #ef4444; }

.doc-timeline-body {
    font-size: 15px;
    line-height: 1.6;
    color: #374151;
}

.doc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.doc-search {
    flex: 1;
    min-width: 240px;
    max-width: 320px;
}

.doc-search-form {
    margin: 0;
}

.doc-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.doc-search-icon {
    position: absolute;
    left: 10px;
    color: #9ca3af;
    font-size: 14px;
    pointer-events: none;
}

.doc-search-input {
    width: 100%;
    padding: 6px 32px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
    color: #374151;
    transition: all 0.2s;
}

.doc-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.doc-search-clear {
    position: absolute;
    right: 10px;
    color: #9ca3af;
    font-size: 14px;
    text-decoration: none;
}

.doc-search-clear:hover {
    color: #6b7280;
}

.doc-active-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.doc-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.doc-results {
    color: #6b7280;
    font-size: 13px;
}

.doc-tag-summary {
    color: #6b7280;
    font-size: 13px;
    padding-left: 12px;
    border-left: 1px solid #d1d5db;
}

.doc-active-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 12px;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    background: #f8fbff;
}

.doc-active-filter-label {
    color: #6b7280;
    font-size: 12px;
}

.doc-active-filter-tag {
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 600;
}

.doc-clear-filter {
    color: #1d4ed8;
    font-size: 12px;
    text-decoration: none;
}

.doc-clear-filter:hover {
    text-decoration: underline;
}

.doc-new-btn {
    background: #1f6feb;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
}

.doc-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
}

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

.doc-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.doc-list-item:hover {
    border-color: #1f6feb;
}

.doc-list-link {
    min-width: 0;
    text-decoration: none;
    color: #111827;
    font-weight: 500;
}

.doc-list-link:hover {
    color: #1f6feb;
}

.doc-list-main {
    flex: 1;
    min-width: 0;
}

.doc-list-meta {
    margin-top: 4px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.doc-list-updated {
    color: #6b7280;
    font-size: 12px;
}

.doc-list-meta-sep {
    color: #9ca3af;
    font-size: 12px;
}

.doc-list-tags {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.doc-list-tag {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #1f6feb;
    font-size: 12px;
}

.doc-list-tag:hover {
    text-decoration: underline;
}

.doc-list-tag.active {
    color: #0b3f9c;
    font-weight: 600;
}

.doc-delete-form {
    margin: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.doc-list-item:hover .doc-delete-form,
.doc-list-item:focus-within .doc-delete-form {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.doc-delete-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #fecaca;
    background: #fff;
    color: #be123c;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.doc-delete-btn:hover {
    background: #fff1f2;
}

.doc-empty {
    color: #6b7280;
    padding: 20px;
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
}

.doc-empty a {
    color: #1d4ed8;
    text-decoration: none;
}

.doc-empty a:hover {
    text-decoration: underline;
}

.doc-sidebar {
    background: #f8f8f8;
    border-radius: 8px;
    padding: 16px;
}

.doc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.doc-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: #374151;
    font-size: 12px;
    background: #fff;
}

.doc-tag.active {
    background: #1f6feb;
    color: #fff;
    border-color: #1f6feb;
}

.doc-tag-count {
    font-size: 11px;
    opacity: 0.7;
}

.doc-view-page {
    padding: 20px;
}

.doc-view-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.doc-view-title h1 {
    margin: 0 0 8px 0;
}

.doc-view-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.doc-tag-pill {
    background: #eef2ff;
    color: #1f2937;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.doc-tag-pill:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

.doc-view-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.doc-btn {
    background: #f3f4f6;
    color: #111827;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
}

.doc-btn.primary,
.doc-btn.active {
    background: #1f6feb;
    color: #fff;
}

.doc-view-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 20px;
    align-items: start;
}

.doc-view-layout.outline-collapsed {
    grid-template-columns: minmax(0, 1fr) 64px;
}

.doc-view-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    min-width: 0;
}

.doc-view-outline {
    background: #f8f8f8;
    border-radius: 8px;
    padding: 16px;
    height: fit-content;
    position: sticky;
    top: 20px;
    border: 1px solid #e5e7eb;
    transition: padding 0.2s ease, width 0.2s ease;
}

.doc-view-outline.is-collapsed {
    padding: 12px 10px;
}

.doc-outline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.doc-view-outline.is-collapsed .doc-outline-header {
    flex-direction: column;
}

.doc-outline-title {
    font-weight: 600;
    margin: 0;
}

.doc-view-outline.is-collapsed .doc-outline-title {
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.doc-outline-toggle {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

.doc-outline-toggle:hover {
    border-color: #9ca3af;
    color: #111827;
}

.doc-outline-body {
    margin-top: 12px;
}

.doc-view-outline.is-collapsed .doc-outline-body {
    display: none;
}

.doc-outline-body ul {
    list-style: none;
    padding-left: 0;
}

.doc-outline-body li + li {
    margin-top: 8px;
}

.doc-outline-body a {
    text-decoration: none;
    color: #374151;
    font-size: 13px;
}

.doc-outline-body a:hover {
    color: #1f6feb;
}

.doc-outline-empty {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.6;
}

.doc-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.doc-content audio {
    width: 100%;
    margin: 10px 0;
}

.doc-content table {
    border: 1px solid rgba(0, 0, 0, 0.1);
    margin: 12px 0 14px;
    color: #222;
    width: auto;
    max-width: 100%;
    border-collapse: collapse;
    box-sizing: border-box;
}

.doc-content table th,
.doc-content table td {
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 5px 14px 5px 12px;
    height: 32px;
    vertical-align: top;
}

.doc-content table th {
    background-color: #555;
    color: #fff;
    font-weight: 300;
    padding-top: 6px;
}

.doc-content table th p {
    margin: 0;
    color: #fff;
}

.doc-content table td p {
    margin: 0;
    padding: 0 2px;
}

.doc-pdf-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    display: none;
    flex-direction: column;
    z-index: 2000;
}

.doc-pdf-modal.active {
    display: flex;
}

.doc-pdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #0f172a;
    color: #e2e8f0;
}

.doc-pdf-title {
    font-weight: 600;
}

.doc-pdf-actions {
    display: flex;
    gap: 8px;
}

.doc-pdf-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
}

body.dark-mode .doc-pdf-toolbar {
    background: #111827;
    color: #e5e7eb;
}

body.dark-mode .doc-view-outline {
    background: #1f2937;
    border-color: #374151;
}

body.dark-mode .doc-outline-toggle {
    background: #111827;
    color: #e5e7eb;
    border-color: #4b5563;
}

body.dark-mode .doc-outline-toggle:hover {
    border-color: #6b7280;
    color: #fff;
}

body.dark-mode .doc-outline-body a {
    color: #d1d5db;
}

body.dark-mode .doc-outline-empty {
    color: #9ca3af;
}

@media (max-width: 960px) {
    .doc-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .doc-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .doc-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .doc-stats {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .doc-tag-summary {
        border-left: none;
        padding-left: 0;
    }

    .doc-view-layout,
    .doc-view-layout.outline-collapsed {
        grid-template-columns: minmax(0, 1fr);
    }

    .doc-view-outline {
        position: static;
    }

    .doc-view-outline.is-collapsed {
        padding: 12px 16px;
    }

    .doc-view-outline.is-collapsed .doc-outline-header {
        flex-direction: row;
    }

    .doc-view-outline.is-collapsed .doc-outline-title {
        writing-mode: initial;
        text-orientation: initial;
    }
}

.doc-edit-page {
    padding: 20px;
}

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

.doc-edit-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.doc-title-input {
    flex: 2;
    min-width: 180px;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    font-size: 14px;
}

.doc-tags-input {
    flex: 1;
    min-width: 140px;
    max-width: 280px;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    font-size: 14px;
}

.doc-edit-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.doc-toolbar-icon-btn {
    border: none;
    outline: none;
    background: transparent;
    color: #4b5563;
    font-size: 15px;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.doc-toolbar-icon-btn:hover {
    background-color: #f3f4f6;
    color: #1f6feb;
}

.doc-toolbar-icon-btn.active,
.doc-toolbar-autosave-btn.active {
    color: #10b981;
}

.doc-toolbar-autosave-btn.active:hover {
    background-color: rgba(16, 185, 129, 0.12);
    color: #059669;
}

body.dark-mode .doc-title-input,
body.dark-mode .doc-tags-input {
    background-color: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

body.dark-mode .doc-toolbar-icon-btn {
    color: #9ca3af;
}

body.dark-mode .doc-toolbar-icon-btn:hover {
    background-color: #374151;
    color: #60a5fa;
}

body.dark-mode .doc-toolbar-icon-btn.active,
body.dark-mode .doc-toolbar-autosave-btn.active {
    color: #34d399;
}

body.dark-mode .doc-toolbar-autosave-btn.active:hover {
    background-color: rgba(52, 211, 153, 0.18);
    color: #6ee7b7;
}

body.dark-mode .doc-view-content,
body.dark-mode .doc-list-item,
body.dark-mode .doc-empty {
    background: #111827;
    border-color: #1f2937;
    color: #e5e7eb;
}

body.dark-mode .doc-list-link {
    color: #e5e7eb;
}

body.dark-mode .doc-list-link:hover {
    color: #60a5fa;
}

body.dark-mode .doc-header-subtitle,
body.dark-mode .doc-results,
body.dark-mode .doc-tag-summary,
body.dark-mode .doc-active-filter-label,
body.dark-mode .doc-empty {
    color: #9ca3af;
}

body.dark-mode .doc-type-badge {
    background: #064e3b;
    color: #34d399;
}

body.dark-mode .doc-edit-event-at label {
    color: #9ca3af;
}

body.dark-mode .doc-edit-event-at input {
    background: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

body.dark-mode .doc-timeline-container::before {
    background: #374151;
}

body.dark-mode .doc-timeline-marker {
    background: #111827;
    border-color: #3b82f6;
}

body.dark-mode .doc-timeline-content-wrapper {
    background: #111827;
    border-color: #1f2937;
}

body.dark-mode .doc-timeline-time {
    color: #9ca3af;
}

body.dark-mode .doc-timeline-entry-title {
    color: #e5e7eb;
}

body.dark-mode .doc-timeline-body {
    color: #d1d5db;
}

body.dark-mode .doc-title-filter {
    background: #1e3a8a;
    color: #dbeafe;
}

body.dark-mode .doc-search-input {
    background-color: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

body.dark-mode .doc-search-input:focus {
    border-color: #3b82f6;
}

body.dark-mode .doc-search-icon,
body.dark-mode .doc-search-clear {
    color: #6b7280;
}

body.dark-mode .doc-search-clear:hover {
    color: #9ca3af;
}

body.dark-mode .doc-active-filter {
    background: #0f172a;
    border-color: #1d4ed8;
}

body.dark-mode .doc-active-filter-tag,
body.dark-mode .doc-clear-filter,
body.dark-mode .doc-empty a {
    color: #93c5fd;
}

body.dark-mode .doc-delete-btn {
    border-color: #7f1d1d;
    background: #111827;
    color: #fecaca;
}

body.dark-mode .doc-delete-btn:hover {
    background: #3f1d1d;
}

body.dark-mode .doc-list-updated {
    color: #9ca3af;
}

body.dark-mode .doc-list-meta-sep {
    color: #6b7280;
}

body.dark-mode .doc-list-tag {
    color: #60a5fa;
}

body.dark-mode .doc-list-tag.active {
    color: #93c5fd;
}

body.dark-mode .doc-tag-pill {
    background: #312e81;
    color: #e0e7ff;
}

body.dark-mode .doc-tag-pill:hover {
    background: #3730a3;
    color: #fff;
}

body.dark-mode .doc-content table {
    border-color: rgba(148, 163, 184, 0.35);
    color: #e5e7eb;
}

body.dark-mode .doc-content table th,
body.dark-mode .doc-content table td {
    border-color: rgba(148, 163, 184, 0.35);
}

body.dark-mode .doc-content table th {
    background-color: #374151;
    color: #f9fafb;
}

body.dark-mode .doc-content table th p {
    color: #f9fafb;
}

body.dark-mode .doc-sidebar,
body.dark-mode .doc-view-outline {
    background: #1f2937;
}

body.dark-mode .doc-tag,
body.dark-mode .doc-btn {
    background: #111827;
    border-color: #374151;
    color: #e5e7eb;
}

body.dark-mode .doc-tag.active,
body.dark-mode .doc-btn.primary,
body.dark-mode .doc-btn.active {
    background: #2563eb;
    color: #fff;
}

/* Growth tracker */
.growth-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 18px;
}

.growth-header {
    margin-bottom: 14px;
}

.growth-header h2 {
    margin: 0 0 6px 0;
}

.growth-header p {
    margin: 0;
    color: #6b7280;
}

.growth-children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.growth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.growth-tab-btn {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
}

.growth-tab-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.growth-child-card,
.growth-chart-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
}

.growth-child-card h3 {
    margin: 0 0 10px 0;
}

.growth-child-meta {
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 10px;
}

.growth-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 12px;
}

.growth-form label {
    font-size: 12px;
    color: #4b5563;
}

.growth-form input,
.growth-form select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 7px 8px;
}

.growth-form button,
.growth-delete-btn {
    border: none;
    background: #2563eb;
    color: #fff;
    border-radius: 6px;
    padding: 7px 10px;
    cursor: pointer;
}

.growth-record-list table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.growth-record-list th,
.growth-record-list td {
    border-bottom: 1px solid #edf0f3;
    padding: 6px 4px;
    text-align: left;
}

.growth-delete-btn {
    background: #dc2626;
    padding: 5px 8px;
    font-size: 12px;
}

.growth-chart-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.growth-chart-head h3 {
    margin: 0;
}

.growth-chart-svg {
    width: 100%;
    height: 420px;
    background: #fcfdff;
    border: 1px solid #edf0f3;
    border-radius: 6px;
}

.growth-grid-line {
    stroke: #e5e7eb;
    stroke-width: 1;
}

.growth-axis-line {
    stroke: #6b7280;
    stroke-width: 1.2;
}

.growth-axis-label {
    fill: #6b7280;
    font-size: 12px;
}

.growth-line {
    stroke-width: 2;
}

.growth-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.growth-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.growth-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.growth-empty-tip {
    font-size: 13px;
    color: #6b7280;
    margin-top: 8px;
}

.growth-status {
    margin-top: 8px;
    color: #0f766e;
    font-size: 13px;
}

body.dark-mode .growth-child-card,
body.dark-mode .growth-chart-card,
body.dark-mode .growth-chart-svg {
    background: #111827;
    border-color: #374151;
    color: #e5e7eb;
}

body.dark-mode .growth-header p,
body.dark-mode .growth-form label,
body.dark-mode .growth-axis-label,
body.dark-mode .growth-empty-tip {
    color: #9ca3af;
}

body.dark-mode .growth-grid-line {
    stroke: #334155;
}

body.dark-mode .growth-axis-line {
    stroke: #94a3b8;
}

body.dark-mode .growth-form input,
body.dark-mode .growth-form select {
    background: #0f172a;
    border-color: #334155;
    color: #e5e7eb;
}

body.dark-mode .growth-record-list th,
body.dark-mode .growth-record-list td {
    border-color: #1f2937;
}

body.dark-mode .growth-tab-btn {
    background: #111827;
    border-color: #334155;
    color: #cbd5e1;
}

body.dark-mode .growth-tab-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

/* Dict */
.dict-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px;
}

.history-search {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.history-search input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 10px;
}

.history-search button {
    border: none;
    background: #2563eb;
    color: #fff;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
}

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

.history-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.history-table th,
.history-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 8px 6px;
    text-align: left;
    font-size: 13px;
    vertical-align: top;
}

.history-table th {
    background: #f8fafc;
    font-weight: 600;
}

.history-col-source,
.history-col-target {
    word-break: break-word;
}

.history-delete-btn {
    border: none;
    background: #dc2626;
    color: #fff;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
}

.history-empty {
    color: #6b7280;
    padding: 8px 2px;
    font-size: 13px;
}

.history-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.history-pagination button {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
}

.history-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

body.dark-mode .history-search input {
    background: #0f172a;
    border-color: #334155;
    color: #e5e7eb;
}

body.dark-mode .history-table th {
    background: #1f2937;
}

body.dark-mode .history-table th,
body.dark-mode .history-table td {
    border-color: #334155;
    color: #e5e7eb;
}

body.dark-mode .history-empty {
    color: #9ca3af;
}

body.dark-mode .history-pagination button {
    background: #111827;
    color: #cbd5e1;
    border-color: #334155;
}

/* Draw.io Module */
.draw-page {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.draw-fullscreen-page {
    position: fixed;
    top: 0;
    left: 50px;
    width: calc(100vw - 50px);
    height: 100vh;
    background: #f8fafc;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    padding: 0 16px 16px 16px;
    box-sizing: border-box;
}

body.dark-mode .draw-fullscreen-page {
    background: #0f172a;
}

.draw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.draw-header h1 {
    margin: 0;
    font-size: 24px;
    color: #1e293b;
}

.draw-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.draw-actions button {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.draw-actions button:hover {
    background: #1d4ed8;
}

.draw-btn-clipboard {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0284c7;
    color: #fff !important;
    text-decoration: none !important;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.draw-btn-clipboard:hover {
    background: #0369a1;
}

.draw-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.draw-filters input {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: #0f172a;
    width: 200px;
}

.draw-filters input:focus {
    outline: none;
    border-color: #2563eb;
}

.draw-list {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.draw-tags-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.draw-tag-chip {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.draw-tag-chip:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.draw-empty {
    color: #64748b;
    text-align: center;
    padding: 30px 0;
    font-size: 14px;
}

.draw-items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.draw-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.draw-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.draw-item-title {
    font-weight: 600;
    font-size: 16px;
    color: #1e293b;
    text-decoration: none;
    transition: color 0.2s;
}

.draw-item-title:hover {
    color: #2563eb;
    text-decoration: underline;
}

.draw-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    color: #64748b;
    font-size: 13px;
    margin-top: 4px;
}

.draw-item-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.draw-tag {
    background: #f1f5f9;
    color: #475569;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
}

.draw-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.draw-edit-btn {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.draw-edit-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.draw-delete-btn {
    border: 1px solid #fee2e2;
    background: #fff5f5;
    color: #991b1b;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.draw-delete-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* Detail & Edit pages style */
.draw-viewer-container, .draw-editor-container {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    margin-top: 10px;
}

.draw-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}

.draw-toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.draw-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.draw-back-btn {
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.draw-back-btn:hover {
    color: #0f172a;
}

.draw-canvas {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    margin-top: 15px;
}

.draw-canvas iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.draw-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1e293b;
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
}

.draw-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.draw-toast.success {
    background: #10b981;
}

.draw-toast.error {
    background: #ef4444;
}

/* Dark mode overrides */
body.dark-mode .draw-header h1 {
    color: #f1f5f9;
}

body.dark-mode .draw-filters input {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .draw-list {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .draw-tag-chip {
    border-color: #334155;
    background: #1e293b;
    color: #cbd5e1;
}

body.dark-mode .draw-tag-chip:hover {
    background: #334155;
    color: #f1f5f9;
}

body.dark-mode .draw-empty {
    color: #94a3b8;
}

body.dark-mode .draw-item {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .draw-item:hover {
    border-color: #475569;
}

body.dark-mode .draw-item-title {
    color: #f1f5f9;
}

body.dark-mode .draw-item-title:hover {
    color: #60a5fa;
}

body.dark-mode .draw-item-meta {
    color: #94a3b8;
}

body.dark-mode .draw-tag {
    background: #334155;
    color: #cbd5e1;
}

body.dark-mode .draw-edit-btn {
    background: #1e293b;
    border-color: #475569;
    color: #cbd5e1;
}

body.dark-mode .draw-edit-btn:hover {
    background: #334155;
    color: #f1f5f9;
}

body.dark-mode .draw-delete-btn {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
}

body.dark-mode .draw-delete-btn:hover {
    background: #7f1d1d;
}

body.dark-mode .draw-toolbar {
    border-color: #334155;
}

body.dark-mode .draw-back-btn {
    color: #94a3b8;
}

body.dark-mode .draw-back-btn:hover {
    color: #f1f5f9;
}

body.dark-mode .draw-canvas {
    border-color: #334155;
}

body.dark-mode .draw-btn-clipboard {
    background: #0284c7;
    color: #fff !important;
}

body.dark-mode .draw-btn-clipboard:hover {
    background: #0369a1;
}

/* Clipboard Screenshot Editor */
.draw-clipboard-page {
    position: fixed;
    top: 0;
    left: 50px;
    width: calc(100vw - 50px);
    height: 100vh;
    background: #f1f5f9;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

body.dark-mode .draw-clipboard-page {
    background: #0b0f19;
}

.clipboard-toolbar {
    height: 52px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 12px;
    flex-shrink: 0;
    z-index: 10;
}

body.dark-mode .clipboard-toolbar {
    background: #151d2f;
    border-bottom-color: #2b3548;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.clipboard-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.clipboard-back-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

body.dark-mode .clipboard-back-btn {
    color: #94a3b8;
}

body.dark-mode .clipboard-back-btn:hover {
    background: #1e293b;
    color: #f8fafc;
}

.toolbar-divider {
    width: 1px;
    height: 22px;
    background: #e2e8f0;
    margin: 0 4px;
}

body.dark-mode .toolbar-divider {
    background: #2b3548;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.toolbar-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.toolbar-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

body.dark-mode .toolbar-btn {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

body.dark-mode .toolbar-btn:hover:not(:disabled) {
    background: #283548;
    border-color: #475569;
    color: #ffffff;
}

.tool-group {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    gap: 2px;
}

body.dark-mode .tool-group {
    background: #0f172a;
}

.tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: none;
    background: transparent;
    color: #64748b;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tool-btn:hover {
    color: #0f172a;
}

.tool-btn.active {
    background: #ffffff;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body.dark-mode .tool-btn {
    color: #94a3b8;
}

body.dark-mode .tool-btn:hover {
    color: #ffffff;
}

body.dark-mode .tool-btn.active {
    background: #2563eb;
    color: #ffffff;
}

.color-palette {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    outline: none;
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.active {
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2563eb;
}

body.dark-mode .color-swatch.active {
    box-shadow: 0 0 0 2px #0f172a, 0 0 0 4px #60a5fa;
}

.custom-color-wrap {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid #cbd5e1;
}

.custom-color-wrap input[type="color"] {
    width: 32px;
    height: 32px;
    border: none;
    padding: 0;
    cursor: pointer;
    background: none;
}

.size-controls {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.size-control-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #64748b;
}

body.dark-mode .size-control-item {
    color: #94a3b8;
}

.size-control-item select {
    padding: 3px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 12px;
    background: #ffffff;
    color: #334155;
    outline: none;
}

body.dark-mode .size-control-item select {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease;
    color: #ffffff;
}

.btn-copy {
    background: #2563eb;
}

.btn-copy:hover {
    background: #1d4ed8;
}

.btn-save {
    background: #10b981;
}

.btn-save:hover {
    background: #059669;
}

/* Workspace */
.clipboard-workspace {
    flex: 1;
    position: relative;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background-color: #f1f5f9;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 16px 16px;
    user-select: none;
}

body.dark-mode .clipboard-workspace {
    background-color: #0b0f19;
    background-image: radial-gradient(#1e293b 1px, transparent 1px);
}

.canvas-empty-state {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    max-width: 480px;
}

body.dark-mode .canvas-empty-state {
    background: #151d2f;
    border-color: #2b3548;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.empty-icon {
    font-size: 48px;
    color: #3b82f6;
    margin-bottom: 16px;
}

.canvas-empty-state h2 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
}

body.dark-mode .canvas-empty-state h2 {
    color: #f8fafc;
}

.canvas-empty-state p {
    margin: 0 0 24px 0;
    font-size: 14px;
    color: #64748b;
}

body.dark-mode .canvas-empty-state p {
    color: #94a3b8;
}

.canvas-empty-state kbd {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    font-family: inherit;
    color: #0f172a;
}

body.dark-mode .canvas-empty-state kbd {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.empty-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.empty-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.empty-btn.primary {
    background: #2563eb;
    color: #ffffff;
    border: none;
}

.empty-btn.primary:hover {
    background: #1d4ed8;
}

.empty-btn.secondary {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.empty-btn.secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

body.dark-mode .empty-btn.secondary {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

body.dark-mode .empty-btn.secondary:hover {
    background: #283548;
    color: #ffffff;
}

.empty-tip {
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.canvas-container {
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    background: #ffffff;
    line-height: 0;
}

.canvas-container canvas {
    display: block;
    max-width: none;
}

#preview-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: auto;
    cursor: crosshair;
}

/* Floating Text Input Box */
.floating-text-box {
    position: absolute;
    z-index: 20;
    background: #ffffff;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    transform: translateY(-50%);
}

body.dark-mode .floating-text-box {
    background: #1e293b;
    border-color: #60a5fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.floating-text-box input {
    border: none;
    outline: none;
    font-size: 14px;
    font-weight: 600;
    background: transparent;
    min-width: 180px;
}

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

.floating-text-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.btn-text-confirm {
    color: #10b981;
}

.btn-text-confirm:hover {
    background: #ecfdf5;
}

body.dark-mode .btn-text-confirm:hover {
    background: #064e3b;
}

.btn-text-cancel {
    color: #ef4444;
}

.btn-text-cancel:hover {
    background: #fef2f2;
}

body.dark-mode .btn-text-cancel:hover {
    background: #7f1d1d;
}

/* Reading (Book) Module */
.book-page {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.book-header {
    margin-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 16px;
}

.book-header h1 {
    font-size: 26px;
    color: #0f172a;
    margin: 0 0 6px 0;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.book-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}

.book-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.05);
}

.book-cover-placeholder {
    height: 140px;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 48px;
    margin-bottom: 16px;
}

.book-info {
    flex: 1;
}

.book-title {
    font-size: 18px;
    color: #0f172a;
    margin: 0 0 4px 0;
    font-weight: 700;
}

.book-en-title {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.book-author {
    font-size: 13px;
    color: #475569;
    margin: 0 0 12px 0;
}

.book-desc {
    font-size: 13.5px;
    color: #334155;
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.book-meta {
    font-size: 12px;
    color: #64748b;
    border-top: 1px dashed #e2e8f0;
    padding-top: 12px;
    margin-bottom: 16px;
}

.book-card-actions {
    display: flex;
    gap: 10px;
}

.book-btn {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.book-btn.primary-btn {
    background: #2563eb;
    color: #fff;
}

.book-btn.primary-btn:hover {
    background: #1d4ed8;
}

.book-btn.secondary-btn {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.book-btn.secondary-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Chapter Directory */
.chapters-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chapter-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
}

.chapter-card-header {
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.chapter-no {
    font-size: 12px;
    color: #2563eb;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chapter-title {
    font-size: 20px;
    color: #0f172a;
    margin: 4px 0;
    font-weight: 700;
}

.chapter-en-title {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

.chapter-intro {
    background: #f8fafc;
    border-left: 4px solid #94a3b8;
    padding: 12px 16px;
    border-radius: 0 6px 6px 0;
    margin-bottom: 20px;
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
}

.sections-list-wrapper h3 {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chapter-sections-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-item {
    display: flex;
    align-items: flex-start;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 12px 16px;
    transition: all 0.2s;
}

.section-item:hover {
    border-color: #e2e8f0;
    background: #fafbfc;
}

.section-num {
    font-size: 13px;
    font-weight: 600;
    color: #2563eb;
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 14px;
    margin-top: 2px;
}

.section-info {
    flex: 1;
}

.section-link {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
}

.section-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.section-en-title {
    font-size: 12px;
    color: #64748b;
    margin-left: 8px;
}

.section-summary {
    font-size: 13px;
    color: #475569;
    margin: 6px 0 0 0;
    line-height: 1.5;
}

.read-sec-btn {
    font-size: 13px;
    color: #2563eb;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.read-sec-btn:hover {
    background: #f0f6ff;
}

/* Fullscreen Reader Layout */
.reader-wrapper {
    position: fixed;
    top: 0;
    left: 50px;
    width: calc(100vw - 50px);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    z-index: 1002;
}

/* Header */
.reader-header {
    height: 54px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    z-index: 10;
}

.reader-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.reader-back-btn {
    color: #475569;
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reader-back-btn:hover {
    color: #0f172a;
}

.reader-crumb {
    font-size: 13px;
    color: #64748b;
    border-left: 1px solid #e2e8f0;
    padding-left: 16px;
}

.reader-title-center {
    flex: 1;
    text-align: center;
}

.reader-title-center h3 {
    margin: 0;
    font-size: 16px;
    color: #0f172a;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
    display: inline-block;
}

.reader-header-right {
    display: flex;
    align-items: center;
}

.reader-mode-switch {
    display: flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.reader-mode-switch .mode-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    color: #475569;
    padding: 4px 12px;
    border-radius: 6px;
    transition: all 0.15s;
}

.reader-mode-switch .mode-btn:hover {
    color: #0f172a;
}

.reader-mode-switch .mode-btn.active {
    background: #fff;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Panes Area */
.reader-panes-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.reader-pane {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    display: block;
    height: 100%;
}

/* Border separator in bilingual split mode */
.mode-bilingual .pane-zh {
    border-right: 1px solid #e2e8f0;
}

/* Reading mode selectors */
.mode-zh .pane-en {
    display: none !important;
}

.mode-zh .pane-zh {
    flex: 0 1 100%;
}

.mode-en .pane-zh {
    display: none !important;
}

.mode-en .pane-en {
    flex: 0 1 100%;
}

/* Typographic Styles */
.reader-content-inner {
    max-width: 780px;
    margin: 0 auto;
    padding: 40px 24px 80px 24px;
}

.mode-zh .reader-content-inner, .mode-en .reader-content-inner {
    max-width: 820px;
    padding: 50px 40px 100px 40px;
}

.reader-article {
    color: #1e293b;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.sec-header {
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 24px;
    margin-bottom: 32px;
}

.sec-header h1 {
    font-size: 26px;
    color: #0f172a;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.sec-header .subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

.article-body p {
    font-size: 16px;
    line-height: 1.8;
    color: #1e293b;
    margin-top: 0;
    margin-bottom: 1.5em;
    text-align: justify;
}

.article-body figure {
    margin: 28px 0;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    background: white;
}

.article-body figcaption {
    margin-top: 12px;
    font-size: 13.5px;
    color: #475569;
    line-height: 1.5;
}

.article-body .cap {
    font-weight: 600;
    display: block;
}

.article-body .note {
    font-size: 12px;
    color: #64748b;
    display: block;
    margin-top: 4px;
}

.article-body em {
    font-style: normal;
    font-weight: 600;
    border-bottom: 1px dashed #2563eb;
    padding-bottom: 1px;
}

.article-body i {
    font-style: italic;
}

/* Footnotes/Explains boxes */
.article-body .note-box {
    background: #f1f5f9;
    border-left: 4px solid #64748b;
    padding: 12px 16px;
    border-radius: 0 6px 6px 0;
    margin: 20px 0;
    font-size: 13.5px;
    color: #475569;
}

/* Minimalist Footer */
.reader-footer {
    height: 48px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 10;
}

.reader-footer-left, .reader-footer-right {
    min-width: 160px;
}

.reader-footer-right {
    text-align: right;
}

.nav-sec-btn {
    color: #2563eb;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
}

.nav-sec-btn:hover {
    text-decoration: underline;
}

.nav-sec-btn.disabled {
    color: #94a3b8;
    cursor: not-allowed;
}

.nav-sec-btn.disabled:hover {
    text-decoration: none;
}

.reader-footer-center {
    font-size: 12px;
    color: #64748b;
}

/* Dark Mode Overrides for Book Module */
body.dark-mode .book-header {
    border-color: #334155;
}

body.dark-mode .book-header h1 {
    color: #f1f5f9;
}

body.dark-mode .book-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .book-card:hover {
    border-color: #475569;
}

body.dark-mode .book-title {
    color: #f1f5f9;
}

body.dark-mode .book-en-title {
    color: #94a3b8;
}

body.dark-mode .book-author {
    color: #cbd5e1;
}

body.dark-mode .book-desc {
    color: #e2e8eb;
}

body.dark-mode .book-meta {
    color: #94a3b8;
    border-color: #334155;
}

body.dark-mode .book-btn.secondary-btn {
    background: #1e293b;
    color: #cbd5e1;
    border-color: #334155;
}

body.dark-mode .book-btn.secondary-btn:hover {
    background: #334155;
    color: #f1f5f9;
}

body.dark-mode .chapter-card {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .chapter-card-header {
    border-color: #334155;
}

body.dark-mode .chapter-title {
    color: #f1f5f9;
}

body.dark-mode .chapter-en-title {
    color: #94a3b8;
}

body.dark-mode .chapter-intro {
    background: #0f172a;
    border-color: #475569;
    color: #cbd5e1;
}

body.dark-mode .section-item {
    border-color: #334155;
}

body.dark-mode .section-item:hover {
    background: #111827;
    border-color: #475569;
}

body.dark-mode .section-link {
    color: #f1f5f9;
}

body.dark-mode .section-link:hover {
    color: #60a5fa;
}

body.dark-mode .section-en-title {
    color: #94a3b8;
}

body.dark-mode .section-summary {
    color: #cbd5e1;
}

body.dark-mode .read-sec-btn:hover {
    background: #1e3a8a;
}

/* Reader fullscreen Dark Mode */
body.dark-mode .reader-wrapper {
    background: #0f172a;
}

body.dark-mode .reader-header {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .reader-back-btn {
    color: #cbd5e1;
}

body.dark-mode .reader-back-btn:hover {
    color: #f1f5f9;
}

body.dark-mode .reader-crumb {
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .reader-title-center h3 {
    color: #f1f5f9;
}

body.dark-mode .reader-mode-switch {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .reader-mode-switch .mode-btn {
    color: #94a3b8;
}

body.dark-mode .reader-mode-switch .mode-btn:hover {
    color: #cbd5e1;
}

body.dark-mode .reader-mode-switch .mode-btn.active {
    background: #1e293b;
    color: #60a5fa;
}

body.dark-mode .reader-pane {
    background: #0f172a;
}

body.dark-mode .mode-bilingual .pane-zh {
    border-color: #334155;
}

body.dark-mode .reader-article {
    color: #cbd5e1;
}

body.dark-mode .sec-header {
    border-color: #334155;
}

body.dark-mode .sec-header h1 {
    color: #f1f5f9;
}

body.dark-mode .sec-header .subtitle {
    color: #94a3b8;
}

body.dark-mode .article-body p {
    color: #cbd5e1;
}

body.dark-mode .article-body figure {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .article-body img {
    background: #0f172a;
}

body.dark-mode .article-body figcaption {
    color: #cbd5e1;
}

body.dark-mode .article-body .note {
    color: #94a3b8;
}

body.dark-mode .article-body em {
    border-color: #60a5fa;
}

body.dark-mode .article-body .note-box {
    background: #1e293b;
    border-color: #475569;
    color: #cbd5e1;
}

body.dark-mode .reader-footer {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .reader-footer-center {
    color: #94a3b8;
}

body.dark-mode .nav-sec-btn {
    color: #60a5fa;
}

body.dark-mode .nav-sec-btn.disabled {
    color: #475569;
}

/* Highlights and Annotations */
.highlight-toolbar {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 6px 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.15s, transform 0.15s;
    pointer-events: auto;
}

body.dark-mode .highlight-toolbar {
    background: #1e293b;
    border-color: #475569;
}

.color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    padding: 0;
    flex-shrink: 0;
}

.color-dot.yellow { background-color: #fef08a !important; }
.color-dot.green { background-color: #bbf7d0 !important; }
.color-dot.pink { background-color: #fbcfe8 !important; }
.color-dot.blue { background-color: #bfdbfe !important; }

body.dark-mode .color-dot {
    border-color: #1e293b;
}

.color-dot:hover {
    transform: scale(1.15);
}

.highlight-toolbar .toolbar-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
}

.highlight-toolbar .toolbar-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

body.dark-mode .highlight-toolbar .toolbar-btn {
    color: #cbd5e1;
}

body.dark-mode .highlight-toolbar .toolbar-btn:hover {
    background: #334155;
    color: #ffffff;
}

/* Highlighted Text Markings */
.book-highlight {
    cursor: pointer;
    background-color: transparent;
    border-radius: 2px;
    padding: 1px 0;
    transition: background-color 0.15s;
    color: inherit;
}

/* Color codes with translucent overlays */
.book-highlight.highlight-yellow { background-color: rgba(253, 224, 71, 0.35) !important; }
.book-highlight.highlight-green { background-color: rgba(134, 239, 172, 0.35) !important; }
.book-highlight.highlight-pink { background-color: rgba(244, 114, 182, 0.35) !important; }
.book-highlight.highlight-blue { background-color: rgba(147, 197, 253, 0.35) !important; }

body.dark-mode .book-highlight.highlight-yellow { background-color: rgba(234, 179, 8, 0.3) !important; }
body.dark-mode .book-highlight.highlight-green { background-color: rgba(34, 197, 94, 0.3) !important; }
body.dark-mode .book-highlight.highlight-pink { background-color: rgba(236, 72, 153, 0.3) !important; }
body.dark-mode .book-highlight.highlight-blue { background-color: rgba(59, 130, 246, 0.3) !important; }

.book-highlight:hover {
    filter: brightness(1.05);
}

.book-highlight.has-comment {
    border-bottom: 2px dotted #2563eb;
}

body.dark-mode .book-highlight.has-comment {
    border-color: #60a5fa;
}

.highlight-badge {
    font-size: 10px;
    color: #2563eb;
    margin-left: 2px;
    vertical-align: super;
    cursor: help;
    pointer-events: none;
}

body.dark-mode .highlight-badge {
    color: #60a5fa;
}

/* Modals */
.reader-modal {
    display: flex;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
}

.reader-modal-content {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    width: 480px;
    max-width: 90vw;
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: readerModalFadeIn 0.2s ease;
}

body.dark-mode .reader-modal-content {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

@keyframes readerModalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.reader-modal-close {
    position: absolute;
    top: 14px;
    right: 18px;
    font-size: 24px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
}

.reader-modal-close:hover {
    color: #0f172a;
}

body.dark-mode .reader-modal-close:hover {
    color: #ffffff;
}

.reader-modal-content h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: #0f172a;
    font-weight: 700;
}

body.dark-mode .reader-modal-content h3 {
    color: #f1f5f9;
}

.highlighted-quote {
    background: #f8fafc;
    border-left: 4px solid #cbd5e1;
    padding: 10px 14px;
    margin: 0;
    font-size: 14px;
    color: #475569;
    font-style: italic;
    line-height: 1.5;
    border-radius: 0 6px 6px 0;
}

body.dark-mode .highlighted-quote {
    background: #0f172a;
    border-color: #475569;
    color: #cbd5e1;
}

/* Split-Pane Book Chapters Layout */
.book-chapters-layout {
    display: flex;
    gap: 20px;
    height: calc(100vh - 110px);
    overflow: hidden;
    margin-top: 15px;
}

.chapters-sidebar {
    width: 320px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    overflow-y: auto;
    flex-shrink: 0;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    box-sizing: border-box;
}

.chapter-content-pane {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    padding: 24px;
    overflow-y: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    box-sizing: border-box;
}

.chapters-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chapter-nav-item {
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-left: 4px solid transparent;
    box-sizing: border-box;
}

.chapter-nav-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.chapter-nav-item.active {
    background: #eff6ff;
    color: #2563eb;
    border-left-color: #2563eb;
    font-weight: 600;
}

.nav-ch-no {
    font-size: 11px;
    text-transform: uppercase;
    color: #64748b;
    display: block;
    margin-bottom: 2px;
}

.nav-ch-title {
    font-size: 14px;
    color: inherit;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dark Mode Overrides for Split-Pane Chapters */
body.dark-mode .chapters-sidebar {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .chapter-content-pane {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .chapter-nav-item:hover {
    background: #334155;
    color: #f1f5f9;
}

body.dark-mode .chapter-nav-item.active {
    background: #1e3a8a;
    color: #60a5fa;
    border-left-color: #60a5fa;
}

body.dark-mode .nav-ch-no {
    color: #94a3b8;
}

/* Reading Page Floating Directory Drawer */
.reader-sidebar-drawer {
    position: fixed;
    top: 0;
    left: -360px; /* Hidden off-screen by default */
    width: 360px;
    height: 100vh;
    background: #ffffff;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    z-index: 1200;
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.reader-sidebar-drawer.open {
    left: 0; /* Slide-in */
}

.reader-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.4);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.reader-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.drawer-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.drawer-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.drawer-close-btn {
    font-size: 18px;
    color: #64748b;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.1s ease;
    padding: 0;
}

.drawer-close-btn:hover {
    color: #0f172a;
}

/* Client-side Search Filter Box */
.drawer-search-wrapper {
    padding: 12px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.drawer-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
    background: #ffffff;
    color: #0f172a;
}

.drawer-search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

.drawer-chapter-group {
    margin-bottom: 14px;
}

.drawer-chapter-header {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding: 4px 8px;
    background: #f1f5f9;
    border-radius: 4px;
}

.drawer-sections-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drawer-section-item {
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 6px;
    color: #475569;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    gap: 8px;
    transition: all 0.15s ease;
    box-sizing: border-box;
    line-height: 1.4;
}

.drawer-section-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.drawer-section-item.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.drawer-sec-no {
    color: #94a3b8;
    flex-shrink: 0;
}

.drawer-section-item.active .drawer-sec-no {
    color: #3b82f6;
}

.drawer-sec-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dark Mode Overrides for Drawer */
body.dark-mode .reader-sidebar-drawer {
    background: #1e293b;
    box-shadow: 4px 0 25px rgba(0,0,0,0.4);
}

body.dark-mode .drawer-header {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .drawer-title {
    color: #f1f5f9;
}

body.dark-mode .drawer-close-btn {
    color: #94a3b8;
}

body.dark-mode .drawer-close-btn:hover {
    color: #ffffff;
}

body.dark-mode .drawer-search-wrapper {
    border-color: #334155;
}

body.dark-mode .drawer-search-input {
    background: #0f172a;
    border-color: #475569;
    color: #f1f5f9;
}

body.dark-mode .drawer-search-input:focus {
    border-color: #3b82f6;
}

body.dark-mode .drawer-chapter-header {
    background: #334155;
    color: #cbd5e1;
}

body.dark-mode .drawer-section-item {
    color: #94a3b8;
}

body.dark-mode .drawer-section-item:hover {
    background: #334155;
    color: #ffffff;
}

body.dark-mode .drawer-section-item.active {
    background: #1e3a8a;
    color: #60a5fa;
}

/* Document Multi-Tab System */
.doc-tabs-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 6px 16px 0 16px;
    margin-bottom: 20px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
}

body.dark-mode .doc-tabs-bar {
    background: #0f1115;
    border-bottom: 1px solid #1e293b;
}

.doc-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 6px 6px 0 0;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    position: relative;
    user-select: none;
}

body.dark-mode .doc-tab {
    background: #1e293b;
    color: #94a3b8;
    border-color: #334155;
}

.doc-tab:hover {
    background: #e2e8f0;
    color: #334155;
    border-color: #cbd5e1;
    border-bottom: none;
}

body.dark-mode .doc-tab:hover {
    background: #334155;
    color: #f1f5f9;
    border-color: #475569;
    border-bottom: none;
}

.doc-tab.active {
    background: #ffffff;
    color: #1f6feb;
    font-weight: 600;
    border-color: #cbd5e1;
    border-bottom-color: #ffffff;
    z-index: 2;
}

body.dark-mode .doc-tab.active {
    background: #141922;
    color: #38bdf8;
    border-color: #1e293b;
    border-bottom-color: #141922;
}

.doc-tab-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
}

.doc-tab-icon {
    font-size: 12px;
    opacity: 0.8;
}

.doc-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 14px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
}

.doc-tab-close:hover {
    background: #cbd5e1;
    color: #ef4444;
}

body.dark-mode .doc-tab-close:hover {
    background: #475569;
    color: #f87171;
}

/* Mindmap Multi-Tab System */
.mindmap-tabs-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 6px 16px 0 16px;
    margin-bottom: 20px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
}

body.dark-mode .mindmap-tabs-bar {
    background: #0f1115;
    border-bottom: 1px solid #1e293b;
}

.mindmap-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 6px 6px 0 0;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    position: relative;
    user-select: none;
}

body.dark-mode .mindmap-tab {
    background: #1e293b;
    color: #94a3b8;
    border-color: #334155;
}

.mindmap-tab:hover {
    background: #e2e8f0;
    color: #334155;
    border-color: #cbd5e1;
    border-bottom: none;
}

body.dark-mode .mindmap-tab:hover {
    background: #334155;
    color: #f1f5f9;
    border-color: #475569;
    border-bottom: none;
}

.mindmap-tab.active {
    background: #ffffff;
    color: #1f6feb;
    font-weight: 600;
    border-color: #cbd5e1;
    border-bottom-color: #ffffff;
    z-index: 2;
}

body.dark-mode .mindmap-tab.active {
    background: #141922;
    color: #38bdf8;
    border-color: #1e293b;
    border-bottom-color: #141922;
}

.mindmap-tab-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    text-decoration: none;
}

.mindmap-tab-icon {
    font-size: 12px;
    opacity: 0.8;
}

.mindmap-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 14px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mindmap-tab-close:hover {
    background: #cbd5e1;
    color: #ef4444;
}

body.dark-mode .mindmap-tab-close:hover {
    background: #475569;
    color: #f87171;
}

/* Dashboard Grid & Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.dashboard-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}

body.dark-mode .dashboard-card {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    border-color: #3b82f6;
}

body.dark-mode .dashboard-card:hover {
    box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.4);
    border-color: #38bdf8;
}

.dashboard-card .card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.dashboard-card .card-icon {
    font-size: 1.4rem;
    color: #475569;
    transition: color 0.2s ease;
}

body.dark-mode .dashboard-card .card-icon {
    color: #94a3b8;
}

.dashboard-card:hover .card-icon {
    color: #3b82f6;
}

body.dark-mode .dashboard-card:hover .card-icon {
    color: #38bdf8;
}

.dashboard-card h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}

body.dark-mode .dashboard-card h3 {
    color: #f1f5f9;
}

.dashboard-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dashboard-card .metric-main {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e3a8a;
    line-height: 1.1;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

body.dark-mode .dashboard-card .metric-main {
    color: #38bdf8;
}

.dashboard-card .metric-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
}

body.dark-mode .dashboard-card .metric-label {
    color: #94a3b8;
}

.dashboard-card .metric-sub-row {
    font-size: 0.8rem;
    color: #475569;
    display: flex;
    gap: 12px;
    border-top: 1px solid #f1f5f9;
    padding-top: 8px;
    margin-top: 4px;
}

body.dark-mode .dashboard-card .metric-sub-row {
    color: #94a3b8;
    border-top-color: #334155;
}

.dashboard-card .sub-metric strong {
    color: #0f172a;
}

body.dark-mode .dashboard-card .sub-metric strong {
    color: #f1f5f9;
}

.card-tasks { border-left: 4px solid #3b82f6; }
.card-notes { border-left: 4px solid #eab308; }
.card-docs { border-left: 4px solid #06b6d4; }
.card-mindmaps { border-left: 4px solid #a855f7; }
.card-drawings { border-left: 4px solid #10b981; }
.card-office { border-left: 4px solid #4f46e5; }
.card-calendar { border-left: 4px solid #f97316; }
.card-stocks { border-left: 4px solid #f43f5e; }

/* Spreadsheet One-Line Header Layout */
.doc-spreadsheet-page .doc-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.doc-spreadsheet-page .doc-view-title {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.doc-spreadsheet-page .doc-view-title h1 {
    margin: 0;
    font-size: 1.4rem;
    white-space: nowrap;
}

.doc-spreadsheet-page .doc-view-tags {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.doc-spreadsheet-page .doc-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.doc-spreadsheet-page .doc-edit-meta {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.doc-spreadsheet-page .doc-title-input {
    flex: 2;
    padding: 8px 12px;
}

.doc-spreadsheet-page .doc-tags-input {
    flex: 1;
    padding: 8px 12px;
}

body.dark-mode .doc-spreadsheet-page .doc-title-input,
body.dark-mode .doc-spreadsheet-page .doc-tags-input {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

/* Spreadsheet Containers & Dark Mode Adaptation */
.doc-spreadsheet-viewer-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
    overflow: hidden;
}

body.dark-mode .doc-spreadsheet-viewer-container {
    background: #151b27 !important;
    border-color: #2b3242 !important;
}

.doc-spreadsheet-editor-container {
    margin-top: 16px;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

body.dark-mode .doc-spreadsheet-editor-container {
    background: #151b27 !important;
    border-color: #2b3242 !important;
}

body.dark-mode .x-spreadsheet {
    filter: invert(0.92) hue-rotate(180deg) contrast(0.96);
    background: #ffffff !important;
    border-radius: 4px;
}

body.dark-mode .x-spreadsheet-sheet,
body.dark-mode .x-spreadsheet-table {
    background: #ffffff !important;
}

/* Prevent global dark-mode styles from double-inverting inputs/textareas inside x-spreadsheet */
body.dark-mode .x-spreadsheet input,
body.dark-mode .x-spreadsheet textarea,
body.dark-mode .x-spreadsheet select {
    background: #ffffff !important;
    color: #0a0a0a !important;
    border-color: #e0e2e4 !important;
}

/* Re-invert color palette so that color picker displays true colors */
body.dark-mode .x-spreadsheet .x-spreadsheet-color-palette {
    filter: invert(1) hue-rotate(180deg);
}

/* ==========================================================================
   Office (VibeOffice) Module Styles
   ========================================================================== */
.office-page {
    padding: 24px;
    max-width: 1300px;
    margin: 0 auto;
}

.office-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.office-header-title h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    color: var(--text, #1e293b);
    display: flex;
    align-items: center;
}

.office-subtitle {
    display: block;
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

.office-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.office-btn-create,
.office-btn-upload,
.office-btn-suite {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
}

.office-btn-create {
    background: #4f46e5;
    color: #fff;
}
.office-btn-create:hover {
    background: #4338ca;
}

.office-btn-upload {
    background: #0284c7;
    color: #fff;
}
.office-btn-upload:hover {
    background: #0369a1;
}

.office-btn-suite {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}
.office-btn-suite:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.office-dropdown {
    position: relative;
    display: inline-block;
}

.office-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background-color: var(--card, #ffffff);
    min-width: 220px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 8px;
    z-index: 100;
    overflow: hidden;
}

.office-dropdown-content.show {
    display: block;
}

.office-dropdown-content a {
    color: var(--text, #1e293b);
    padding: 10px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: background-color 0.15s;
}

.office-dropdown-content a:hover {
    background-color: var(--bg-hover, #f8fafc);
}

.office-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.office-type-tabs {
    display: flex;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.office-tab {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.office-tab:hover {
    color: #1e293b;
}

.office-tab.active {
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.office-filter-inputs {
    display: flex;
    gap: 10px;
}

.office-filter-inputs input {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 13px;
    background: var(--card, #ffffff);
    color: var(--text, #0f172a);
    width: 200px;
}

.office-filter-inputs input:focus {
    outline: none;
    border-color: #4f46e5;
}

.office-tags-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.office-tag-chip {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.office-tag-chip:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.office-empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--card, #ffffff);
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    color: #64748b;
    font-size: 15px;
}

.office-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.office-card {
    background: var(--card, #ffffff);
    border: 1px solid var(--line, #e2e8f0);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.office-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.office-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.office-card-icon-box {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    border: 1px solid transparent;
}

.office-card-title-box {
    flex: 1;
    min-width: 0;
}

.office-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text, #1e293b);
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s;
}

.office-card-title:hover {
    color: #4f46e5;
}

.office-card-filename {
    font-size: 12px;
    color: #64748b;
    display: block;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.office-card-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 12px;
}

.office-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
    min-height: 22px;
}

.office-tag {
    background: #f1f5f9;
    color: #475569;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
}

.office-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--line, #f1f5f9);
    padding-top: 12px;
}

.office-action-btn {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    transition: all 0.15s;
}

.office-action-btn.primary {
    background: #eef2ff;
    color: #4338ca;
    border-color: #c7d2fe;
    flex: 1;
    justify-content: center;
}
.office-action-btn.primary:hover {
    background: #e0e7ff;
}

.office-action-btn.secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.office-action-btn.danger {
    color: #dc2626;
    border-color: #fecaca;
    background: #fff5f5;
}
.office-action-btn.danger:hover {
    background: #fee2e2;
}

/* Fullscreen Editor Page */
.office-fullscreen-page {
    position: fixed;
    top: 0;
    left: 50px;
    width: calc(100vw - 50px);
    height: 100vh;
    background: var(--bg, #f8fafc);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.office-editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--card, #ffffff);
    border-bottom: 1px solid var(--line, #e2e8f0);
    box-sizing: border-box;
    height: 52px;
}

.office-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.office-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.office-back-btn {
    color: #475569;
    text-decoration: none;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    transition: all 0.15s;
}

.office-back-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.office-type-pill {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.office-pill-word { background: #eff6ff; color: #1d4ed8; }
.office-pill-sheet { background: #f0fdf4; color: #15803d; }
.office-pill-slide { background: #fff1f2; color: #be123c; }

.office-title-container {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.office-editable-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text, #1e293b);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.office-editable-title:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.office-editable-title:focus {
    outline: none;
    border-color: #4f46e5;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.office-doc-filename {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}

.office-tags-container {
    display: flex;
    gap: 4px;
    overflow: hidden;
}

.office-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.office-status-indicator.saved {
    background: #ecfdf5;
    color: #059669;
}

.office-status-indicator.saving {
    background: #fef3c7;
    color: #d97706;
}

.office-status-indicator.modified {
    background: #eff6ff;
    color: #2563eb;
}

.office-status-indicator.error {
    background: #fef2f2;
    color: #dc2626;
}

.office-btn-primary {
    background: #4f46e5;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}
.office-btn-primary:hover {
    background: #4338ca;
}

.office-btn-secondary {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}
.office-btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}
.office-btn-secondary.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.office-iframe-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
}

.office-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.office-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 3000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}
.office-toast.success { background: #059669; }
.office-toast.error { background: #dc2626; }
.office-toast.info { background: #0284c7; }

/* Dark mode overrides for Office */
body.dark-mode .office-header-title h1 { color: #f1f5f9; }
body.dark-mode .office-card { background: #1e293b; border-color: #334155; }
body.dark-mode .office-card-title { color: #f1f5f9; }
body.dark-mode .office-card-title:hover { color: #818cf8; }
body.dark-mode .office-card-actions { border-top-color: #334155; }
body.dark-mode .office-action-btn { background: #0f172a; color: #cbd5e1; border-color: #334155; }
body.dark-mode .office-action-btn:hover { background: #1e293b; }
body.dark-mode .office-action-btn.primary { background: #312e81; color: #c7d2fe; border-color: #4338ca; }
body.dark-mode .office-action-btn.danger { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
body.dark-mode .office-type-tabs { background: #0f172a; }
body.dark-mode .office-tab { color: #94a3b8; }
body.dark-mode .office-tab.active { background: #1e293b; color: #f1f5f9; }
body.dark-mode .office-filter-inputs input { background: #0f172a; color: #f1f5f9; border-color: #334155; }
body.dark-mode .office-tag-chip { background: #0f172a; border-color: #334155; color: #cbd5e1; }
body.dark-mode .office-tag { background: #334155; color: #cbd5e1; }
body.dark-mode .office-empty { background: #1e293b; border-color: #334155; }
body.dark-mode .office-dropdown-content { background-color: #1e293b; border-color: #334155; }
body.dark-mode .office-dropdown-content a { color: #f1f5f9; }
body.dark-mode .office-dropdown-content a:hover { background-color: #334155; }
body.dark-mode .office-editor-toolbar { background: #0f172a; border-bottom-color: #334155; }
body.dark-mode .office-back-btn { background: #1e293b; color: #cbd5e1; border-color: #334155; }
body.dark-mode .office-back-btn:hover { background: #334155; color: #ffffff; }
body.dark-mode .office-editable-title { color: #f1f5f9; }
body.dark-mode .office-editable-title:hover { background: #1e293b; border-color: #334155; }
body.dark-mode .office-btn-secondary { background: #1e293b; color: #cbd5e1; border-color: #334155; }
body.dark-mode .office-btn-secondary:hover { background: #334155; color: #ffffff; }
body.dark-mode .office-btn-suite { background: #1e293b; color: #cbd5e1; border-color: #334155; }
body.dark-mode .office-btn-suite:hover { background: #334155; color: #ffffff; }






