.mley-saved-toggle[hidden], .mley-saved-panel[hidden], .mley-sidebar-index-panel[hidden], .mley-saved-drawer[hidden], .mley-saved-backdrop[hidden] { display: none !important; }
.mley-saved-toggle { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .4rem .65rem; flex-shrink: 0; font-size: .8rem; }
.mley-saved-toggle [data-saved-count] { min-width: 1.3rem; padding: .05rem .25rem; border-radius: 1rem; background: var(--accent-color-soft, #f5eaf0); color: var(--accent-color, #97335d); font-size: .72rem; font-weight: 700; }
.mley-saved-tabs { display: flex; margin: .45rem .75rem .8rem; padding: .2rem; gap: .2rem; border: 1px solid var(--border-color, #dce2e8); border-radius: .8rem; background: var(--bg-surface-2, #f4f6f8); }
.mley-saved-tabs button { flex: 1; border: 1px solid transparent; border-radius: .6rem; padding: .55rem .25rem; background: transparent; color: var(--text-muted, #65717d); font: inherit; font-size: .8rem; font-weight: 650; cursor: pointer; }
.mley-saved-tabs button[aria-selected="true"] { background: var(--bg-surface, #fff); border-color: var(--border-color, #dce2e8); color: var(--accent-color, #97335d); box-shadow: 0 1px 3px #00000008; }
.mley-saved-panel { padding: 0 .75rem 1rem; color: var(--text-color, #25323e); }
.mley-saved-intro { margin: 0 0 .75rem; color: var(--text-muted, #65717d); font-size: .75rem; }
.mley-saved-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.mley-saved-card { display: flex; align-items: flex-start; gap: .2rem; margin: 0; padding: .2rem; border: 1px solid var(--border-color, #dce2e8); border-radius: .8rem; background: var(--bg-surface, #fff); }
.mley-saved-card:has([aria-current="true"]) { border-color: var(--accent-color, #97335d); background: var(--accent-color-soft, #f5eaf0); }
.mley-saved-card-open { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: .3rem; border-radius: .55rem; padding: .65rem .55rem; color: var(--text-color, #25323e); text-decoration: none; }
.mley-saved-card-open:hover { background: var(--bg-surface-2, #f4f6f8); color: var(--accent-color, #97335d); text-decoration: none; }
.mley-saved-card-open strong { font-size: .82rem; line-height: 1.35; overflow-wrap: anywhere; }
.mley-saved-card-open span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--text-muted, #65717d); font-size: .74rem; line-height: 1.4; }
.mley-saved-remove { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 2.5rem; height: 2.5rem; padding: 0; border: 0; border-radius: .6rem; background: transparent; color: var(--text-muted, #65717d); font-size: 1.3rem; cursor: pointer; }
.mley-saved-remove:hover { background: var(--bg-surface-2, #f4f6f8); color: var(--text-color, #25323e); }
.mley-saved-empty { padding: 1rem .35rem; color: var(--text-muted, #65717d); font-size: .85rem; line-height: 1.6; }
.mley-saved-message, .mley-saved-reader-status { font-size: .8rem; line-height: 1.45; color: var(--text-muted, #65717d); }
.mley-saved-message:not(:empty) { margin-bottom: .75rem; }
.mley-saved-reader-status { flex-basis: 100%; margin: 0 0 .4rem; }
.mley-saved-text-action { display: inline-block; margin: .25rem .5rem 0 0; padding: .2rem 0; background: none; border: 0; color: var(--accent-color, #97335d); text-decoration: underline; cursor: pointer; font: inherit; }
.mley-saved-drawer { position: fixed; z-index: 1040; inset: 0 auto 0 0; width: min(360px, 100vw); display: flex; flex-direction: column; border-right: 1px solid var(--border-color, #dce2e8); background: var(--bg-surface, #fff); color: var(--text-color, #25323e); box-shadow: 10px 0 35px #00000016; }
.mley-saved-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem .8rem .5rem 1rem; }
.mley-saved-drawer-header h2 { margin: 0; font-size: 1.15rem; }
.mley-saved-drawer .mley-saved-panel { overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.mley-saved-backdrop { position: fixed; inset: 0; z-index: 1039; background: #101b2d55; }
.mley-save-action { border-color: var(--accent-color, #97335d) !important; color: var(--accent-color, #97335d) !important; background: var(--accent-color-soft, #f5eaf0) !important; }
.mley-saved-tabs button:focus-visible, .mley-saved-card-open:focus-visible, .mley-saved-remove:focus-visible, .mley-saved-text-action:focus-visible { outline: 2px solid var(--accent-color, #97335d); outline-offset: 2px; }
.mley-saved-live { position: fixed; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 1080px) { .mley-saved-toggle-label { display: none; } .mley-saved-toggle { padding: .35rem; gap: .1rem; } }
@media (max-width: 480px) { .mley-saved-drawer { width: 100vw; } .mley-save-action { white-space: normal; } }
.mley-saved-tabs button { white-space: nowrap; font-size: .75rem; }
.mley-saved-tabs button:first-child { flex: .65; }
.mley-saved-backdrop { touch-action: none; }
.mley-home-sidebar .mley-saved-panel { padding-inline: 0; }
.mley-home-sidebar .mley-saved-tabs { margin-inline: 0; }

/* Folders share the existing surfaces and accent, including the account library. */
body:has(#library-app) .mley-folder-dialog { --bg-surface: var(--paper); --bg-surface-2: var(--bg); --text-color: var(--ink); --text-muted: var(--muted); --border-color: var(--line); --accent-color: var(--accent); }
.mley-folder-dialog .modal-dialog { width: calc(100% - 24px); max-width: 480px; margin: 24px auto; }
.mley-folder-dialog .modal-content { max-height: calc(100dvh - 48px); color: var(--text-color, var(--ink, #25323e)); background: var(--bg-surface, var(--paper, #fff)); border-radius: 14px; }
.mley-folder-dialog .modal-body { min-height: 0; overflow-y: auto; padding: 1rem; }
.mley-folder-dialog .modal-title { font-size: 1rem; font-weight: 700; }
.mley-folder-dialog .modal-footer { flex-wrap: wrap; gap: .5rem; }
.mley-folder-dialog .modal-footer button { min-height: 44px; padding: .6rem 1rem; border: 1px solid var(--border-color, var(--line, #dce2e8)); border-radius: 9px; color: inherit; background: var(--bg-surface-2, var(--bg, #f5f6f8)); cursor: pointer; }
.mley-folder-form { margin: 0; font-size: .85rem; }
.mley-folder-article { margin: 0 0 1rem; color: var(--text-muted, var(--muted, #65717d)); }
.mley-folder-field { display: flex; flex-direction: column; gap: .45rem; margin: 0 0 1rem; font-size: .85rem; }
.mley-folder-field input:not([type=checkbox]), .mley-folder-field select, .mley-saved-location select, .mley-saved-panel > input[type=search] { width: 100%; min-width: 0; min-height: 44px; padding: .55rem .65rem; border: 1px solid var(--border-color, var(--line, #dce2e8)); border-radius: 8px; background: var(--bg-surface, var(--paper, #fff)); color: var(--text-color, var(--ink, #25323e)); font: inherit; }
.mley-folder-check { flex-direction: row-reverse; justify-content: flex-end; align-items: center; font-weight: 400; }
.mley-folder-check input { width: 18px; height: 18px; flex-shrink: 0; }
.mley-folder-field[hidden], .mley-saved-folder-actions[hidden], .mley-saved-folder-list[hidden] { display: none !important; }
.mley-folder-hint, .mley-folder-status { font-size: .78rem; line-height: 1.5; color: var(--text-muted, var(--muted, #65717d)); }
.mley-folder-status:empty { display: none; }
.mley-folder-status:not(:empty) { padding: .7rem; background: var(--bg-surface-2, var(--bg, #f5f6f8)); border-radius: 8px; }
.mley-folder-dialog :is(input,select,button):focus-visible, .mley-saved-panel :is(input,select,button):focus-visible { outline: 2px solid var(--accent-color, var(--accent, #97335d)); outline-offset: 2px; }
.mley-folder-dialog button:disabled { opacity: .6; cursor: wait; }
.mley-saved-folder-toolbar { display: flex; margin: .25rem 0 .9rem; }
.mley-saved-create-folder { display: flex; align-items: center; gap: .65rem; width: 100%; min-height: 44px; margin: 0; padding: .65rem .8rem; border: 1px solid var(--border-color, #dce2e8); border-color: color-mix(in srgb, var(--accent-color, #97335d) 25%, var(--border-color, #dce2e8)); border-radius: .65rem; background: var(--accent-color-soft, #f5eaf0); color: var(--accent-color, #97335d); font: inherit; font-size: .82rem; font-weight: 650; line-height: 1.4; text-align: left; cursor: pointer; }
.mley-saved-create-folder::before { content: ""; flex: 0 0 20px; width: 20px; height: 20px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 20H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2Z'/%3E%3Cpath d='M12 10v7m-3.5-3.5h7'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 20H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2Z'/%3E%3Cpath d='M12 10v7m-3.5-3.5h7'/%3E%3C/svg%3E") center / contain no-repeat; }
.mley-saved-create-folder:hover { border-color: var(--accent-color, #97335d); background: color-mix(in srgb, var(--accent-color, #97335d) 12%, var(--bg-surface, #fff)); }
.mley-saved-create-folder:active { background: color-mix(in srgb, var(--accent-color, #97335d) 18%, var(--bg-surface, #fff)); }
.mley-saved-location { display: flex; flex-direction: column; gap: .35rem; font-size: .75rem; margin-bottom: .65rem; }
.mley-saved-panel > input[type=search] { margin-bottom: .7rem; font-size: .78rem; }
.mley-saved-folder-list { list-style: none; margin: 0 0 .8rem; padding: 0; }
.mley-saved-folder-list li { margin: 0; }
.mley-saved-folder-list button { display: flex; gap: .5rem; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: .6rem .35rem; background: transparent; border: 0; border-bottom: 1px solid var(--border-color, #dce2e8); color: var(--text-color, #25323e); font-size: .8rem; text-align: left; cursor: pointer; }
.mley-saved-folder-list button > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.mley-saved-folder-count { flex-shrink: 0; color: var(--text-muted, #65717d); }
.mley-saved-folder-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.25rem), 1fr)); gap: .45rem; margin-bottom: .85rem; }
.mley-saved-folder-action { display: flex; align-items: center; gap: .5rem; min-width: 0; min-height: 44px; margin: 0; padding: .6rem .65rem; border: 1px solid var(--border-color, #dce2e8); border-radius: .6rem; background: var(--bg-surface, #fff); color: var(--text-color, #25323e); font: inherit; font-size: .75rem; font-weight: 600; line-height: 1.4; text-align: left; cursor: pointer; }
.mley-saved-folder-action::before { content: ""; flex: 0 0 16px; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--folder-action-icon) center / contain no-repeat; mask: var(--folder-action-icon) center / contain no-repeat; }
.mley-saved-folder-action--rename { --folder-action-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 5 4 4M4 20l5-1L20 8a2.8 2.8 0 0 0-4-4L5 15l-1 5Z'/%3E%3C/svg%3E"); }
.mley-saved-folder-action--rename:hover { border-color: var(--accent-color, #97335d); background: var(--accent-color-soft, #f5eaf0); color: var(--accent-color, #97335d); }
.mley-saved-folder-action--delete { --folder-action-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2M5 6l1 14a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1l1-14M10 10v7m4-7v7'/%3E%3C/svg%3E"); color: #a53d48; }
.mley-saved-folder-action--delete:hover { border-color: currentColor; background: color-mix(in srgb, currentColor 7%, var(--bg-surface, #fff)); }
[data-theme="dark"] .mley-saved-folder-action--delete { color: #f19ba5; }
.mley-saved-card-actions { display: flex; flex-direction: column; }
.mley-saved-organize { width: 2.5rem; min-height: 2.5rem; padding: 0; border: 0; border-radius: .6rem; background: transparent; color: var(--text-muted, #65717d); font: 700 1.1rem/1 system-ui; cursor: pointer; }
.mley-saved-organize:hover, .mley-saved-folder-list button:hover { background: var(--bg-surface-2, #f5f6f8); color: var(--accent-color, #97335d); }
.mley-folder-dialog .modal-footer > button { flex: 1; min-width: 0; margin: 0; font-size: .85rem; }
