.memo-window {
    position: absolute;
    width: calc(250 * var(--ws-unit, 1px));
    height: calc(200 * var(--ws-unit, 1px));
    z-index: 1020;
    min-width: calc(150 * var(--ws-unit, 1px));
    min-height: calc(100 * var(--ws-unit, 1px));
    --memo-resize-edge: max(4px, calc(4 * var(--ws-unit, 1px)));
    --memo-resize-corner: max(10px, calc(10 * var(--ws-unit, 1px)));
}

.ws-window.workspace-window-active {
    border-color: var(--accent-color);
}

.memo-window.event-document-window {
    position: absolute;
    width: calc(320 * var(--ws-unit, 1px));
    height: calc(480 * var(--ws-unit, 1px));
    min-width: calc(250 * var(--ws-unit, 1px));
    min-height: calc(250 * var(--ws-unit, 1px));
}

.memo-header {
    width: 100%;
    background-color: var(--bg-tertiary);
    cursor: default;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: calc(14 * var(--ws-unit, 1px));
    border-top-left-radius: var(--radius-lg, calc(14 * var(--ws-unit, 1px)));
    border-top-right-radius: var(--radius-lg, calc(14 * var(--ws-unit, 1px)));
    padding: calc(6 * var(--ws-unit, 1px)) calc(10 * var(--ws-unit, 1px));
    box-sizing: border-box;
    user-select: none;
    flex-shrink: 0;
}


.memo-header p {
    margin: 0;
    padding: calc(2 * var(--ws-unit, 1px)) calc(4 * var(--ws-unit, 1px));
    border-radius: var(--radius-sm, calc(6 * var(--ws-unit, 1px)));
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    flex: 0 1 auto;
    width: max-content;
    min-width: 0;
    max-width: calc(220 * var(--ws-unit, 1px));
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: calc(1 * var(--ws-unit, 1px)) solid transparent;
    cursor: text;
}

.memo-header p:hover {
    border: calc(1 * var(--ws-unit, 1px)) solid var(--border-color-hover, rgba(255, 255, 255, 0.24));
}

