/* ============================================================================
   Notes Workspace - Clean, modern note-taking UX
   ============================================================================ */

:root {
    --notes-tool-preview-width: var(--canvas-markdown-preview-width, 50vw);
}

.notes-tool-preview-panel {
    width: clamp(
        var(--canvas-markdown-preview-min-width, 420px),
        var(--notes-tool-preview-width),
        calc(100vw - var(--canvas-markdown-preview-min-main-width, 360px))
    );
}

body.notes-tool-preview-open .main-container {
    margin-right: clamp(
        var(--canvas-markdown-preview-min-width, 420px),
        var(--notes-tool-preview-width),
        calc(100vw - var(--canvas-markdown-preview-min-main-width, 360px))
    );
    transition: margin-right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

body.notes-tool-preview-resizing {
    cursor: col-resize;
    user-select: none;
}

body.notes-tool-preview-resizing .main-container,
body.notes-tool-preview-resizing .notes-tool-preview-panel {
    transition: none !important;
}

.notes-tool-preview-panel .notes-tool-editor {
    min-height: calc(100vh - 96px);
}

.notes-tool-preview-download-controls {
    flex: 0 0 auto;
}

.notes-tool-preview-download-btn svg {
    width: 18px;
    height: 18px;
}

.notes-tool-preview-copy-btn svg {
    width: 18px;
    height: 18px;
}

.notes-tool-preview-download-btn.is-busy {
    cursor: wait;
}

.notes-tool-result-widget .canvas-markdown-result-icon svg,
.notes-tool-result-open-btn svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 900px) {
    .notes-tool-preview-panel {
        width: 100vw;
        min-width: 0;
    }

    body.notes-tool-preview-open .main-container {
        margin-right: 0;
    }

    .notes-tool-preview-resizer {
        display: none;
    }
}

/* ============================================================================
   Sidebar - Notes List
   ============================================================================ */
/* Search Bar */
/* Search Results State */
.notes-search-results-header {
    margin: 0 8px 8px;
}

/* Note List Item in Sidebar */
.notes-list-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
    margin-bottom: 2px;
    position: relative;
}

@media (hover: hover) and (pointer: fine) {
    .notes-list-item:hover {
        background: var(--hover);
    }
}

.notes-list-item:focus {
    outline: none;
}

.notes-list-item:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.notes-list-item.active {
    background: var(--primary-light);
}

.notes-list-item.active .notes-list-item-title {
    color: var(--primary-color);
}

.notes-list-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notes-list-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    line-height: 1.3;
}

.notes-list-item-preview {
    font-size: 12px;
    color: var(--text-color-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    line-height: 1.4;
}

.notes-list-item-date {
    font-size: 11px;
    color: var(--text-color-tertiary);
    margin: 2px 0 0;
}

/* Menu button */
.notes-list-item-menu-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-color-tertiary);
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.notes-list-item-menu-btn:focus {
    opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
    .notes-list-item:hover .notes-list-item-menu-btn {
        opacity: 1;
    }
}
@media (hover: none), (pointer: coarse) {
    .notes-list-item .notes-list-item-menu-btn {
        opacity: 1;
    }
}

@media (hover: hover) and (pointer: fine) {
    .notes-list-item-menu-btn:hover {
        background: var(--border-color);
        color: var(--text-color);
    }
}

.notes-list-item-menu-btn svg {
    width: 14px;
    height: 14px;
}

/* Sidebar Loading Skeleton */
.notes-sidebar-skeleton {
    padding: 8px;
}

.notes-skeleton-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    margin-bottom: 4px;
}

.notes-skeleton-text {
    height: 14px;
    width: 80%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--hover) 25%, var(--border-color) 50%, var(--hover) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}

.notes-skeleton-date {
    height: 10px;
    width: 40%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--hover) 25%, var(--border-color) 50%, var(--hover) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}

/* Empty State - No Note Selected */
.notes-empty-state {
    flex: 1;
    padding: 48px 32px;
    max-width: 400px;
    margin: 0 auto;
}

/* Empty State - No Notes Yet */
.notes-no-notes-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 56px 32px;
    text-align: center;
    max-width: 520px;
    margin: 0 auto;
    animation: fadeInUp10 0.3s ease;
}

.notes-no-notes-illustration {
    position: relative;
    width: 220px;
    height: 200px;
}

