/* Sebastian's colours: the neutral greys in shared/styles.css, unchanged.
   (TaskFlow's theme.css sets its own blues here.) */

/* Sebastian's wider project navigation and note previews. */
@media (min-width: 981px) {
  .app:not(.expanded) { grid-template-columns: clamp(280px, 20vw, 360px) clamp(340px, 23vw, 420px) minmax(0, 1fr); }
}
@media (min-width: 681px) and (max-width: 980px) {
  .app:not(.expanded) { grid-template-columns: minmax(300px, 40%) minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .sidebar { width: min(320px, calc(100vw - 48px)); }
}
.list-pane { min-width: 0; }
.list-toolbar { flex-wrap: wrap; }
#new-note.new-note-button { flex: none; width: auto; min-height: 34px; padding: 6px 12px; border-radius: 8px; background: var(--accent); color: white; white-space: nowrap; font-size: 13px; font-weight: 600; }
#new-note.new-note-button:hover { filter: brightness(1.08); }

/* Browser-only workspace controls. */
.app { position: relative; }
@media (min-width: 981px) {
  .app:not(.expanded) { grid-template-columns: var(--sidebar-width, clamp(280px, 20vw, 360px)) var(--notes-width, clamp(340px, 23vw, 420px)) minmax(0, 1fr); }
}
.column-divider { position: absolute; top: 0; bottom: 0; width: 9px; margin-left: -5px; z-index: 5; cursor: col-resize; touch-action: none; }
.column-divider:hover, .column-divider:focus-visible { background: var(--accent); opacity: .45; outline: none; }
.resizing-columns, .resizing-columns * { cursor: col-resize !important; user-select: none !important; }
.app.expanded .column-divider { display: none; }
@media (max-width: 980px) { .column-divider { display: none; } }
.note-body .ql-editor { font-size: var(--reading-size, 17px); }
.app .editor > :not(.sr-only), .app.expanded .editor > :not(.sr-only) { max-width: var(--writing-width, 720px); }
.app[data-density="compact"] .note-card { padding-top: 7px; padding-bottom: 7px; }
.app[data-density="compact"] .note-card-preview { -webkit-line-clamp: 1; }
#workspace-dialog, #template-dialog { max-width: 480px; max-height: calc(100dvh - 48px); overflow-y: auto; box-sizing: border-box; }
.workspace-field { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.workspace-field input[type="range"] { flex-basis: 100%; width: 100%; }
.workspace-field select, .workspace-field output { margin-left: auto; font: inherit; }
.workspace-field select { max-width: 60%; padding: 6px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; }
.template-option { display: flex; flex-direction: column; gap: 5px; width: 100%; text-align: left; padding: 14px; margin: 8px 0; background: var(--list); border: 1px solid var(--line); border-radius: 8px; }
.template-option:hover { background: var(--hover); }
.template-option span { color: var(--muted); font-size: 13px; }
.favorite-order-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.favorite-order-row > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#favorite-current { color: var(--accent); flex: none; }
#workspace-settings { flex: none; font-weight: 600; }

.list-head .list-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-head .sort-select { flex: none; }
#note-templates { flex: none; }
/* Long template content must scroll rather than squeeze the title away. */
.editor > :not(.sr-only) { flex-shrink: 0; }

/* Attachments use their own area, preserving the simple text editor. */
#note-images { margin: 24px auto; max-width: var(--writing-width, 760px); padding: 0 8px 24px; }
.image-toolbar { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.image-toolbar h2 {font-size:15px;color:var(--muted);font-weight:600;}
#note-images figure { margin:16px 0; padding:12px; border:1px solid var(--border); border-radius:10px; }
#note-images figure > button:first-child { display:block; width:100%; padding:0; background:transparent; }
#note-images img { display:block; max-width:100%; max-height:280px; margin:auto; object-fit:contain; }
#note-images figcaption { overflow-wrap:anywhere; font-size:13px; margin:8px 0; }
.image-upload { padding:12px; font-size:14px; overflow-wrap:anywhere; }
.image-upload button {margin:8px 8px 0 0;}
#image-viewer { max-width:95vw; max-height:95dvh; padding:16px; }
#image-viewer button {display:block;margin:0 0 12px auto;}
#image-viewer img {max-width:85vw;max-height:78dvh;object-fit:contain;display:block;}
/* Keep image actions close to short notes rather than at the viewport bottom. */
.editor .note-body { flex: 0 0 auto; }
#note-images { width: 100%; box-sizing: border-box; }
.image-upload { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
/* Quill defaults both wrappers to height:100%, reserving a full screen even
   for one line. Let text determine the height before the attachment section. */
.editor .note-body.ql-container { height: auto; min-height: 0; }
.editor .note-body .ql-editor { height: auto; min-height: 3.3em; padding-bottom: 8px; overflow-y: visible; }
#note-images { margin-top: 12px; }
#collection-context { display:flex; align-items:center; flex-wrap:wrap; gap:6px; margin-bottom:12px; font-size:12px; }
.collection-context-label {color:var(--muted);margin-right:4px;}
#collection-context button {font-size:12px;padding:4px 8px;}
.collection-context-chip {border-color:var(--tag);color:var(--ink);max-width:100%;overflow-wrap:anywhere;}
.section-placement {display:flex;align-items:center;gap:8px;flex-basis:100%;color:var(--muted);margin-top:6px;}
.section-placement select {min-width:0;max-width:65%;font:inherit;padding:4px;}
#collection-section-tools {display:flex;align-items:center;justify-content:space-between;padding:8px 16px;gap:8px;border-bottom:1px solid var(--line);font-size:13px;}
#collection-section-tools[hidden] {display:none;}
#collection-section-tools strong {overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.collection-section-heading {font-size:12px;color:var(--muted);padding:12px 16px 5px;margin:0;background:var(--list);}
.section-empty {font-size:12px;color:var(--muted);padding:0 16px 12px;}
.note-card-title {line-height:1.4;}
.note-type-icon {color:var(--muted);margin-right:7px;font-size:14px;}
.note-card-meta {display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:11.5px;color:var(--muted);margin-top:5px;}
.note-card-preview {min-height:1.5em;}
#section-dialog {max-width:600px;width:calc(100vw - 32px);box-sizing:border-box;max-height:85dvh;overflow:auto;}
#section-create-form,.section-manager-row {display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:12px 0;}
#section-name,.section-manager-row input {flex:1;min-width:90px;}
#collection-context { position:sticky; top:0; z-index:4; background:var(--bg); padding:6px 0; }
#collection-link-picker,#collection-linked-detail {max-width:620px;width:calc(100vw - 32px);max-height:85dvh;overflow:auto;box-sizing:border-box;}
#collection-link-search {width:100%;box-sizing:border-box;margin:8px 0;}
.collection-link-option {display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--line);}
.collection-link-option input {flex:none;width:18px;height:18px;}
.collection-link-option strong,.collection-link-option small {display:block;overflow-wrap:anywhere;}
.collection-link-option small {color:var(--muted);margin-top:4px;}
.collection-linked-row {display:flex;align-items:center;border-bottom:1px solid var(--line);}
.collection-linked-row .note-card {min-width:0;flex:1;}
.unlink-collection-item {flex:none;margin:0 8px;padding:8px 12px;}
.collection-snapshot-status {padding:12px 16px;color:var(--muted);font-size:12px;}
.linked-item-notes {white-space:pre-wrap;overflow-wrap:anywhere;}
#collection-section-tools {flex-wrap:wrap;}
.linked-type-heading {font-size:13px;font-weight:700;color:var(--ink);padding:14px 16px 6px;margin:0;}
/* Collections are a project page; the existing editor becomes its detail pane. */
.app.collection-page:not(.expanded) .column-divider {display:none;}
.collection-page #collection-section-tools {display:block;padding:24px;background:var(--bg);}
.collection-page-heading h1 {font-size:28px;line-height:1.2;margin:8px 0;overflow-wrap:anywhere;}
.collection-page-heading p {font-size:13px;color:var(--muted);margin:8px 0 18px;}
.collection-page-actions {display:flex;flex-wrap:wrap;gap:8px;}
.collection-page .list-pane {background:var(--bg);}
.collection-page #note-list {padding:8px 24px 24px;}
.mixed-collection-section {margin:12px 0 24px;border:1px solid var(--line);border-radius:12px;overflow:hidden;}
.mixed-collection-section .collection-section-heading {background:var(--list);padding:12px 16px;}
.mixed-collection-section .note-card {width:100%;margin:0;border-radius:0;}
.mixed-item-controls {display:flex;align-items:center;gap:6px;margin-right:12px;max-width:45%;}
.mixed-section-select {min-width:0;max-width:160px;width:100%;font:inherit;font-size:12px;padding:5px;}
#collection-workspace-detail {padding:24px;overflow:auto;flex:1;min-height:0;}
#collection-workspace-detail h2 {overflow-wrap:anywhere;}
#collection-workspace-detail p {line-height:1.6;overflow-wrap:anywhere;}
#collection-workspace-detail > button {margin-bottom:16px;}
.collection-linked-detail .editor-pane > :not(#collection-workspace-detail) {display:none!important;}
@media(min-width:981px){
 .app.collection-page:not(.expanded) {grid-template-columns:240px minmax(400px,1fr);}
 .app.collection-page.collection-details-open:not(.expanded) {grid-template-columns:240px minmax(350px,1fr) minmax(360px,1fr);}
 .collection-page:not(.collection-details-open):not(.expanded) .editor-pane {display:none;}
}
@media(min-width:681px) and (max-width:980px){
 .app.collection-page:not(.expanded) {grid-template-columns:minmax(0,1fr);}
 .app.collection-page.collection-details-open:not(.expanded) {grid-template-columns:minmax(300px,1fr) minmax(320px,1fr);}
 .collection-page:not(.collection-details-open):not(.expanded) .editor-pane {display:none;}
}
@media(max-width:680px){
 .collection-page #collection-section-tools {padding:18px;}
 .collection-page #note-list {padding:4px 14px 18px;}
 .mixed-item-controls {flex-direction:column;align-items:stretch;max-width:40%;}
 .collection-page-heading h1 {font-size:26px;}
}
.collection-page .back {display:inline-flex;}
.collection-linked-detail .note-card[data-id].selected,.collection-page:not(.collection-details-open) .note-card.selected {background:transparent;}
#collection-workspace-detail a {color:var(--accent);font-weight:600;text-decoration:none;}
#collection-workspace-detail a:hover {text-decoration:underline;}
#collection-workspace-detail .muted {font-size:12px;color:var(--muted);margin-top:24px;}
.collection-page .list-toolbar #new-note {display:none;}
.collection-type-badge {display:inline-flex;align-items:center;gap:5px;align-self:flex-start;width:max-content;max-width:100%;padding:3px 7px;margin-bottom:6px;border-radius:5px;font-size:11px;font-weight:600;line-height:1.3;color:var(--item-color);background:color-mix(in srgb,var(--item-color) 12%,transparent);}
.collection-type-badge svg {width:14px;height:14px;flex:none;}
.type-note {--item-color:#956500;}
.type-event {--item-color:#2867c5;}
.type-reminder {--item-color:#7660b7;}
.note-card[data-item-type] {border-left:3px solid var(--item-color);padding-left:13px;}
.note-card[data-item-type="note"] {--item-color:#956500;}
.note-card[data-item-type="event"] {--item-color:#2867c5;}
.note-card[data-item-type="reminder"] {--item-color:#7660b7;}
@media(prefers-color-scheme:dark){
 :root:not([data-theme="light"]) .type-note,:root:not([data-theme="light"]) .note-card[data-item-type="note"] {--item-color:#e4bd60;}
 :root:not([data-theme="light"]) .type-event,:root:not([data-theme="light"]) .note-card[data-item-type="event"] {--item-color:#7caff5;}
 :root:not([data-theme="light"]) .type-reminder,:root:not([data-theme="light"]) .note-card[data-item-type="reminder"] {--item-color:#b5a0ed;}
}
[data-theme="dark"] .type-note,[data-theme="dark"] .note-card[data-item-type="note"] {--item-color:#e4bd60;}
[data-theme="dark"] .type-event,[data-theme="dark"] .note-card[data-item-type="event"] {--item-color:#7caff5;}
[data-theme="dark"] .type-reminder,[data-theme="dark"] .note-card[data-item-type="reminder"] {--item-color:#b5a0ed;}
#collection-filters {display:flex;align-items:flex-end;flex-wrap:wrap;gap:12px;margin-top:20px;padding-top:16px;border-top:1px solid var(--line);}
#collection-filters label {display:flex;flex-direction:column;gap:5px;color:var(--muted);font-size:12px;min-width:0;}
#collection-filters select {font:inherit;font-size:13px;padding:7px;max-width:100%;color:var(--ink);background:var(--bg);border:1px solid var(--line);border-radius:6px;}
#collection-filter-count {flex-basis:100%;font-size:12px;color:var(--muted);margin:0;}
.collection-filter-empty {padding:24px;color:var(--muted);}
@media(max-width:680px){#collection-filters label {flex:1 1 130px;}#collection-filters select {width:100%;}}
.section-collapse-toggle {display:flex;align-items:center;width:100%;border:0;background:none;text-align:left;color:inherit;font:inherit;font-weight:600;padding:12px 16px;}
.mixed-collection-section .collection-section-heading {padding:0;}
.section-collapse-toggle:hover {background:var(--hover);}
.collection-page-heading .collection-description {font-size:14px;line-height:1.6;color:var(--ink);white-space:pre-wrap;overflow-wrap:anywhere;max-width:70ch;}
#collection-description-dialog {max-width:520px;width:calc(100vw - 32px);box-sizing:border-box;}
#collection-description-input {display:block;box-sizing:border-box;width:100%;margin:10px 0;resize:vertical;font:inherit;line-height:1.5;color:var(--ink);background:var(--bg);border:1px solid var(--line);border-radius:8px;padding:12px;}
.section-collapse-toggle::before {content:'▾';margin-right:8px;display:inline-block;}
.section-collapse-toggle[aria-expanded="false"]::before {transform:rotate(-90deg);}
.collection-page-heading > button {margin-bottom:12px;}
/* Keep the collection header compact so its items lead the page. */
.collection-page #collection-section-tools {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px 20px;align-items:center;padding:14px 24px;}
.collection-page-heading > .muted {display:none;}
.collection-page-heading h1 {font-size:24px;margin:0 0 4px;}
.collection-page-heading p {margin:4px 0;font-size:12px;}
.collection-page-heading .collection-description {margin:5px 0;font-size:13px;line-height:1.45;}
.collection-page-heading > button {margin:4px 0 0;padding:0;border:0;background:none;color:var(--muted);font-size:12px;min-height:24px;}
.collection-page-actions {justify-content:flex-end;align-self:start;gap:6px;}
.collection-page-actions button {padding:6px 10px;font-size:12px;}
#collection-filters {grid-column:1/-1;margin-top:0;padding-top:8px;gap:8px 12px;}
#collection-filters label {gap:3px;}
#collection-filters select {padding:5px 7px;}
#collection-filter-count {flex-basis:auto;margin-left:auto;}
.collection-filter-toggle {font-size:12px;padding:5px 10px;}
#collection-filters.filters-closed > label,#collection-filters.filters-closed > button:not(.collection-filter-toggle) {display:none;}
.collection-page #note-list {padding-top:0;}
@media(max-width:680px){
 .collection-page #collection-section-tools {grid-template-columns:minmax(0,1fr);padding:12px 16px;gap:8px;}
 .collection-page-actions {justify-content:flex-start;}
 #collection-filters {grid-column:1;}
 .collection-page-heading h1 {font-size:22px;}
}
#collection-duplicate-review {width:calc(100vw - 32px);max-width:620px;max-height:85dvh;overflow:auto;box-sizing:border-box;}
#collection-duplicate-review p {line-height:1.5;overflow-wrap:anywhere;}
.duplicate-review-row {padding:14px 0;border-top:1px solid var(--line);}
.duplicate-review-row h3 {margin:4px 0;}
.duplicate-review-row .muted {font-size:12px;color:var(--muted);}
.review-duplicate-links {color:var(--accent);}

/* Synced Collections retain the compact workspace header. */
#collection-sync-status {font-size:11px; color:var(--muted);padding:3px 6px;white-space:nowrap}
#collection-sync-status.error {color:var(--danger,#ff6969)}
.synced-collection-icon {display:inline-block;margin-right:.35em;font-size:.8em;vertical-align:baseline}

/* Shared app/web hierarchy: identity and purpose first, management in one menu. */
.collection-page-heading h1 {display:flex;align-items:center;gap:9px;overflow-wrap:anywhere;}
.collection-page-heading .synced-collection-icon {flex:none;margin:0;line-height:1.25;}
.collection-actions-menu {position:relative;align-self:start;}
.collection-actions-menu summary {list-style:none;cursor:pointer;border:1px solid var(--line);border-radius:8px;padding:6px 12px;min-height:20px;font-weight:600;}
.collection-actions-menu summary::-webkit-details-marker {display:none;}
.collection-actions-commands {position:absolute;right:0;top:calc(100% + 6px);z-index:15;display:grid;min-width:230px;padding:6px;background:var(--bg);border:1px solid var(--line);border-radius:10px;box-shadow:0 8px 30px #0004;}
.collection-actions-commands button {border:0;background:none;text-align:left;padding:10px 12px!important;font-size:13px!important;}
.collection-actions-commands button:hover {background:var(--hover);}
.collection-actions-menu summary:focus-visible {outline:2px solid var(--accent);outline-offset:2px;}
#collection-merge-dialog {box-sizing:border-box;max-width:560px;width:calc(100vw - 32px);max-height:85dvh;overflow:auto;}
#collection-merge-target {display:block;box-sizing:border-box;width:100%;padding:10px;margin:8px 0 16px;font:inherit;color:var(--ink);background:var(--bg);border:1px solid var(--line);border-radius:8px;}
#collection-merge-preview {font-size:14px;line-height:1.5;overflow-wrap:anywhere;}

.collection-page-heading .collection-description {display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;}

/* Collection extras: icons, progress, status, brief, selection, dialogs. Flat: solid fills only. */
.collection-icon { flex: none; vertical-align: -0.15em; }
.synced-collection-icon { display: inline-flex; margin-right: 10px; vertical-align: -3px; }
.collection-nav-icon { display: inline-flex; align-items: center; justify-content: center; }
.nav-item { position: relative; }
.nav-item .nav-status { font-size: 11px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.nav-item.collection-status-done .nav-label { color: var(--muted); }
.nav-item .nav-progress { position: absolute; left: 34px; right: 12px; bottom: 3px; height: 2px; border-radius: 1px; background: var(--line); overflow: hidden; }
.nav-item .nav-progress span { display: block; height: 100%; }
.nav-item.drop-target { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--hover); }
.collection-status-filter { display: flex; align-items: center; gap: 8px; padding: 2px 10px 6px; font-size: 12px; color: var(--muted); }
.collection-status-filter[hidden] { display: none; }
.collection-status-filter select { flex: 1; min-width: 0; padding: 4px 6px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.collection-status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px !important; font-size: 13px; font-weight: 600; }
.collection-status-chip { padding: 2px 8px; border-radius: 999px; background: var(--list); border: 1px solid var(--line); color: var(--ink); }
.collection-status-chip.status-onHold { color: #b25e00; }
.collection-status-chip.status-done { color: #1f8a3b; }
.collection-target { color: var(--muted); }
.collection-target.late, .collection-overdue { color: #d12f2f; }
.collection-progress { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; max-width: 420px; font-size: 12px; color: var(--muted); }
.collection-progress-track { flex: 1; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.collection-progress-fill { display: block; height: 100%; background: var(--accent); }
.collection-progress-label { white-space: nowrap; font-variant-numeric: tabular-nums; }
.collection-brief { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 720px; text-align: left; margin: 0 0 16px; padding: 14px 16px; background: var(--list); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); font: inherit; }
button.collection-brief { cursor: pointer; }
button.collection-brief:hover { background: var(--hover); }
.collection-brief-label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.collection-brief-preview { color: var(--muted); font-size: 14px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.next-up-reason { font-weight: 700; color: var(--accent); margin-right: 8px; }
.collection-suggestion, .collection-unavailable-row { gap: 12px; padding: 10px 16px; }
.collection-suggestion-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.collection-suggestion-text strong { overflow-wrap: anywhere; font-weight: 600; }
.collection-suggestion-text small { color: var(--muted); }
.collection-unavailable .collection-suggestion-text strong { color: var(--muted); }
.collection-unavailable-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 10px 16px 14px; font-size: 12px; color: var(--muted); }
.collection-unavailable-footer p { margin: 0; flex: 1 1 260px; }
.collection-select-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.collection-select-row > input { flex: none; width: 20px; height: 20px; margin: 0 6px 0 14px; }
.collection-select-row > .note-card, .collection-select-row > .collection-linked-row { flex: 1; min-width: 0; border-bottom: 0; }
.collection-select-row .mixed-item-controls { display: none; }
#collection-selection-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; font-size: 13px; }
#collection-selection-count { flex: 1 1 auto; font-weight: 600; }
#collection-selection-bar select { padding: 6px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; font: inherit; }
#collection-selection-remove:not(:disabled) { color: #d12f2f; }
.collection-extras-dialog { max-width: min(560px, calc(100vw - 32px)); width: 100%; max-height: 85dvh; overflow: auto; box-sizing: border-box; }
.collection-extras-dialog .workspace-field { margin: 12px 0; }
.collection-rule-row { display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr) auto; gap: 8px; margin: 8px 0; }
.collection-rule-row select, .collection-rule-row input, .collection-extras-dialog input[type=date] { min-width: 0; padding: 7px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.collection-activity h3 { font-size: 12px; color: var(--muted); margin: 16px 0 4px; }
.collection-activity-row { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.collection-activity-row time { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.collection-appearance-preview { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; }
.collection-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin: 12px 0; }
.collection-swatch { aspect-ratio: 1; min-height: 28px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.collection-swatch[aria-checked=true] { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--bg); }
.collection-icon-groups h3 { font-size: 12px; color: var(--muted); margin: 14px 0 6px; }
.collection-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.collection-icon-choice { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0; border-radius: 8px; color: var(--ink); }
.collection-icon-choice[aria-checked=true] { background: var(--accent); color: white; border-color: var(--accent); }
@media (pointer: coarse) { .collection-select-row > input { width: 24px; height: 24px; } .collection-swatch { min-height: 36px; } }
@media (prefers-color-scheme: dark) { .collection-status-chip.status-onHold { color: #ffb54d; } .collection-status-chip.status-done { color: #4cd964; } .collection-target.late, .collection-overdue, #collection-selection-remove:not(:disabled) { color: #ff6b6b; } }
.collection-next-up > .collection-section-heading, .collection-smart-matches > .collection-section-heading, .collection-unavailable > .collection-section-heading { padding: 12px 16px; font-weight: 600; }

/* Collections UI pass 2: chips, summary card, grouped menu, overview grid, task checks. Flat fills only. */
#collection-filters { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; margin-top: 6px; }
#collection-filters::-webkit-scrollbar { display: none; }
.filter-chip { flex: none; min-height: 32px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--list); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.filter-chip[aria-pressed=true], .filter-chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-chip.reset { background: transparent; color: var(--muted); }
select.filter-chip { appearance: none; -webkit-appearance: none; padding-right: 14px; field-sizing: content; width: auto; max-width: 180px; }
#collection-filter-count { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.collection-summary-card { padding: 18px 20px 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--list); margin-bottom: 14px; }
.collection-summary-card h1 { margin-top: 2px !important; }
.collection-summary-card > p { margin: 6px 0 10px !important; }
.collection-next-line { font-size: 14px !important; color: var(--ink) !important; }
.collection-next-line .late { color: #d12f2f; font-weight: 600; }
.collection-activity-row-button { display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box; margin: 8px 0 0; padding: 10px 0 12px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; color: var(--ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.collection-activity-row-button:hover strong { color: var(--accent); }
.collection-activity-row-button span:not(:last-child) { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-activity-row-button span:last-child { color: var(--muted); font-size: 18px; margin-left: auto; }
.collection-actions-group { display: flex; flex-direction: column; padding: 4px 0; }
.collection-actions-group + .collection-actions-group { border-top: 1px solid var(--line); }
.collection-actions-heading { margin: 4px 12px 2px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.collection-actions-group.danger button { color: #d12f2f; }
.nav-item .nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .nav-status { flex: none; margin-left: auto; padding-left: 6px; }
#collections-overview-button[aria-pressed=true] { color: var(--accent); font-weight: 700; }
.collection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; padding: 4px 0 24px; }
.collection-tile { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-height: 160px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--list); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.collection-tile:hover { background: var(--hover); }
.collection-tile.done { opacity: .7; }
.collection-tile-top { display: flex; align-items: center; gap: 8px; }
.collection-tile-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 11px; background: color-mix(in srgb, currentColor 14%, transparent); }
.collection-tile-pin { margin-left: auto; font-size: 11px; color: var(--muted); }
.collection-tile-top .collection-ring { margin-left: auto; flex: none; }
.collection-tile-pin + .collection-ring { margin-left: 4px; }
.collection-tile-name { font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.collection-tile .collection-status-line { margin: 0 !important; font-size: 12px; }
.collection-tile-meta { margin-top: auto; font-size: 12px; color: var(--muted); }
.collection-task-check { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin: 0 0 0 14px; padding: 0; border-radius: 50%; border: 2px solid var(--task, var(--accent)); background: transparent; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.collection-task-check.checked { background: var(--task, var(--accent)); }
.collection-task-check:disabled { cursor: default; opacity: .6; }
.collection-linked-row.pending-change .note-card-title { text-decoration: line-through; opacity: .7; }
@media (pointer: coarse) { .collection-task-check { width: 28px; height: 28px; } .filter-chip { min-height: 38px; } }
@media (prefers-color-scheme: dark) { .collection-next-line .late, .collection-actions-group.danger button { color: #ff6b6b; } }

/* Collections dashboard: strip header, two columns of foldable cards; one column on phones. Flat fills. */
.collection-strip { display: flex; flex-wrap: wrap; align-items: center; column-gap: 14px; row-gap: 4px; padding: 0 0 4px; border: 0; background: none; margin: 0; }
.collection-strip > .muted { display: none; }
.collection-strip h1 { font-size: 24px !important; margin: 0 !important; }
.collection-strip > p { margin: 0 !important; }
.collection-strip .collection-progress { margin: 0; min-width: 180px; flex: 0 1 260px; }
.collection-strip .collection-description, .collection-strip .collection-next-line, .collection-strip .collection-activity-row-button { display: none; }
.collection-dashboard { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-card { border: 1px solid var(--line); border-radius: 16px; background: var(--list); overflow: hidden; }
.dash-card > summary { display: flex; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.dash-card > summary::-webkit-details-marker { display: none; }
.dash-card > summary::after { content: '⌄'; margin-left: auto; transition: transform .15s; }
.dash-card:not([open]) > summary::after { transform: rotate(-90deg); }
.dash-card > summary .count { padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--ink); font-size: 11px; text-transform: none; }
.dash-body { border-top: 1px solid var(--line); }
.dash-body > .note-card, .dash-body > .collection-linked-row { border-bottom: 1px solid var(--line); }
.dash-body > :last-child { border-bottom: 0; }
.dash-body .mixed-collection-section { margin: 0; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.dash-body .collection-section-heading.drop-target { outline: 2px solid var(--accent); outline-offset: -2px; }
.dash-body p.collection-description { margin: 12px 16px; color: var(--ink); line-height: 1.5; }
.dash-body .collection-brief { margin: 0; border: 0; border-radius: 0; }
.dash-prompt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; font-size: 13px; color: var(--muted); }
.dash-fold > summary { padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.dash-quick-add { padding: 10px 12px 6px; border-bottom: 1px solid var(--line); }
.dash-quick-add .quick-add { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.dash-quick-add .quick-add:focus-within { border-color: var(--accent); }
.dash-quick-add input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; padding: 6px 0; outline: none; }
.dash-quick-add .quick-add-icon { color: var(--accent); font-weight: 700; }
.dash-quick-add .quick-add-hint { min-height: 14px; padding: 4px 4px 0; font-size: 12px; color: var(--accent); }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 10px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border: 1px solid transparent; border-radius: 10px; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.week-day .wd { font-size: 11px; color: var(--muted); }
.week-day.today strong { color: var(--accent); }
.week-day.selected { background: var(--accent); color: #fff; }
.week-day.selected .wd, .week-day.selected strong { color: #fff; }
.week-day .dots { display: flex; gap: 2px; min-height: 6px; }
.week-day .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.week-day .dots i.tk { background: var(--muted); }
.dash-activity-list { list-style: none; margin: 0; padding: 4px 0; }
.dash-activity-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 16px; font-size: 13px; }
.dash-activity-list time { flex: none; color: var(--muted); font-size: 12px; }
.dash-body > button { margin: 8px 16px 12px; }
.dash-day-filter { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.layout-row { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.layout-row label { flex: 1; display: flex; align-items: center; gap: 8px; }
#collection-layout-dialog h3 { font-size: 12px; text-transform: uppercase; color: var(--muted); margin: 14px 0 4px; }
/* The Collections home */
.overview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.overview-head h1 { font-size: 26px; margin: 0; }
.overview-totals { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.overview-total { padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--list); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.overview-total strong { color: var(--ink); font-size: 17px; margin-right: 2px; }
.overview-total.late strong { color: #d12f2f; }
.overview-total.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--list)); }
.overview-dashboard { display: flex; flex-direction: column; gap: 18px; padding-bottom: 24px; }
.overview-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.overview-card { border: 1px solid var(--line); border-radius: 16px; background: var(--list); padding: 6px 0 8px; min-width: 0; }
.overview-card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); margin: 8px 16px 6px; }
.due-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 2px; border-top: 1px solid var(--line); }
.due-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.due-text strong { overflow-wrap: anywhere; font-weight: 600; }
.due-text small { color: var(--muted); }
.due-row.late .due-text small { color: #d12f2f; }
.due-collection { flex: none; display: inline-flex; align-items: center; gap: 4px; max-width: 40%; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.overview-pinned .collection-grid { padding: 6px 12px 4px; }
.collection-tile.big { min-height: 150px; }
.collection-tile-next { font-size: 12px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview-group > summary { cursor: pointer; padding: 6px 0 10px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
@media (max-width: 1100px) { .collection-dashboard { grid-template-columns: minmax(0, 1.2fr) minmax(260px, 1fr); } .overview-top { grid-template-columns: 1fr; } }
@media (max-width: 680px) {
  .collection-dashboard { display: flex; flex-direction: column; }
  .dash-col { display: contents; }
  .collection-dashboard > .dash-col > .dash-card { order: var(--phone-order, 50); }
  .overview-dashboard .collection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-color-scheme: dark) { .overview-total.late strong, .due-row.late .due-text small { color: #ff6b6b; } }
/* Projects: sections as a chip row above the filters. */
#collection-projects { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; margin-top: 6px; }
#collection-projects::-webkit-scrollbar { display: none; }
.project-chip { font-weight: 700; }
.project-chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.collection-project-label { padding: 3px 10px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 700; }

/* Calm working collections: projects stay visible; other filters share a menu. */
#collection-filters.collection-filter-popup { position:relative; display:block; overflow:visible; margin:0; padding:0; }
.collection-filter-popup > summary { cursor:pointer; list-style:none; border:1px solid var(--line); border-radius:9px; padding:8px 12px; min-height:40px; font-weight:600; }
.collection-filter-panel { position:static; width:min(480px,100%); padding:14px; display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:12px; border:1px solid var(--line); border-radius:12px; background:var(--bg); }
.collection-filter-panel label { display:grid; gap:4px; font-size:13px; color:var(--muted); }
.collection-filter-panel select,.collection-filter-panel button { min-height:40px; padding:6px 10px; }
.collection-compact-description { display:block !important; max-width:70ch; overflow:hidden; margin:3px 0 0; color:var(--muted); font-size:13px; }
.overview-head { flex-wrap:wrap; }
.overview-head button,#collection-home-layout { min-height:40px; }
.overview-dashboard .collection-grid.compact-list { grid-template-columns:minmax(0,1fr); }
.collection-tile.compact { min-height:72px; display:grid; grid-template-columns:42px minmax(0,1fr) auto; column-gap:12px; row-gap:3px; align-items:center; padding:12px; }
.collection-tile.compact .collection-tile-top { grid-column:1; grid-row:1 / span 3; margin:0; }
.collection-tile.compact .collection-tile-name,.collection-tile.compact .collection-tile-meta,.collection-tile.compact .collection-status-line { grid-column:2; margin:0; min-height:0; }
.collection-home-pin { font-size:11px; color:var(--muted); }
.collection-tile.compact .collection-home-pin { grid-column:3; grid-row:1 / span 3; }
.overview-pinned h2 { font-size:14px; color:var(--muted); margin:0 0 8px; }
.due-collection-links { display:flex; flex-wrap:wrap; gap:6px; }
.due-text { text-align:left; }
.due-row { flex-wrap:wrap; }
.due-collection-links .due-collection { min-height:36px; }
.collection-home-result-count { color:var(--muted); font-size:13px; }
#collection-sync-status:not(.error):not(.pending) { font-size:12px; color:var(--muted); }

.collection-filter-panel label,.collection-filter-panel select { min-width:0;max-width:100%; }
#collection-sync-status.pending { color:var(--accent);font-size:13px; }