.memo-header p:focus {
    outline: none;
    background-color: var(--theme-surface-main, #191919);
    border: calc(1 * var(--ws-unit, 1px)) solid var(--theme-border, #505050);
    text-overflow: clip;
    overflow-x: auto;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.memo-header p:focus::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

.memo-header p:empty::before {
    content: "제목";
    color: var(--theme-text-muted, gray);
    cursor: text;
}

.memo-controls {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: calc(8 * var(--ws-unit, 1px));
}

.memo-controls,
.memo-list-controls,
.new_event_icons_w {
    --window-control-icon-filter: brightness(0) invert(62.745098%);
    --window-control-icon-hover-filter: brightness(0) invert(87.843137%);
}

.memo-control-icon,
.new_event_icon_w {
    display: block;
    flex: 0 0 calc(16 * var(--ws-unit, 1px));
    width: calc(16 * var(--ws-unit, 1px));
    height: calc(16 * var(--ws-unit, 1px));
    object-fit: contain;
    cursor: pointer;
    opacity: 1;
    filter: var(--window-control-icon-filter);
    transition: filter var(--duration-fast);
}

.memo-control-icon:is(:hover, :focus-visible),
.new_event_icon_w:is(:hover, :focus-visible) {
    --window-control-icon-filter: var(--window-control-icon-hover-filter);
}

.window-controls-extra {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: inherit;
}
.window-controls-close { flex-shrink: 0; }
.window-controls-header {
    /* 펼침 패널의 내부 너비가 부모 창의 최소 너비로 전달되지 않게 한다. */
    contain: inline-size;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}
.window-controls-compact { position: relative; }
.window-controls-compact .window-controls-group {
    position: relative;
    /* 펼치기 전후 모두 X 버튼 한 칸만 헤더 배치에 참여한다. */
    flex: 0 0 var(--window-controls-close-width, calc(16 * var(--ws-unit, 1px)));
    width: var(--window-controls-close-width, calc(16 * var(--ws-unit, 1px)));
    min-width: 0;
    max-width: var(--window-controls-close-width, calc(16 * var(--ws-unit, 1px)));
    z-index: 21;
}
/* 하나의 블러 면을 닫기 버튼까지 이어 주고 헤더 하단 테두리는 남긴다. */
.window-controls-compact .window-controls-group::before {
    content: '';
    position: absolute;
    top: var(--window-controls-header-top);
    right: var(--window-controls-background-right, 0px);
    width: var(--window-controls-background-width);
    height: var(--window-controls-header-height);
    z-index: -1;
    pointer-events: none;
    border: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    -webkit-backdrop-filter: blur(calc(8 * var(--ws-unit, 1px)));
    backdrop-filter: blur(calc(8 * var(--ws-unit, 1px)));
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration-apple, 350ms) var(--ease-apple-fluid),
        visibility 0s linear var(--duration-apple, 350ms);
}
.window-controls-compact .window-controls-extra {
    position: absolute;
    right: calc(100% + 8 * var(--ws-unit, 1px));
    top: var(--window-controls-header-top, calc(-12 * var(--ws-unit, 1px)));
    height: var(--window-controls-header-height, calc(40 * var(--ws-unit, 1px)));
    width: var(--window-controls-extra-width);
    max-width: var(--window-controls-room);
    box-sizing: border-box;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    padding: 0 0 0 calc(8 * var(--ws-unit, 1px));
    border: 0;
    background: transparent;
    border-radius: var(--radius-lg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(calc(4 * var(--ws-unit, 1px)));
    transition: opacity var(--duration-apple, 350ms) var(--ease-apple-fluid),
        transform var(--duration-apple, 350ms) var(--ease-apple-fluid),
        visibility 0s linear var(--duration-apple, 350ms);
}
/* X와 펼친 아이콘 사이에서도 호버가 끊기지 않도록 연결한다. */
.window-controls-compact .window-controls-extra::after {
    content: '';
    position: absolute;
    top: 0;
    left: 100%;
    width: calc(8 * var(--ws-unit, 1px));
    height: 100%;
}
.window-controls-compact .window-controls-group:not([data-controls-dismissed]):is(:hover, :focus-within, [data-controls-open]) .window-controls-extra {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
    transition-delay: 0s;
}
.window-controls-compact .window-controls-group:not([data-controls-dismissed]):is(:hover, :focus-within, [data-controls-open])::before {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}
@media (prefers-reduced-motion: reduce) {
    .window-controls-extra,
    .window-controls-compact .window-controls-group::before { transition: none !important; }
}

.ws-window-minimize-btn {
    appearance: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 calc(16 * var(--ws-unit, 1px));
    width: calc(16 * var(--ws-unit, 1px));
    height: calc(16 * var(--ws-unit, 1px));
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    opacity: 1;
    transition: color var(--duration-fast);
}
.ws-window-minimize-btn::before {
    content: '';
    width: calc(10 * var(--ws-unit, 1px));
    height: calc(1.5 * var(--ws-unit, 1px));
    border-radius: var(--radius-full);
    background: currentColor;
}
.ws-window-minimize-btn:is(:hover, :focus-visible) { color: var(--text-primary); background: transparent; }
.ws-window-minimize-btn:focus-visible { outline: 1px solid var(--accent-color); outline-offset: 2px; }
.workspace-window-minimized {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
.memo-header span {
    font-weight: bold;
}


.memo-content {
    flex-grow: 1;
    padding: 0px calc(10 * var(--ws-unit, 1px)) calc(10 * var(--ws-unit, 1px)) calc(10 * var(--ws-unit, 1px));
    box-sizing: border-box;
    overflow: auto;
    background-color: var(--theme-surface-panel, #2a2a2a);
    border-bottom-left-radius: calc(8 * var(--ws-unit, 1px));
    border-bottom-right-radius: calc(8 * var(--ws-unit, 1px));
    outline: none;
    color: var(--theme-text-primary, #d1d1d1);
}

/* Hide original scrollbar */
.memo-content::-webkit-scrollbar {
    display: none;
}

/* Custom Scrollbar Styles moved to base.css */


.memo-date {
    font-size: var(--font-size-xs);
    color: var(--theme-accent-text, #8B5CF6);
    text-align: right;
    padding: 0 calc(10 * var(--ws-unit, 1px)) 0 calc(10 * var(--ws-unit, 1px));
    /* Changed padding-bottom to 0 */
    user-select: none;
    background-color: var(--theme-surface-panel, #2a2a2a);
    flex-shrink: 0;
}

/* Styles for editable memo date */
.memo-date .date-value {
    cursor: pointer;
    display: inline-block;
    border-radius: calc(4 * var(--ws-unit, 1px));
    transition: background-color 0.2s;
}

.memo-date.editable .date-value {
    background-color: var(--theme-surface-input, #404040);
}

.memo-date.editable .date-value span[data-date-part] {
    padding: calc(2 * var(--ws-unit, 1px));
    border-radius: calc(3 * var(--ws-unit, 1px));
    transition: background-color 0.2s;
}

.memo-date.editable .date-value span[data-date-part]:hover {
    background-color: var(--theme-surface-hover, #555555);
}


.memo-resizer,
.new_event_resizer_w {
    width: calc(10 * var(--ws-unit, 1px));
    height: calc(10 * var(--ws-unit, 1px));
    background: transparent;
    position: absolute;
    right: 0;
    bottom: 0;
    cursor: nwse-resize;
    z-index: 20;
}

/* 다크 모드는 기존 짙은 회색을, 화이트 모드는 흰색을 사용한다. */
.memo-resizer::after,
.new_event_resizer_w::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: calc(10 * var(--ws-unit, 1px));
    height: calc(10 * var(--ws-unit, 1px));
    border-bottom-right-radius: calc(8 * var(--ws-unit, 1px));
    background-color: var(--theme-surface-input, #404040);
    pointer-events: none;
}

html[data-theme="light"] :is(.memo-resizer, .new_event_resizer_w)::after {
    background-color: #ffffff;
}

.memo-window-resize-handle {
    position: absolute;
    z-index: 20;
    touch-action: none;
    user-select: none;
}

.memo-window-resize-handle:is([data-resize-direction="n"], [data-resize-direction="s"]) {
    left: var(--memo-resize-corner);
    right: var(--memo-resize-corner);
    height: var(--memo-resize-edge);
    cursor: ns-resize;
}

.memo-window-resize-handle:is([data-resize-direction="e"], [data-resize-direction="w"]) {
    top: var(--memo-resize-corner);
    bottom: var(--memo-resize-corner);
    width: var(--memo-resize-edge);
    cursor: ew-resize;
}

.memo-window-resize-handle:is([data-resize-direction="ne"], [data-resize-direction="nw"], [data-resize-direction="se"], [data-resize-direction="sw"]) {
    width: var(--memo-resize-corner);
    height: var(--memo-resize-corner);
}

.memo-window-resize-handle:is([data-resize-direction="nw"], [data-resize-direction="se"]) { cursor: nwse-resize; }
.memo-window-resize-handle:is([data-resize-direction="ne"], [data-resize-direction="sw"]) { cursor: nesw-resize; }
.memo-window-resize-handle:is([data-resize-direction="n"], [data-resize-direction="ne"], [data-resize-direction="nw"]) { top: 0; }
.memo-window-resize-handle:is([data-resize-direction="s"], [data-resize-direction="se"], [data-resize-direction="sw"]) { bottom: 0; }
.memo-window-resize-handle:is([data-resize-direction="e"], [data-resize-direction="ne"], [data-resize-direction="se"]) { right: 0; }
.memo-window-resize-handle:is([data-resize-direction="w"], [data-resize-direction="nw"], [data-resize-direction="sw"]) { left: 0; }

/* 오른쪽 테두리와 스크롤바를 각각 잡을 수 있도록 영역을 분리한다. */
.memo-window[data-window-resizable]:not(.full-screen) .custom-scrollbar-track:not(.horizontal-scrollbar) {
    right: var(--memo-resize-edge);
}

.memo-window.memo-window-resizing { transition: none !important; }
.memo-window.memo-window-dragging { transition: none !important; }
.memo-window.memo-window-snapping { transition: none !important; }
.workspace-window-remote-motion {
    transition: left 80ms linear, top 80ms linear, width 80ms linear, height 80ms linear !important;
}
.workspace-window-remote-busy :is([data-window-drag-handle], .memo-window-resize-handle, .new_event_header_controls, .new_event_resizer_w) {
    pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { .workspace-window-remote-motion { transition: none !important; } }
html[data-memo-window-dragging],
html[data-memo-window-dragging] * {
    cursor: grabbing !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.memo-window [data-window-drag-handle] { touch-action: none; }
/* 경로가 펼쳐져 있을 때 가로 터치 스크롤을 유지한다. */
.memo-window .memo-list-header[data-window-drag-handle]:has(.memo-breadcrumb-container.expanded) { touch-action: pan-x; }

.memo-snap-picker {
    position: fixed;
    z-index: 30000;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-md);
    width: max-content;
    padding: var(--spacing-md);
    box-sizing: border-box;
    background-color: var(--bg-secondary);
    border: calc(1 * var(--ws-unit, 1px)) solid var(--border-color-hover);
    border-radius: var(--radius-lg);
    box-shadow: 0 calc(8 * var(--ws-unit, 1px)) calc(24 * var(--ws-unit, 1px)) var(--theme-shadow, rgba(0, 0, 0, .3));
    touch-action: none;
}

.memo-snap-layout {
    position: relative;
    flex: 0 0 calc(72 * var(--ws-unit, 1px));
    width: calc(72 * var(--ws-unit, 1px));
    height: calc(48 * var(--ws-unit, 1px));
}

.memo-snap-region {
    appearance: none;
    position: absolute;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: calc(1 * var(--ws-unit, 1px)) solid var(--border-color-hover);
    border-radius: var(--radius-2xs);
    background-color: var(--bg-hover);
    cursor: grabbing;
}

.memo-snap-region.active {
    background-color: var(--accent-color);
    border-color: var(--accent-hover);
}

.memo-snap-preview {
    position: absolute;
    box-sizing: border-box;
    pointer-events: none;
    border: calc(2 * var(--ws-unit, 1px)) solid var(--accent-color);
    border-radius: var(--radius-lg);
    background-color: rgba(139, 92, 246, .16);
}

.memo-snap-picker[hidden], .memo-snap-preview[hidden] { display: none !important; }

.workspace-window-skeleton {
    display: block;
    width: 70%;
    height: calc(12 * var(--ws-unit, 1px));
    margin-top: var(--spacing-md);
    border-radius: var(--radius-full);
    background: var(--text-muted);
    animation: workspace-window-pulse 1.6s ease-in-out infinite;
}
.workspace-window-skeleton.short { width: 45%; }
.memo-window[data-workspace-restore] .memo-date { pointer-events: none; }
@keyframes workspace-window-pulse { 0%, 100% { opacity: .12; } 50% { opacity: .28; } }
@media (prefers-reduced-motion: reduce) { .workspace-window-skeleton { animation: none; opacity: .2; } }

html[data-memo-window-resizing],
html[data-memo-window-resizing] * {
    cursor: var(--memo-window-resize-cursor) !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

@media (any-pointer: coarse) {
    .memo-window {
        --memo-resize-edge: max(6px, calc(6 * var(--ws-unit, 1px)));
        --memo-resize-corner: max(12px, calc(12 * var(--ws-unit, 1px)));
    }
}

:is(.memo-window, .new_event_section_w).full-screen {
    top: var(--window-maximized-top, 0px) !important;
    left: var(--window-maximized-left, 0px) !important;
    width: var(--window-maximized-width, 100%) !important;
    height: var(--window-maximized-height, 100%) !important;
    border-radius: 0;
    box-shadow: none;
    z-index: 2000;
}

:is(.memo-window, .new_event_section_w).full-screen :is(.memo-resizer, .memo-window-resize-handle, .new_event_resizer_w) {
    display: none;
}


/* Memo List View Styles */
.memo-list-view {
    position: relative;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--theme-surface-panel, #2a2a2a);
    border-bottom-left-radius: calc(8 * var(--ws-unit, 1px));
    border-bottom-right-radius: calc(8 * var(--ws-unit, 1px));
    overflow: hidden;
    /* Prevent content from overflowing */
}

.memo-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(6 * var(--ws-unit, 1px)) calc(10 * var(--ws-unit, 1px));
    font-size: var(--font-size-xs);
    color: var(--theme-text-secondary, #919191);
    border-bottom: calc(1 * var(--ws-unit, 1px)) solid var(--theme-border, #404040);
    flex-shrink: 0;
    /* Prevent header from shrinking in height */
}

/* Allow date span to shrink and truncate */
.memo-list-header>span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.memo-list-controls {
    display: flex;
    align-items: center;
    gap: calc(8 * var(--ws-unit, 1px));
}

.memo-list-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: calc(4 * var(--ws-unit, 1px));
}

.memo-list-item {
    display: flex;
    align-items: center;
    padding: calc(6 * var(--ws-unit, 1px)) calc(8 * var(--ws-unit, 1px));
    cursor: pointer;
    border-radius: calc(4 * var(--ws-unit, 1px));
    transition: background-color 0.2s;
    font-size: var(--font-size-base);
    margin-bottom: calc(1 * var(--ws-unit, 1px));
}

.memo-list-item:hover {
    background-color: var(--theme-surface-hover, #404040);
}

.memo-list-item.selected {
    background-color: var(--theme-surface-active, #505050);
    /* Subtle dark gray selection */
    color: var(--theme-text-emphasis, #ffffff);
}

.memo-breadcrumb-container {
    display: flex;
    align-items: center;
    gap: calc(2 * var(--ws-unit, 1px));
    font-size: var(--font-size-base);
    color: var(--theme-text-primary, #e0e0e0);
    overflow: hidden;
    white-space: nowrap;
    user-select: none;
    flex: 1;
    min-width: 0;
}

.memo-breadcrumb-container.expanded {
    overflow-x: auto;
    scrollbar-width: none;
    /* Hide native scrollbar on Firefox */
}

.memo-breadcrumb-container.expanded::-webkit-scrollbar {
    display: none;
    /* Hide native scrollbar on Webkit */
}

.memo-breadcrumb-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.memo-breadcrumb-container:not(.expanded)+.memo-breadcrumb-scrollbar-track {
    display: none !important;
}

.memo-breadcrumb-scrollbar-track {
    position: absolute;
    bottom: calc(-6 * var(--ws-unit, 1px));
    /* align just below the breadcrumb text */
    left: 0;
    right: auto;
    top: auto;
    width: 100%;
    height: calc(10 * var(--ws-unit, 1px));
    background-color: transparent;
    z-index: 10;
}

.memo-breadcrumb-scrollbar-track .custom-scrollbar-thumb {
    position: absolute;
    top: auto;
    right: auto;
    width: auto;
    bottom: calc(2 * var(--ws-unit, 1px));
    left: 0;
    height: calc(3 * var(--ws-unit, 1px));
    background-color: var(--theme-scrollbar, #606060);
    border-radius: calc(3 * var(--ws-unit, 1px));
    transition: height 0.2s ease, background-color 0.2s ease;
}

.memo-breadcrumb-scrollbar-track:hover .custom-scrollbar-thumb,
.memo-breadcrumb-scrollbar-track .custom-scrollbar-thumb.scrolling {
    height: calc(6 * var(--ws-unit, 1px));
}

/* 공통 가로 스크롤바보다 우선하여 경로 아래의 헤더 여백에 배치한다. */
.memo-list-header .memo-breadcrumb-scrollbar-track,
.memo_list_sidebar_header .memo-breadcrumb-scrollbar-track {
    bottom: calc(-8 * var(--ws-unit, 1px));
    --scrollbar-thumb-expanded-top: auto;
}

.memo-list-header .memo-breadcrumb-scrollbar-track .custom-scrollbar-thumb,
.memo_list_sidebar_header .memo-breadcrumb-scrollbar-track .custom-scrollbar-thumb {
    top: auto;
    bottom: calc(2 * var(--ws-unit, 1px));
    height: calc(3 * var(--ws-unit, 1px));
}

.memo-list-header .memo-breadcrumb-scrollbar-track:hover .custom-scrollbar-thumb,
.memo-list-header .memo-breadcrumb-scrollbar-track .custom-scrollbar-thumb.scrolling,
.memo-list-header .memo-breadcrumb-scrollbar-track .custom-scrollbar-thumb:active,
.memo_list_sidebar_header .memo-breadcrumb-scrollbar-track:hover .custom-scrollbar-thumb,
.memo_list_sidebar_header .memo-breadcrumb-scrollbar-track .custom-scrollbar-thumb.scrolling,
.memo_list_sidebar_header .memo-breadcrumb-scrollbar-track .custom-scrollbar-thumb:active {
    height: calc(6 * var(--ws-unit, 1px));
}

.breadcrumb-part {
    cursor: pointer;
    padding: calc(2 * var(--ws-unit, 1px)) calc(5 * var(--ws-unit, 1px));
    border-radius: calc(4 * var(--ws-unit, 1px));
    transition: background-color 0.15s;
    flex-shrink: 0;
    white-space: nowrap;
}

.breadcrumb-part:hover {
    background-color: rgba(var(--theme-foreground-rgb, 255, 255, 255), 0.1);
    color: var(--theme-text-emphasis, #fff);
}

.breadcrumb-separator {
    color: var(--theme-text-muted, #606060);
    flex-shrink: 0;
    padding: 0 calc(1 * var(--ws-unit, 1px));
}

.breadcrumb-ellipsis {
    color: var(--theme-text-secondary, #aaa);
    font-weight: bold;
    flex-shrink: 0;
    padding: calc(2 * var(--ws-unit, 1px)) calc(5 * var(--ws-unit, 1px));
    border-radius: calc(4 * var(--ws-unit, 1px));
    cursor: pointer;
    transition: background-color 0.15s;
}

.breadcrumb-ellipsis:hover {
    background-color: rgba(var(--theme-foreground-rgb, 255, 255, 255), 0.1);
    color: var(--theme-text-emphasis, #fff);
}

.memo-list-item-icon {
    margin-right: calc(8 * var(--ws-unit, 1px));
}

.memo-list-item-name {
    /* Removed flex-grow to restrict rename trigger area to name width */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.memo-list-item-ext {
    color: var(--theme-text-secondary, #919191);
    margin-left: auto;
    /* Right-align the extension */
    padding-left: calc(8 * var(--ws-unit, 1px));
    /* Maintain minimum spacing */
}

/* Hide original scrollbar for memo list */
.memo-list-content::-webkit-scrollbar {
    display: none;
}

.memo-list-view>.custom-scrollbar-track {
    top: calc(31 * var(--ws-unit, 1px));
    /* header is smaller than memo-window header */
    bottom: calc(10 * var(--ws-unit, 1px));
}

/* Rename Input Styles (matching memo-header p design) */
.memo-rename-input {
    width: 100%;
    background-color: var(--theme-surface-main, #191919) !important;
    color: var(--theme-text-primary, #d1d1d1) !important;
    border: calc(1 * var(--ws-unit, 1px)) solid var(--theme-border, #505050) !important;
    border-radius: calc(5 * var(--ws-unit, 1px)) !important;
    padding: calc(2 * var(--ws-unit, 1px)) calc(4 * var(--ws-unit, 1px)) !important;
    font-weight: bold !important;
    font-size: var(--font-size-base) !important;
    font-family: inherit !important;
    outline: none !important;
    box-sizing: border-box !important;
}

/* Memo List Sidebar Styles */
#memo_list_sidebar {
    position: fixed;
    top: 0;
    right: 0;
    /* Initially hidden via transform */
    width: calc(319 * var(--ws-unit, 1px));
    height: 100%;
    background-color: var(--theme-surface-main, #191919);
    transform: translateX(100%);
    transition: transform var(--duration-apple, 350ms) var(--ease-apple-fluid, cubic-bezier(0.16, 1, 0.3, 1));
    z-index: 10000;
    /* Above full-screen memo window (2000) */
    display: flex;
    flex-direction: column;
    padding-top: 0;
    /* Remove padding from top */
    box-sizing: border-box;
    color: var(--theme-text-primary, #d1d1d1);
}

#memo_list_sidebar.active {
    transform: translateX(0);
}

.memo_list_sidebar_header {
    height: auto;
    /* Allow height to adapt */
    min-height: calc(48 * var(--ws-unit, 1px));
    padding: calc(10 * var(--ws-unit, 1px)) calc(18 * var(--ws-unit, 1px));
    border-bottom: calc(2 * var(--ws-unit, 1px)) solid var(--theme-border, #333);
    display: flex;
    flex-direction: column;
    /* Stack items vertically */
    justify-content: center;
    gap: calc(5 * var(--ws-unit, 1px));
    /* Spacing between title and bottom row */
    flex-shrink: 0;
    margin-top: calc(44 * var(--ws-unit, 1px));
    /* Add margin to account for main menu bar */
}

.memo_list_sidebar_header>.sidebar_title {
    font-weight: bold;
    font-size: 1.2em;
    /* Slightly larger */
    color: var(--theme-text-primary, #e0e0e0);
    align-self: flex-start;
    /* Align title to left */
}

.sidebar_header_bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    /* Full width for the row */
}

.memo_list_sidebar_header #memo_list_sidebar_date {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    font-size: 0.9em;
    color: var(--theme-text-secondary, #919191);
    /* Slightly smaller than title */
}

.memo_list_sidebar_controls {
    display: flex;
    align-items: center;
    gap: calc(8 * var(--ws-unit, 1px));
}

#memo_list_sidebar.active {
    right: 0;
}

.main_section.memo-sidebar-active {
    margin-right: calc(319 * var(--ws-unit, 1px));
}

#memo_list_resizer {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(1 * var(--ws-unit, 1px));
    height: 100%;
    background-color: var(--theme-surface-panel, #303030);
    cursor: col-resize;
    z-index: 999;
}

#memo_list_resizer::after {
    content: "";
    position: absolute;
    top: 0;
    left: calc(-4 * var(--ws-unit, 1px));
    right: calc(-4 * var(--ws-unit, 1px));
    bottom: 0;
    width: calc(10 * var(--ws-unit, 1px));
    z-index: 1;
}

.memo_list_sidebar_content {
    flex-grow: 1;
    overflow-y: auto;
    padding: calc(5 * var(--ws-unit, 1px));
    display: flex;
    flex-direction: column;
}

/* Hide default scrollbar for memo list sidebar content */
.memo_list_sidebar_content::-webkit-scrollbar {
    display: none;
}

.memo-sidebar-scrollbar {
    top: calc(114 * var(--ws-unit, 1px));
    /* Below sidebar header */
    bottom: calc(5 * var(--ws-unit, 1px));
    right: calc(2 * var(--ws-unit, 1px));
}

#memo_list_sidebar_list {
    flex-grow: 1;
    min-height: 100%;
}

/* ws-window skeleton overrides for memo components */
.memo-window .ws-window-body {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