.notes-no-notes-sheets {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.notes-no-notes-sheet {
    width: 120px;
    height: 150px;
    border-radius: 18px;
    background: var(--surface, #fff);
    box-shadow: 0 20px 35px rgba(15, 23, 42, 0.08);
    transform-origin: bottom center;
    opacity: 0.8;
}

.notes-no-notes-sheet.primary {
    position: relative;
    background: linear-gradient(145deg, rgba(var(--primary-rgb, 59,130,246), 0.08), rgba(var(--primary-rgb, 59,130,246), 0.02));
    transform: rotate(-3deg) translateY(-8px);
}

.notes-no-notes-sheet.primary span {
    display: block;
    height: 6px;
    margin: 16px 18px;
    border-radius: 999px;
    background: rgba(var(--primary-rgb, 59,130,246), 0.15);
    animation: notes-no-notes-shimmer 3s ease-in-out infinite;
}

.notes-no-notes-sheet.primary span:nth-child(2) {
    width: 60%;
}

.notes-no-notes-sheet.primary span:nth-child(3) {
    width: 40%;
}

.notes-no-notes-sheet.secondary {
    transform: rotate(8deg) translate(18px, 16px);
    opacity: 0.6;
}

.notes-no-notes-sheet.tertiary {
    transform: rotate(-12deg) translate(-20px, 20px);
    opacity: 0.4;
}

.notes-no-notes-pencil {
    position: absolute;
    bottom: 10px;
    right: 18px;
    width: 120px;
    height: 18px;
    display: flex;
    align-items: center;
    transform: rotate(6deg);
    filter: drop-shadow(0 12px 24px rgba(15, 23, 42, 0.18));
}

.notes-no-notes-pencil-body {
    flex: 1;
    height: 12px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark, var(--primary-color)));
    border-radius: 999px 0 0 999px;
}

.notes-no-notes-pencil-tip {
    width: 28px;
    height: 18px;
    background: #facc15;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.notes-no-notes-sparkles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.notes-no-notes-sparkles span {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(var(--primary-rgb, 59,130,246), 0.4);
    border-radius: 50%;
    animation: notes-no-notes-pulse 3s infinite;
}

.notes-no-notes-sparkles span:nth-child(1) {
    top: 20px;
    left: 30px;
    animation-delay: 0.2s;
}

.notes-no-notes-sparkles span:nth-child(2) {
    top: 40px;
    right: 40px;
    animation-delay: 0.6s;
}

.notes-no-notes-sparkles span:nth-child(3) {
    bottom: 30px;
    left: 50px;
    animation-delay: 1s;
}

.notes-no-notes-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notes-no-notes-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

.notes-no-notes-text {
    font-size: 15px;
    color: var(--text-color-secondary);
    margin: 0;
    line-height: 1.6;
}

.notes-no-notes-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    background: radial-gradient(circle at top left, var(--primary-color), var(--primary-dark, var(--primary-color)));
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 18px 28px rgba(var(--primary-rgb, 59,130,246), 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .notes-no-notes-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 22px 32px rgba(var(--primary-rgb, 59,130,246), 0.35);
    }
}

.notes-no-notes-btn svg {
    width: 20px;
    height: 20px;
}

/* ============================================================================
   Editor View
   ============================================================================ */
.notes-editor-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notes-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    min-height: 48px;
}

/* Save Status Indicator */
.notes-save-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-color-tertiary);
    transition: all 0.2s ease;
}

.notes-save-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.notes-save-status.saving .notes-save-status-indicator {
    background: var(--pending);
    animation: notes-pulse 1s ease-in-out infinite;
}

.notes-save-status.saved .notes-save-status-indicator {
    background: var(--success-color, #22c55e);
}

.notes-save-status.error .notes-save-status-indicator {
    background: var(--error-color);
}

.notes-save-status.loading .notes-save-status-indicator {
    background: var(--primary-color);
    animation: notes-pulse 1s ease-in-out infinite;
}

.notes-save-status.loading {
    color: var(--primary-color);
}

.notes-save-status.saving {
    color: var(--pending);
}

.notes-save-status.saved {
    color: var(--success-color, #22c55e);
}

.notes-save-status.error {
    color: var(--error-color);
}

.notes-editor-shell {
    flex: 1;
    min-height: 0;
    display: flex;
}

.notes-editor-pane {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--background-color);
    overflow: hidden;
}

.notes-editor-view-toggle {
    flex: 0 0 auto;
}

.notes-editor-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--background-color);
    color: var(--text-color);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .notes-editor-toolbar-btn:hover {
        transform: translateY(-1px);
        border-color: var(--primary-color);
        background: color-mix(in srgb, var(--background-color) 86%, var(--primary-light) 14%);
    }
}

