/* Collection controls stay scoped to collection screens. */
.collection-toolbar{display:flex;flex-wrap:wrap;justify-content:flex-start;margin-bottom:16px}
.collection-library .collection-card{gap:14px}
.collection-library .collection-card>svg{flex:none}
.collection-library .collection-card>div{min-width:0}
.collection-heading{display:flex;align-items:center;gap:12px;color:var(--muted);margin:4px 0 20px;font-size:14px}
.collection-heading>svg{color:var(--accent-ink)}
.collection-actions{display:flex;flex-wrap:wrap;gap:12px;margin-bottom:24px}
.collection-actions .btn{min-height:46px;font-size:13px}
.collection-habits.habits-v2 .habits-list{display:grid;grid-template-columns:minmax(0,1fr);gap:16px;padding:2px 0 8px}
.collection-habits .habit-card{margin:0;min-width:0}
.collection-habits .habit-body{min-width:0;text-align:left}
.collection-habits .habit-body h3{overflow-wrap:anywhere}
.collection-habits .habit-action{flex-shrink:0;min-width:44px;min-height:44px}
.collection-editor{display:grid;gap:20px}
.collection-editor .field{margin:0}
.collection-icon-picker{border:1px solid var(--line);border-radius:16px;background:var(--surface-2)}
.collection-icon-picker>summary{display:flex;align-items:center;gap:12px;padding:14px;cursor:pointer;min-height:56px;list-style:none;font-size:14px}
.collection-icon-picker>summary::-webkit-details-marker{display:none}
.collection-icon-picker>summary>svg:last-child{margin-left:auto}
.collection-icon-picker [data-collection-icon-preview]{display:flex;color:var(--accent-ink)}
.collection-icon-picker .icon-grid{padding:0 12px 12px;max-height:330px;overflow:auto;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.collection-icon-picker .icon-option{min-height:74px;height:auto;padding:9px 4px;gap:6px}
.collection-icon-picker .icon-option>span{font-size:10px;line-height:1.35;overflow-wrap:anywhere}
.collection-icon-picker .icon-option[aria-pressed=true]{background:var(--accent-soft);border-color:var(--accent);color:var(--text)}
.collection-delete-action{border-top:1px solid var(--line);padding-top:18px}
.collection-delete-action .btn{color:var(--danger)}
.collection-members>p,.collection-delete p,.collection-detail>p{font-size:14px;line-height:1.65;margin:12px 0 20px}
.collection-member-list{display:grid;gap:12px}
.collection-member{display:flex;align-items:center;gap:12px;padding:14px;border:1px solid var(--line);border-radius:16px;background:var(--surface-2);min-height:74px;cursor:pointer}
.collection-member:has(input:checked){border-color:var(--accent);background:var(--accent-soft)}
.collection-member input{width:22px;height:22px;flex:none;accent-color:var(--accent)}
.collection-member-icon{display:flex;flex:none}
.collection-member>span:last-child{min-width:0;display:grid;gap:6px}
.collection-member strong{font-size:14px;line-height:1.45;overflow-wrap:anywhere}
.collection-member small{font-size:12px;line-height:1.4;color:var(--muted);overflow-wrap:anywhere}
/* Habit list and editor; deliberately scoped away from tasks and calendar. */
.habit-week-strip{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:3px;margin:0 auto 15px;max-width:750px}
.habit-week-strip>.icon-btn{width:44px;min-width:44px;height:64px;padding:0;color:var(--muted)}
.habit-week-strip>.icon-btn svg{width:18px;height:18px}
.habit-week-strip .week{margin:0;width:100%;max-width:none;gap:5px}
.habit-week-strip .day{min-width:0;min-height:77px;border-radius:20px;padding:10px 1px;gap:6px}
.habit-week-strip .day>strong{font-size:20px}
.habit-week-strip .day>span:first-child{font-size:10px}
.habit-day-summary{display:grid;grid-template-columns:1fr auto;gap:7px 12px;margin:0 3px 18px;color:var(--muted);font-size:12px}
.habit-day-summary>strong{color:var(--text);font-size:13px}
.habit-day-summary>strong>span{color:var(--muted);font-weight:400}
.habit-day-summary .progress-track{grid-column:1/-1;margin:0;height:3px}
.habits-v2 .habits-list{gap:9px}
.habits-v2 .habit-card{min-height:88px;padding:12px 14px;gap:14px;border-radius:23px}
.habits-v2 .icon-tile{width:55px;min-width:55px;height:55px;border-radius:18px}
.habits-v2 .habit-body{min-height:52px;padding:3px 0}
.habits-v2 .habit-body h3{font-size:15px;line-height:1.35}
.habits-v2 .habit-body .habit-progress{margin-top:4px;font-size:11px}
.habits-v2 .footnote{margin-top:20px}
.sheet:has(.habit-editor-v2){background:var(--bg);max-width:540px}
.sheet:has(.habit-editor-v2) .sheet-header{padding-bottom:18px}
.sheet:has(.habit-editor-v2) .sheet-header h2{font-size:20px;font-weight:700}
.sheet:has(.habit-editor-v2) .sheet-footer{background:var(--bg);border-top:0;padding-top:14px}
.sheet:has(.habit-editor-v2) .sheet-footer .btn.primary{width:100%;min-height:53px;font-size:16px;border-radius:17px}
.habit-editor-v2{--habit-control:var(--control);--habit-selected:var(--accent);display:flex;flex-direction:column;gap:13px;padding-bottom:2px}
.habit-editor-v2 .field{margin:0;gap:8px}
.habit-editor-v2 .field>span{font-size:12px;color:var(--muted)}
.habit-editor-v2 .field input:not([type=checkbox]):not([type=color]):not([type=range]),.habit-editor-v2 .field textarea{background:var(--habit-control);border:1px solid var(--line);border-radius:16px;min-height:53px;padding:14px 16px;font-size:15px}
.habit-editor-v2 .field input:focus,.habit-editor-v2 .field textarea:focus{border-color:var(--accent)}
.habit-editor-v2 .habit-name input:not([type=hidden]){font-size:18px;min-height:60px;font-weight:500}
.habit-appearance{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}
.habit-appearance-button{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 15px;min-height:77px;border-radius:18px;background:var(--habit-control);text-align:left;font-size:16px}
.habit-appearance-button>span:first-child{min-width:0}
.habit-icon-preview{display:flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:14px;color:var(--text);flex:none}
.habit-appearance-button>i{display:block;width:37px;height:37px;border-radius:50%;flex:none;margin:0 3px}
.habit-form-section{display:flex;flex-direction:column;gap:11px;margin-top:8px}
.habit-form-section>h3{font-size:13px;color:var(--muted);font-weight:500;margin:3px 0 2px}
.habit-goal-segment{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));padding:4px;border-radius:17px;background:var(--habit-control);gap:3px}
.habit-goal-segment button{min-width:0;min-height:48px;border-radius:13px;font-size:15px;padding:9px 5px;color:var(--text)}
.habit-goal-segment button[aria-pressed=true]{color:var(--accent-contrast);background:var(--habit-selected)}
.habit-summary-row{display:grid;grid-template-columns:minmax(0,1fr) 94px;gap:11px;align-items:stretch}
.habit-summary{display:flex;align-items:center;justify-content:center;min-width:0;min-height:53px;background:var(--habit-control);border-radius:16px;padding:12px;font-size:15px;font-weight:500;overflow-wrap:anywhere;text-align:center}
.habit-summary.accent{background:var(--habit-selected);color:var(--accent-contrast);font-variant-numeric:tabular-nums}
.habit-change{min-width:0;min-height:53px;background:var(--habit-control);border-radius:16px;font-size:14px;padding:12px 8px}
.habit-summary-row:has(>.habit-change[hidden]){grid-template-columns:1fr}
.habit-picker-panel{padding:14px;border:1px solid var(--line);border-radius:17px;background:var(--surface-2);display:flex;flex-direction:column;gap:13px}
.habit-picker-panel .search{margin:0;min-height:46px}
.habit-picker-panel .search input{min-width:0}
.habit-picker-panel .icon-grid{max-height:240px;overflow:auto;grid-template-columns:repeat(6,minmax(0,1fr));gap:5px;padding:1px}
.habit-picker-panel .icon-option{min-width:0;min-height:48px;height:auto;flex-direction:column;gap:5px;padding:7px 2px}
.habit-picker-panel .icon-option>span{font-size:8px;line-height:1.2;max-width:100%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}
.habit-picker-panel .icon-option[aria-pressed=true]{border-color:var(--accent);background:var(--accent-soft)}
.habit-color-options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.habit-color-options>button{display:flex;align-items:center;justify-content:center;min-height:48px;border:2px solid transparent;border-radius:13px;background:var(--swatch);color:var(--swatch-contrast,#191724)}
.habit-color-options>button svg{visibility:hidden}
.habit-color-options>button[aria-pressed=true]{border-color:var(--text)}
.habit-color-options>button[aria-pressed=true] svg{visibility:visible}
.habit-custom-color{display:flex;align-items:center;justify-content:space-between;gap:15px;min-height:46px;font-size:13px;color:var(--muted)}
.habit-custom-color input{width:52px;height:42px;border:0;background:transparent;padding:0}
.habit-form-section>.choice-field>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.habit-editor-v2 .choice-control>summary{min-height:55px;background:var(--habit-control);border:0;border-radius:16px;padding:13px 16px;font-size:15px}
.habit-editor-v2 .choice-options{background:var(--surface-2);border-radius:15px}
.habit-editor-v2 .choice-options button{min-height:47px;font-size:13px}
.habit-weekdays{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:5px}
.habit-weekdays>label{position:relative;display:block;min-width:0;cursor:pointer}
.habit-weekdays input{position:absolute;opacity:0;inset:0;width:100%;height:100%;margin:0;cursor:pointer}
.habit-weekdays span{display:flex;align-items:center;justify-content:center;min-height:48px;background:var(--habit-control);border-radius:24px;font-size:13px}
.habit-weekdays input:checked+span{background:var(--habit-selected);color:var(--accent-contrast)}
.habit-weekdays input:focus-visible+span{outline:2px solid var(--accent);outline-offset:2px}
.habit-advanced{margin-top:5px;border-top:1px solid var(--line);padding-top:6px}
.habit-advanced>summary{display:flex;align-items:center;justify-content:space-between;gap:10px;list-style:none;min-height:48px;color:var(--muted);font-size:13px;cursor:pointer}
.habit-advanced>summary::-webkit-details-marker{display:none}
.habit-advanced[open]>summary svg{transform:rotate(180deg)}
.habit-advanced-body{display:flex;flex-direction:column;gap:16px;padding:8px 0}
.habit-advanced-body .small{font-size:11px;line-height:1.7}
.habit-editor-v2 .date-trigger{min-height:53px;background:var(--habit-control);border:0;border-radius:16px}
.habit-fixed-date{padding:15px 16px;background:var(--habit-control);border-radius:16px;font-size:14px;color:var(--muted)}
@media(max-width:560px){
 .habit-week-strip{grid-template-columns:26px minmax(0,1fr) 26px;gap:0;margin-inline:-19px;margin-bottom:14px;max-width:none}
 .habit-week-strip>.icon-btn{min-width:26px;width:26px;height:76px;border-radius:10px}
 .habit-week-strip .week{gap:0}
 .habit-week-strip .day{min-height:76px;border-radius:19px}
 .habit-week-strip .day>strong{font-size:19px}
 .habit-week-strip .day>span:first-child{font-size:9px}
 .habits-v2 .habit-card{min-height:84px;padding:10px 12px;gap:12px}
 .habits-v2 .icon-tile{width:53px;min-width:53px;height:53px}
 .sheet:has(.habit-editor-v2) .sheet-header{padding-bottom:15px}
 .sheet:has(.habit-editor-v2) .sheet-content{padding-top:4px}
 .habit-editor-v2{gap:11px}
 .habit-appearance-button{padding:12px;font-size:15px;min-height:75px}
 .habit-summary-row{grid-template-columns:minmax(0,1fr) 85px;gap:9px}
 .habit-picker-panel .icon-grid{grid-template-columns:repeat(5,minmax(0,1fr))}
}
@media(max-width:374px){.habit-week-strip{margin-inline:-15px}.habit-weekdays{gap:3px}.habit-appearance{gap:9px}.habit-appearance-button{padding:10px}.habit-icon-preview{width:44px;height:44px}.habit-appearance-button>i{width:34px;height:34px}.habits-v2 .habit-body h3{font-size:14px}}
