/* Compact covers follow the available library width, including an open sidebar. */
.library-main{container-type:inline-size}
.notes-grid:not(.list){grid-template-columns:repeat(2,minmax(0,1fr));gap:20px 12px}
.notes-grid:not(.list) .note-card{min-width:0}
.notes-grid:not(.list) .note-cover,.notes-grid:not(.list) .new-note-card{height:auto;aspect-ratio:1.28;min-height:0;border-radius:10px}
.notes-grid:not(.list) .note-cover{padding:12px 12px 0}
.notes-grid:not(.list) .note-paper{height:125%;top:12px}
.notes-grid:not(.list) .card-title-row{margin-top:5px;gap:2px}
.notes-grid:not(.list) .card-title{font-size:11px;min-width:0}
.notes-grid:not(.list) .card-meta{font-size:9px;gap:4px;flex-wrap:wrap}
.notes-grid:not(.list) .card-tag{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-left:0}
.notes-grid:not(.list) .cover-type{left:7px;bottom:7px;font-size:8px;padding:4px 5px}
@container (min-width:560px){.notes-grid:not(.list){grid-template-columns:repeat(4,minmax(0,1fr))}}
@container (min-width:1000px){.notes-grid:not(.list){grid-template-columns:repeat(5,minmax(0,1fr))}}
@container (min-width:1300px){.notes-grid:not(.list){grid-template-columns:repeat(6,minmax(0,1fr))}}

/* Library controls remain available on a touch screen. */
.view-toggle button{position:relative;min-width:44px;min-height:44px}
.compact-mark{position:absolute;right:5px;bottom:2px;font-size:14px;line-height:1}
.notes-grid.compact{grid-template-columns:repeat(3,minmax(0,1fr))}
@container (min-width:560px){.notes-grid.compact{grid-template-columns:repeat(6,minmax(0,1fr))}}
@container (min-width:1000px){.notes-grid.compact{grid-template-columns:repeat(8,minmax(0,1fr))}}
@media(max-width:760px){.section-bar{flex-wrap:wrap}.section-bar .section-spacer{flex-basis:100%;height:0}.section-bar .sort-select{margin-right:auto}.section-bar .view-toggle{display:flex}.notes-grid.list .card-title-row .icon-btn{width:44px;height:44px;flex:none}}