.notes-editor-toolbar-btn svg {
    width: 16px;
    height: 16px;
}

.notes-markdown-editor-host {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--background-color);
}

.notes-markdown-editor-host.is-loading {
    opacity: 0.72;
    cursor: wait;
}

.notes-markdown-editor {
    flex: 1;
    min-height: 0;
    width: 100%;
}

.notes-markdown-editor .canvas-md-editor-body {
    min-height: 0;
}

.notes-markdown-editor .canvas-md-rich-editor {
    padding: 26px clamp(18px, 3vw, 44px) 28vh;
}

.notes-markdown-editor.canvas-md-editor-shell.is-readonly .canvas-md-rich-editor {
    padding: 26px clamp(18px, 3vw, 44px) 28vh;
}

.notes-editor-textarea {
    flex: 1;
    width: 100%;
    height: 100%;
    padding: 0;
    font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-color);
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    overflow-y: auto;
}

.notes-editor-textarea::placeholder {
    color: var(--text-color-tertiary);
}

.notes-editor-textarea.loading {
    opacity: 0.6;
    cursor: wait;
}

.notes-editor-textarea.error {
    border: 1px solid var(--error-color);
    border-radius: 8px;
    padding: 12px;
}

.notes-preview-empty {
    color: var(--text-color-tertiary);
    font-style: italic;
}

.notes-attachments-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 18px 18px;
}

.notes-attachment-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--hover);
    border: 1px solid var(--border-color);
    color: var(--text-color-secondary);
    font-size: 12px;
}

.notes-attachment-pill svg {
    width: 14px;
    height: 14px;
    color: var(--primary-color);
}

.notes-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, color-mix(in srgb, var(--hover) 72%, transparent), transparent);
}

.notes-preview-title {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.notes-preview-subtitle {
    margin: 0;
    font-size: 12px;
    color: var(--text-color-tertiary);
}

.notes-preview-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 22px;
    background: var(--background-color);
}

.notes-preview-body img {
    display: block;
    max-width: 100%;
    border-radius: 14px;
}

.notes-preview-body .notes-inline-media {
    margin: 1rem 0;
}

.notes-preview-body .notes-inline-media figcaption {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-color-tertiary);
}

.notes-preview-body .notes-inline-audio-player {
    width: 100%;
}

.notes-preview-body .notes-embedded-file-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    margin: 14px 0;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--hover) 84%, transparent), color-mix(in srgb, var(--background-color) 86%, var(--primary-light) 14%));
}

.notes-preview-body .notes-embedded-file-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.notes-preview-body .notes-embedded-file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--primary-color);
    flex-shrink: 0;
}

.notes-preview-body .notes-embedded-file-copy {
    min-width: 0;
}

.notes-preview-body .notes-embedded-file-name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    word-break: break-word;
}

.notes-preview-body .notes-embedded-file-kind {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-color-tertiary);
    text-transform: capitalize;
}

.notes-preview-body .notes-embedded-file-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.notes-preview-body .notes-embedded-file-link svg {
    width: 14px;
    height: 14px;
}

.notes-preview-body .notes-preview-placeholder {
    color: var(--text-color-tertiary);
    font-size: 14px;
}

.notes-preview-body .notes-preview-missing-file {
    padding: 12px 14px;
    margin: 14px 0;
    border-radius: 14px;
    border: 1px dashed color-mix(in srgb, var(--error-color) 55%, var(--border-color));
    color: var(--error-color);
    background: color-mix(in srgb, var(--error-color) 9%, transparent);
}

.notes-editor-textarea::-webkit-scrollbar {
    width: 6px;
}

.notes-editor-textarea::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.notes-mobile-back-btn {
    color: var(--primary-color);
}

/* ============================================================================
   Responsive Design - Mobile Sub-Sidebar Pattern
   ============================================================================ */
@media (max-width: 768px) {
    /* Adjust editor header for back button */
    .notes-editor-header {
        padding: 8px 12px;
    }

    .notes-editor-shell {
        display: flex;
    }

    .notes-empty-state {
        padding: 32px 20px;
    }

    /* No notes state adjustments for mobile */
    .notes-no-notes-state {
        padding: 40px 20px;
    }

    .notes-no-notes-illustration {
        width: 180px;
        height: 160px;
    }

    .notes-no-notes-title {
        font-size: 20px;
    }

    .notes-no-notes-text {
        font-size: 14px;
    }

    /* Empty state should also slide in on mobile */
    .notes-empty-state {
        position: absolute;
        inset: 0;
        max-width: none;
        margin: 0;
        padding: 40px 20px;
    }
     }

/* ============================================================================
   Sharing Styles
   ============================================================================ */

/* Subscribed note indicator */
.notes-list-item.subscribed {
    border-left: 3px solid #10b981;
}

.notes-subscribed-badge {
    display: inline;
    font-size: 10px;
    font-weight: 400;
    color: #10b981;
    margin-left: 6px;
}

.notes-dropdown-button-shared {
    color: var(--primary-color);
}

.notes-dropdown-button-shared svg {
    color: var(--primary-color);
}

/* Share type badge in sidebar */
.notes-share-type-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 1px 4px;
    border-radius: 4px;
    margin-left: 4px;
    letter-spacing: 0.3px;
}

.notes-share-type-badge.live {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.notes-share-type-badge.collaborate {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.notes-can-edit-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 500;
    padding: 1px 4px;
    border-radius: 4px;
    margin-left: 4px;
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

/* Read-only textarea state */
.notes-editor-textarea.readonly {
    color: var(--text-color-secondary);
    cursor: default;
}

.notes-file-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 1120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.56);
    backdrop-filter: blur(6px);
}

.notes-file-picker-overlay[hidden] {
    display: none;
}

.notes-file-picker-modal {
    width: min(920px, 100%);
    max-width: 920px;
    max-height: min(82vh, 880px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 24px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    box-shadow: 0 34px 80px rgba(15, 23, 42, 0.26);
}

.notes-file-picker-header,
.notes-file-picker-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
}

.notes-file-picker-footer {
    border-top: 1px solid var(--border-color);
    border-bottom: none;
    justify-content: flex-end;
}

.notes-file-picker-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--text-color-tertiary);
}

.notes-file-picker-close,
.notes-file-picker-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--background-color);
    color: var(--text-color);
    cursor: pointer;
}

.notes-file-picker-close svg,
.notes-file-picker-upload-btn svg {
    width: 16px;
    height: 16px;
}

.notes-file-picker-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px 10px;
}

.notes-file-picker-toolbar input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--hover);
    color: var(--text-color);
    outline: none;
}

.notes-file-picker-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 22px 10px;
    flex-wrap: wrap;
}

.notes-file-picker-filter {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--background-color);
    color: var(--text-color-secondary);
    cursor: pointer;
}

.notes-file-picker-filter.active {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-color);
}

.notes-file-picker-status {
    padding: 0 22px 10px;
    font-size: 12px;
    color: var(--text-color-tertiary);
}

.notes-file-picker-list {
    flex: 1;
    min-height: 220px;
    overflow-y: auto;
    padding: 0 22px 18px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.notes-file-picker-empty {
    padding: 24px 22px;
    color: var(--text-color-tertiary);
}

.notes-file-picker-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: color-mix(in srgb, var(--background-color) 85%, var(--hover) 15%);
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .notes-file-picker-item:hover {
        transform: translateY(-1px);
        border-color: color-mix(in srgb, var(--primary-color) 50%, var(--border-color));
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    }
}

.notes-file-picker-item.selected {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-light) 52%, var(--background-color) 48%);
}

.notes-file-picker-item-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notes-file-picker-item-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--hover);
    color: var(--primary-color);
    flex-shrink: 0;
}

.notes-file-picker-item-icon svg {
    width: 18px;
    height: 18px;
}

.notes-file-picker-item-name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    word-break: break-word;
}

.notes-file-picker-item-meta {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-color-tertiary);
}

.notes-file-picker-item-check {
    margin-left: auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    background: transparent;
    flex-shrink: 0;
}

.notes-file-picker-item.selected .notes-file-picker-item-check {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.notes-recording-overlay {
    position: fixed;
    inset: 0;
    z-index: 1130;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(8px);
}

.notes-recording-overlay[hidden] {
    display: none;
}

.notes-recording-modal {
    width: min(680px, 100%);
    max-width: 680px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 24px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    box-shadow: 0 34px 80px rgba(15, 23, 42, 0.28);
}

.notes-recording-header,
.notes-recording-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px;
}

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

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