/* Compact library actions and touch-friendly folder organization. */
.welcome-head{margin-bottom:14px}
.welcome-head .eyebrow{display:block;margin-bottom:4px}
.welcome-head p{margin:0}
.quick-actions{gap:10px;margin-bottom:22px}
.quick-card{min-height:76px;padding:14px 48px 14px 16px}
.quick-card h3{font-size:18px;line-height:1.2;margin:0}
.quick-card p{font-size:11px;margin:5px 0 0}
.quick-card .doodle,.quick-card .paper-doodle{display:none}
.quick-card .circle-button{width:30px;height:30px;right:12px;bottom:12px}
.folder-tools{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 20px}
.folder-tools .btn{min-height:44px;font-size:12px;padding:8px 12px;gap:6px}
.organize-list{max-height:45vh;overflow-y:auto;margin-top:12px;border:1px solid var(--line);border-radius:10px}
.organize-item{display:flex;align-items:center;gap:10px;min-height:48px;padding:8px 12px;border-bottom:1px solid var(--line)}
.organize-item:last-child{border-bottom:0}
.organize-item input{width:20px;height:20px;flex:none}
.organize-item span{min-width:0;flex:1;overflow-wrap:anywhere}
.organize-item small{color:var(--theme-muted);max-width:35%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media(max-width:480px){.quick-actions{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.quick-card{min-height:82px;padding:12px 12px 38px}.quick-card h3{font-size:16px}.quick-card p{font-size:10px}.quick-card .circle-button{bottom:8px;right:10px;width:26px;height:26px}.folder-tools .btn{flex:1;justify-content:center}}

/* Organizing actions sit with sort and display controls. */
.section-bar{display:flex;align-items:center;gap:14px;flex-wrap:wrap}
.library-heading{display:flex;align-items:center;gap:12px;min-width:0;margin-right:auto}
.library-heading .total{margin-left:0}
.library-controls{display:flex;align-items:center;gap:8px;min-width:0}
.library-controls .sort-select{margin:0;min-height:44px;font-size:12px;max-width:175px}
.library-controls .folder-tools{display:flex;flex-wrap:nowrap;gap:2px;margin:0;padding:3px;border:1px solid var(--theme-line,var(--line));border-radius:7px}
.library-tool{position:relative;display:grid;place-items:center;width:40px;height:40px;color:var(--theme-muted);border-radius:5px}
.library-tool:hover,.library-tool:focus-visible{background:var(--theme-active);color:var(--theme-ink)}
.library-tool .icon{width:19px;height:19px}
.folder-plus{position:absolute;right:6px;bottom:5px;font-size:13px;line-height:1;font-weight:700;background:var(--theme-bg);border-radius:50%}
.library-controls .view-toggle{display:flex;flex:none}
@media(max-width:900px){.section-bar{gap:8px}.library-heading{flex-basis:100%}.library-controls{display:grid;grid-template-columns:minmax(0,1fr) auto auto;width:100%;gap:6px}.library-controls .sort-select{width:100%;max-width:none;min-width:0;font-size:14px}.library-controls .folder-tools{margin:0}.library-tool{width:40px;height:40px}.library-controls .view-toggle button{min-width:40px;min-height:40px}}
@container (max-width:335px){.library-controls{grid-template-columns:minmax(0,1fr) auto}.library-controls .sort-select{grid-column:1/-1}.library-controls .folder-tools{justify-self:start}.library-controls .view-toggle{justify-self:end}}

/* Keep the library title and tools together when space allows. */
.section-bar{flex-wrap:nowrap;gap:8px}
.library-heading{flex:0 0 auto;gap:6px;margin-right:auto}
.library-heading h2{font-size:15px;white-space:nowrap}
.library-controls{width:auto;flex:0 1 auto}
.quick-card{min-height:62px;display:flex;align-items:center;padding:12px 52px 12px 16px}
.quick-card h3{font-size:17px;line-height:1.2}
.quick-card .circle-button{top:50%;bottom:auto;transform:translateY(-50%)}
@media(max-width:900px){.library-heading{flex-basis:auto}.library-controls{display:flex;width:auto;flex:1;justify-content:flex-end;min-width:0}.library-controls .sort-select{width:auto;max-width:145px;flex:1}.section-bar{flex-wrap:nowrap}.quick-card{min-height:62px}}
@container (max-width:560px){.library-heading h2{font-size:13px}.library-heading{gap:4px}.library-heading .total{font-size:10px;padding:3px 5px}.library-controls{gap:3px}.library-controls .sort-select{max-width:100px;font-size:12px}.library-controls .folder-tools{padding:1px;gap:0}.library-controls .view-toggle{padding:1px}.library-tool,.library-controls .view-toggle button{width:36px;min-width:36px;height:44px;min-height:44px}.folder-plus{right:4px;bottom:7px}.quick-card{min-height:60px;padding:12px 40px 12px 12px}.quick-card h3{font-size:15px}.quick-card .circle-button{top:50%;bottom:auto;right:9px;transform:translateY(-50%)}}
@container (max-width:340px){.section-bar{flex-wrap:wrap}.library-heading{flex:1 1 100%}.library-controls{display:grid;width:100%;grid-template-columns:minmax(0,1fr) auto auto}.library-controls .sort-select{width:100%;max-width:none}.library-controls .folder-tools,.library-controls .view-toggle{justify-self:auto}.library-controls .sort-select{grid-column:auto}}
@container (max-width:300px){.library-controls{grid-template-columns:minmax(0,1fr) auto}.library-controls .sort-select{grid-column:1/-1}.library-controls .view-toggle{justify-self:end}}

/* Native picker retains full option labels while the closed control stays compact. */
.library-controls .sort-icon{position:relative;display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;border:1px solid var(--theme-line,var(--line));border-radius:7px;color:var(--theme-muted);overflow:hidden}
.sort-icon .icon{width:19px;height:19px;pointer-events:none}
.library-controls .sort-icon .sort-select{position:absolute;inset:0;width:100%;height:100%;max-width:none;min-height:44px;opacity:0;cursor:pointer;margin:0}
.sort-icon:focus-within{outline:2px solid var(--theme-ink);outline-offset:2px}
@media(max-width:900px){.library-controls{flex:0 0 auto}.library-controls .sort-icon{width:44px}}
@container (max-width:340px){.section-bar{flex-wrap:nowrap}.library-heading{flex:0 0 auto}.library-controls{display:flex;width:auto;grid-template-columns:none}.library-controls .sort-icon{width:44px}.library-controls .folder-tools,.library-controls .view-toggle{justify-self:auto}}
@container (max-width:265px){.section-bar{flex-wrap:wrap}.library-heading{flex:1 1 100%}}

.modal-body .organize-select-all,.modal-body .organize-item{display:flex;align-items:center;gap:10px;min-height:48px;margin:0;padding:8px 12px}
.modal-body .organize-select-all{margin-top:12px;border:1px solid var(--line);border-radius:10px}
.modal-body .organize-select-all input,.modal-body .organize-item input{width:20px;height:20px;flex:none;accent-color:var(--green)}
.modal-body .organize-select-all span,.modal-body .organize-item span{min-width:0;flex:1;overflow-wrap:anywhere}
.modal-body .organize-select-all small,.modal-body .organize-item small{color:var(--theme-muted);max-width:35%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.modal-body .organize-confirm{margin-top:12px;padding:12px;border:1px solid var(--line);border-radius:10px}
.modal-body .organize-confirm[hidden]{display:none}
.organize-confirm .btn{min-height:44px;margin:4px 6px 0 0}

.folder-label-actions{display:flex;align-items:center;gap:3px}
.folder-label-actions .icon-btn{width:40px;height:40px}
.folder-manage-list{max-height:45vh;overflow:auto;border:1px solid var(--line);border-radius:10px}
.folder-manage-row{display:flex;align-items:center;gap:5px;padding:6px 8px;border-bottom:1px solid var(--line)}
.folder-manage-row:last-child{border-bottom:0}
.folder-manage-name{min-width:0;flex:1;overflow-wrap:anywhere}
.folder-action{display:grid;place-items:center;width:40px;height:44px;flex:none;color:var(--theme-muted);border-radius:6px;font-size:20px}
.folder-action .icon{width:17px;height:17px}
.folder-action:disabled{opacity:.3}
.folder-action:not(:disabled):hover{background:var(--theme-active);color:var(--theme-ink)}
.folder-delete-confirm{margin-top:12px;padding:12px;border:1px solid var(--line);border-radius:10px}
.folder-delete-confirm[hidden]{display:none}.folder-delete-confirm .btn{min-height:44px;margin:4px 6px 0 0}

.library-controls .empty-trash{border:1px solid var(--theme-line,var(--line));width:44px;height:44px;flex:none}