.notes-recording-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--text-color-tertiary);
}

.notes-recording-close,
.notes-recording-footer-btn,
.notes-recording-source-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    background: var(--background-color);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.notes-recording-close {
    width: 42px;
    height: 42px;
    border-radius: 12px;
}

.notes-recording-close svg {
    width: 18px;
    height: 18px;
}

.notes-recording-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px;
}

.notes-recording-source-switch {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.notes-recording-source-btn {
    padding: 12px 14px;
    border-radius: 16px;
    font-weight: 600;
}

.notes-recording-source-btn svg {
    width: 18px;
    height: 18px;
}

.notes-recording-source-btn.active {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-light) 55%, var(--background-color) 45%);
    color: var(--primary-color);
}

.notes-recording-source-btn:disabled,
.notes-recording-footer-btn:disabled,
.notes-recording-close:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
}

.notes-recording-status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid color-mix(in srgb, var(--primary-color) 25%, var(--border-color));
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-light) 46%, transparent), color-mix(in srgb, var(--hover) 75%, transparent));
}

.notes-recording-status-label {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-color);
}

.notes-recording-status-details {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-color-secondary);
}

.notes-recording-timer {
    min-width: 92px;
    padding: 12px 14px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--background-color) 72%, white 28%);
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    color: var(--text-color);
}

.notes-recording-preview {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--background-color) 88%, var(--hover) 12%);
}

.notes-recording-preview-name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

.notes-recording-preview-meta {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-color-tertiary);
}

.notes-recording-preview-audio {
    width: 100%;
}

.notes-recording-footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.notes-recording-footer-btn {
    padding: 10px 16px;
    border-radius: 14px;
    font-weight: 600;
}

.notes-recording-footer-btn.primary {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: var(--button-text);
}

.notes-recording-footer-btn.secondary {
    color: var(--text-color-secondary);
}

@media (hover: hover) and (pointer: fine) {
    .notes-recording-footer-btn:not(:disabled):hover, .notes-recording-source-btn:not(:disabled):hover, .notes-recording-close:not(:disabled):hover {
        transform: translateY(-1px);
        border-color: color-mix(in srgb, var(--primary-color) 50%, var(--border-color));
    }
}

@media (max-width: 640px) {
    .notes-recording-overlay {
        padding: 16px;
    }

    .notes-recording-modal {
        max-height: calc(100vh - 32px);
    }

    .notes-recording-header,
    .notes-recording-footer,
    .notes-recording-body {
        padding: 18px;
    }

    .notes-recording-status-card,
    .notes-recording-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .notes-recording-timer {
        width: 100%;
    }

    .notes-recording-footer-actions {
        width: 100%;
        flex-direction: column-reverse;
    }

    .notes-recording-footer-btn {
        width: 100%;
    }
     }

/* Read-only indicator */
.notes-readonly-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-color-tertiary);
    padding: 4px 10px;
    background: var(--hover);
    border-radius: 6px;
    margin-right: auto;
}

.notes-readonly-indicator svg {
    width: 14px;
    height: 14px;
}

/* Readonly save status */
.notes-save-status.readonly .notes-save-status-indicator {
    background: var(--text-color-tertiary);
}

.notes-save-status.readonly {
    color: var(--text-color-tertiary);
}

/* ============================================================================
   New Share Modal Styles
   ============================================================================ */

.notes-share-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    padding: 16px;
}

.notes-share-overlay[hidden] {
    display: none;
}

.notes-share-overlay.active {
    opacity: 1;
    visibility: visible;
}

.notes-share-modal {
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 32px);
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 28px 72px rgba(15, 23, 42, 0.22);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.2s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notes-share-overlay.active .notes-share-modal {
    transform: scale(1) translateY(0);
}

.notes-share-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.notes-share-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.notes-share-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--text-color-tertiary);
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .notes-share-modal-close:hover {
        background: var(--hover);
        color: var(--text-color);
    }
}

.notes-share-modal-close svg {
    width: 18px;
    height: 18px;
}

.notes-share-modal-body {
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
}

.notes-share-modal-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color-secondary);
    margin: 0;
    padding: 0;
    background: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notes-share-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 8px;
}

/* Share Type Select */
.notes-share-type-section {
    display: flex;
    flex-direction: column;
}

.notes-share-type-select-wrapper {
    position: relative;
}

.notes-share-type-select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    appearance: none;
    transition: all 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .notes-share-type-select:hover {
        border-color: var(--primary-color);
    }
}

.notes-share-type-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 59, 130, 246), 0.15);
}

.notes-share-select-arrow {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-color-tertiary);
    pointer-events: none;
}

/* Can Edit Toggle Section */
.notes-share-edit-toggle-section {
    padding: 16px;
    background: var(--hover);
    border-radius: 12px;
}

.notes-share-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.notes-share-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notes-share-toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

.notes-share-toggle-desc {
    font-size: 12px;
    color: var(--text-color-tertiary);
}

/* Toggle Switch */
.notes-share-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.notes-share-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.notes-share-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border-color);
    border-radius: 28px;
    transition: all 0.2s ease;
}

.notes-share-toggle-slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.notes-share-toggle input:checked + .notes-share-toggle-slider {
    background: var(--primary-color);
}

.notes-share-toggle input:checked + .notes-share-toggle-slider::before {
    transform: translateX(20px);
}

.notes-share-toggle input:focus + .notes-share-toggle-slider {
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 59, 130, 246), 0.15);
}

/* Share Type Description */
.notes-share-type-desc {
    padding: 12px 16px;
    background: rgba(var(--primary-rgb, 59, 130, 246), 0.08);
    border-radius: 10px;
    border-left: 3px solid var(--primary-color);
}

.notes-share-type-desc p {
    margin: 0;
    font-size: 13px;
    color: var(--text-color-secondary);
    line-height: 1.5;
}

/* Generate Link Section */
.notes-share-link-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notes-share-generate-btn {
    width: 100%;
}

.notes-share-generate-btn svg {
    width: 18px;
    height: 18px;
}

.notes-share-link-container {
    display: flex;
    gap: 8px;
}

.notes-share-link-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-color);
    background: var(--hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    outline: none;
    min-width: 0;
}

.notes-share-link-input:focus {
    border-color: var(--primary-color);
}

.notes-share-copy-btn svg {
    width: 16px;
    height: 16px;
}

/* Active Shares Section */
.notes-share-active-section {
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.notes-share-active-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notes-share-active-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--hover);
    border-radius: 10px;
}

.notes-share-active-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notes-share-active-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color);
}

.notes-share-active-count {
    font-size: 11px;
    color: var(--text-color-tertiary);
}

.notes-share-active-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.notes-share-active-copy,
.notes-share-active-delete,
.notes-share-active-remove {
    width: 32px;
    height: 32px;
    padding: 0;
}

.notes-share-active-copy svg,
.notes-share-active-delete svg,
.notes-share-active-remove svg {
    width: 16px;
    height: 16px;
}

/* Accept Modal Share Type Info */
.note-accept-share-type {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid;
    margin-bottom: 12px;
}

.note-accept-share-type-label {
    font-size: 13px;
    font-weight: 600;
}

.note-accept-share-type-desc {
    font-size: 12px;
    color: var(--text-color-secondary);
    line-height: 1.4;
}

/* Animation for loading spinner */

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Mobile responsiveness for share modal */
@media (max-width: 480px) {
    .notes-share-modal {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 90vh;
        overflow-y: auto;
    }

    .notes-share-modal-body {
        padding: 20px;
    }

    .notes-share-link-container {
        flex-direction: column;
    }

    .notes-share-copy-btn {
        justify-content: center;
    }
     }

/* ============================================================================
   Share Mode Toggle (Link / Invitation)
   ============================================================================ */

.notes-share-mode-toggle {
    display: flex;
    gap: 8px;
    background: var(--hover);
    padding: 4px;
    border-radius: 10px;
}

.notes-share-mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-color-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notes-share-mode-btn svg {
    width: 18px;
    height: 18px;
}

@media (hover: hover) and (pointer: fine) {
    .notes-share-mode-btn:hover {
        color: var(--text-color);
    }
}

.notes-share-mode-btn.active {
    background: var(--background-color);
    color: var(--text-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.notes-share-mode-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.notes-share-mode-content[hidden] {
    display: none !important;
}

/* ============================================================================
   Invite Users Section
   ============================================================================ */

.notes-share-invite-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notes-share-user-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.notes-share-user-search:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.notes-share-user-search svg {
    width: 18px;
    height: 18px;
    color: var(--text-color-secondary);
    flex-shrink: 0;
}

.notes-share-user-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--text-color);
    outline: none;
}

.notes-share-user-search-input::placeholder {
    color: var(--text-color-secondary);
}

.notes-share-user-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--background-color);
}

.notes-share-user-loading,
.notes-share-user-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-color-secondary);
    font-size: 14px;
}

.notes-share-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-color);
}

.notes-share-user-item:last-child {
    border-bottom: none;
}

@media (hover: hover) and (pointer: fine) {
    .notes-share-user-item:hover {
        background: var(--hover);
    }
}

.notes-share-user-item.selected {
    background: rgba(var(--primary-color-rgb), 0.08);
}

.notes-share-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-color-dark, var(--primary-color)));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.notes-share-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notes-share-user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notes-share-user-username {
    font-size: 12px;
    color: var(--text-color-secondary);
}

.notes-share-user-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.notes-share-user-check svg {
    width: 12px;
    height: 12px;
    opacity: 0;
    color: white;
    transition: opacity 0.15s ease;
}

.notes-share-user-item.selected .notes-share-user-check {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.notes-share-user-item.selected .notes-share-user-check svg {
    opacity: 1;
}

/* Selected Users Tags */
.notes-share-selected-users {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notes-share-selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.notes-share-selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
}

.notes-share-selected-remove {
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .notes-share-selected-remove:hover {
        opacity: 1;
    }
}
@media (hover: none), (pointer: coarse) {
    .notes-share-selected-remove {
        opacity: 1;
    }
}

.notes-share-selected-remove svg {
    width: 12px;
    height: 12px;
}

/* Invite Button */
.notes-share-invite-actions {
    margin-top: 8px;
}

.notes-share-invite-btn {
    width: 100%;
}

.notes-share-invite-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================================================
   Editor Header Actions
   ============================================================================ */
.notes-editor-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notes-download-controls {
    flex: 0 0 auto;
}

.notes-download-btn svg {
    width: 18px;
    height: 18px;
}

.notes-download-btn.is-busy {
    cursor: wait;
}

.notes-history-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-color-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .notes-history-btn:hover {
        background: var(--hover);
        color: var(--primary-color);
    }
}

.notes-history-btn svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 640px) {
    .notes-editor-header-actions {
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
    }
}

/* ============================================================================
   Version History Panel
   ============================================================================ */
.notes-history-panel {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.notes-history-panel[hidden] {
    display: none;
}

.notes-history-panel.active {
    opacity: 1;
    visibility: visible;
}

.notes-history-container {
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    max-height: 700px;
    background: var(--background-color);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.notes-history-panel.active .notes-history-container {
    transform: scale(1);
}

.notes-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--hover);
}

.notes-history-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notes-history-title svg {
    width: 22px;
    height: 22px;
    color: var(--primary-color);
}

.notes-history-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.notes-history-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-color-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .notes-history-close:hover {
        background: var(--hover);
        color: var(--text-color);
    }
}

.notes-history-close svg {
    width: 18px;
    height: 18px;
}

.notes-history-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* History List Section */
.notes-history-list-section {
    width: 320px;
    min-width: 280px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--background-color);
}

.notes-history-list-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.notes-history-count {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color-secondary);
}

.notes-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* History Item */
.notes-history-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
    margin-bottom: 4px;
}

@media (hover: hover) and (pointer: fine) {
    .notes-history-item:hover {
        background: var(--hover);
    }
}

.notes-history-item.active {
    background: rgba(var(--primary-color-rgb, 59, 130, 246), 0.1);
}

.notes-history-item-timeline {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 16px;
    flex-shrink: 0;
}

.notes-history-item-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--background-color);
    flex-shrink: 0;
}

.notes-history-item-dot.current {
    background: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb, 59, 130, 246), 0.2);
}

.notes-history-item-line {
    flex: 1;
    width: 2px;
    background: var(--border-color);
    margin-top: 4px;
    min-height: 20px;
}

.notes-history-item-content {
    flex: 1;
    min-width: 0;
}

.notes-history-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.notes-history-item-version {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color);
}

.notes-history-item.latest .notes-history-item-version {
    color: var(--primary-color);
}

.notes-history-item-time {
    font-size: 12px;
    color: var(--text-color-tertiary);
}

.notes-history-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.notes-history-item-user {
    display: flex;
    align-items: center;
    gap: 6px;
}

.notes-history-item-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    color: white;
    font-size: 9px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notes-history-item-user span {
    font-size: 12px;
    color: var(--text-color-secondary);
}

.notes-history-item-date {
    font-size: 11px;
    color: var(--text-color-tertiary);
}

.notes-history-item-summary {
    font-size: 12px;
    color: var(--text-color-tertiary);
    padding: 4px 8px;
    background: var(--hover);
    border-radius: 6px;
    display: inline-block;
}

/* Preview Section */
.notes-history-preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--hover);
}

.notes-history-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--background-color);
}

.notes-history-preview-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notes-history-preview-version {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

.notes-history-preview-user {
    font-size: 12px;
    color: var(--text-color-secondary);
}

.notes-history-preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notes-history-restore-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .notes-history-restore-btn:hover:not(:disabled) {
        filter: brightness(1.1);
    }
}

.notes-history-restore-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.notes-history-restore-btn svg {
    width: 16px;
    height: 16px;
}

.notes-history-preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.notes-history-preview-text {
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    background: var(--background-color);
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.notes-history-preview-empty,
.notes-history-preview-loading,
.notes-history-preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--text-color-tertiary);
}

.notes-history-preview-empty svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.notes-history-preview-empty p,
.notes-history-preview-error p {
    margin: 0;
    font-size: 14px;
}

/* Diff Section */
.notes-history-diff-section {
    border-top: 1px solid var(--border-color);
    background: var(--background-color);
}

.notes-history-diff-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
}

.notes-history-diff-header span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color);
}

.notes-history-diff-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-color-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .notes-history-diff-toggle:hover {
        background: var(--hover);
    }
}

.notes-history-diff-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.notes-history-diff-toggle.collapsed svg {
    transform: rotate(-90deg);
}

.notes-history-diff-content {
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    font-family: monospace;
    font-size: 12px;
}

.notes-history-diff-content.collapsed {
    display: none;
}

.notes-diff-line {
    display: flex;
    padding: 2px 8px;
    border-radius: 4px;
}

.notes-diff-line.added {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.notes-diff-line.removed {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.notes-diff-line.unchanged {
    color: var(--text-color-tertiary);
}

.notes-diff-marker {
    width: 16px;
    font-weight: 600;
    flex-shrink: 0;
}

.notes-diff-text {
    white-space: pre-wrap;
    word-break: break-all;
}

.notes-diff-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-color-tertiary);
}

/* Empty & Loading States */
.notes-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-color-tertiary);
}

.notes-history-empty svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
    margin-bottom: 12px;
}

.notes-history-empty p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color-secondary);
}

.notes-history-empty span {
    font-size: 13px;
    margin-top: 4px;
}

.notes-history-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 12px;
    color: var(--text-color-tertiary);
}

.notes-history-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spinTo360 0.8s linear infinite;
}

.notes-history-spinner.small {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .notes-history-container {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }

    .notes-history-body {
        flex-direction: column;
    }

    .notes-history-list-section {
        width: 100%;
        min-width: auto;
        max-height: 40%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .notes-history-preview-section {
        flex: 1;
        min-height: 0;
    }
     }

/* ============================================================================
   Additional Share Modal Elements (Stop Button, Accept Modal)
   ============================================================================ */

/* Stop/Remove Link Button */
.notes-share-stop-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    color: var(--error-color, #ef4444);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .notes-share-stop-btn:hover {
        background: rgba(239, 68, 68, 0.1);
        border-color: rgba(239, 68, 68, 0.5);
    }
}

.notes-share-stop-btn svg {
    width: 16px;
    height: 16px;
}

/* Accept Modal Elements */
.note-accept-info {
    text-align: center;
    padding-bottom: 16px;
}

.note-accept-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 4px 0;
}

.note-accept-owner {
    font-size: 14px;
    color: var(--text-color-secondary);
    margin: 0;
}

.note-accept-preview {
    margin-top: 8px;
}

.note-accept-preview-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 0;
}

.note-accept-preview-content {
    padding: 16px;
    background: var(--hover);
    border-radius: 10px;
    max-height: 150px;
    overflow-y: auto;
}

.note-accept-preview-content p {
    margin: 0;
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Accept Modal Actions */
.note-accept-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.note-accept-actions .nav-btn {
    flex: 1;
}

/* Active member styles */
.notes-share-active-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.notes-share-active-type {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--hover);
    color: var(--text-color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.notes-share-active-type.owner {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

/* Selected user chip in invite mode */
.notes-share-selected-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(var(--primary-color-rgb, 59, 130, 246), 0.1);
    color: var(--primary-color);
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
}
