/* Task component system, shared by the official task route and its legacy alias. */
body[data-page="tasks"]{--task-ui-surface:color-mix(in srgb,var(--ink) 4%,var(--bg));--task-ui-hover:color-mix(in srgb,var(--ink) 7%,var(--bg));--task-ui-space-xs:4px;--task-ui-space-sm:8px;--task-ui-space-md:16px;--task-ui-space-lg:24px}
body[data-page="tasks"] main{padding-top:24px}
body[data-page="tasks"] .category-toolbar{margin-bottom:12px}
body[data-page="tasks"] .category-rail{padding:2px 0;gap:8px}
body[data-page="tasks"] .category-filter{min-height:44px;padding:10px 14px;border-color:transparent;background:var(--task-ui-surface);font-size:14px;border-radius:22px}
body[data-page="tasks"] .category-filter.selected{background:var(--ink);color:var(--inverse)}
body[data-page="tasks"] .create-category{background:transparent;color:var(--muted)}
body[data-page="tasks"] .task-view-tabs{gap:24px;margin-bottom:20px}
body[data-page="tasks"] .task-view-tabs .filter{font-size:14px;min-height:44px}
body[data-page="tasks"] .task-list-heading{align-items:center;margin-bottom:12px;gap:12px}
body[data-page="tasks"] .task-list-heading h2{font-size:22px;line-height:1.4}
body[data-page="tasks"] .task-list-heading .count{font-size:14px;margin-left:8px}
body[data-page="tasks"] .task-section-actions{gap:8px}
body[data-page="tasks"] .task-section-actions>.button{border-radius:22px;min-height:44px;padding:10px 16px;font-size:14px}
body[data-page="tasks"] .work-task-list{gap:12px}
body[data-page="tasks"] .task-support{margin-top:24px;padding-top:12px;border-top:1px solid var(--line)}
@media(min-width:760px){body[data-page="tasks"] .task-support{display:none}}
body[data-page="tasks"] .preview-task-card{display:grid;grid-template-columns:minmax(0,1fr) 16px;align-items:center;gap:12px;min-height:80px;padding:16px;border:0;border-radius:20px;background:var(--task-ui-surface);transition:background .15s ease-out}
body[data-page="tasks"] .preview-task-card:hover{background:var(--task-ui-hover)}
body[data-page="tasks"] .preview-task-copy{display:grid;gap:4px;min-width:0}
body[data-page="tasks"] .preview-task-title{display:flex;align-items:center;gap:8px;min-width:0}
body[data-page="tasks"] .preview-task-title>strong{font-family:"PingFang SC","Microsoft YaHei",sans-serif;font-size:16px;font-weight:600;font-variant-numeric:normal;line-height:1.5;min-width:0;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
body[data-page="tasks"] .preview-task-title .category-tag{font-size:12px;font-weight:600;line-height:1.5;max-width:92px;flex-shrink:0;margin:0;padding:3px 8px;border:1px solid var(--strong);border-radius:7px;background:var(--bg);color:var(--ink);align-self:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body[data-page="tasks"] .preview-task-meta{display:flex;align-items:baseline;gap:8px 16px;min-width:0}
body[data-page="tasks"] .work-task-schedule{font-size:13px;line-height:1.5;min-width:0;flex:1;color:var(--muted);overflow-wrap:anywhere}
body[data-page="tasks"] .work-task-count{font-size:13px;line-height:1.5;color:var(--muted);white-space:nowrap;flex-shrink:0}
body[data-page="tasks"] .preview-task-chevron{width:16px;height:16px;color:var(--muted)}
body[data-page="tasks"] .lifecycle-tag{font-size:12px;border:0;background:var(--bg)}
body[data-page="tasks"] dialog{border:0;border-radius:24px;background:var(--bg);box-shadow:0 20px 64px #0003;width:560px;overflow:hidden}
body[data-page="tasks"] dialog::backdrop{background:#0006}
body[data-page="tasks"] #dialog-content{padding:24px;display:flex;flex-direction:column;max-height:calc(100dvh - 32px);min-height:0;overflow:auto}
body[data-page="tasks"] dialog:has(#task-form) #dialog-content{padding:24px;max-height:calc(100dvh - 32px);overflow:hidden}
body[data-page="tasks"] .modal-head{margin-bottom:20px;align-items:center;flex-shrink:0;gap:12px}
body[data-page="tasks"] dialog:has(#task-form) .modal-head{margin-bottom:20px}
body[data-page="tasks"] .modal-head h2{font-size:22px;line-height:1.4;font-weight:600;overflow-wrap:anywhere}
body[data-page="tasks"] .modal-head .icon-button{width:44px;height:44px;flex-shrink:0;border-radius:50%;background:var(--task-ui-surface)}
body[data-page="tasks"] dialog .button{min-height:44px;border-radius:22px;padding:10px 18px;font-size:14px}
body[data-page="tasks"] dialog .button:not(.primary){background:transparent;border-color:transparent;color:var(--muted)}
body[data-page="tasks"] dialog .button.danger{color:var(--error)}
body[data-page="tasks"] dialog input:not([type=checkbox]):not([type=hidden]),body[data-page="tasks"] dialog select,body[data-page="tasks"] dialog textarea{border:1px solid transparent;background:var(--task-ui-surface);border-radius:16px;min-height:48px;padding:12px 14px;font-size:16px;margin-top:8px;min-width:0;caret-color:var(--ink)}
body[data-page="tasks"] dialog input:disabled,body[data-page="tasks"] dialog select:disabled{opacity:1;color:var(--muted)}
body[data-page="tasks"] dialog:has(#task-form) :is(input:not([type=checkbox]):not([type=hidden]),select,textarea){border-color:transparent;background:var(--task-ui-surface);border-radius:16px}
body[data-page="tasks"] #task-form{display:flex;flex-direction:column;min-height:0;overflow:hidden;padding:0}
body[data-page="tasks"] .task-design-form-body{overflow:auto;min-height:0;padding:4px 4px 4px;scrollbar-width:thin;scrollbar-color:var(--strong) transparent}
body[data-page="tasks"] .task-design-general{display:grid;gap:16px;margin-bottom:20px}
body[data-page="tasks"] .task-design-schedule{display:grid;gap:16px;border-top:1px solid var(--line);padding-top:20px}
body[data-page="tasks"] .task-design-form-body label{display:block;margin:0;font-size:13px;line-height:1.5;color:var(--muted)}
body[data-page="tasks"] .fixed-project{margin:0;font-size:13px;color:var(--muted)}
body[data-page="tasks"] .fixed-project strong{font-weight:500;color:var(--ink);margin-left:8px}
body[data-page="tasks"] .repeat-dates{margin:0;border-top:0}
body[data-page="tasks"] .repeat-dates>summary{min-height:44px;font-size:14px;gap:12px}
body[data-page="tasks"] .repeat-dates-value{font-size:13px}
body[data-page="tasks"] .repeat-dates .range-fields{margin:12px 0 0;gap:12px}
body[data-page="tasks"] .range-fields{margin:0;gap:12px}
body[data-page="tasks"] .range-calendar{border-color:var(--line);border-radius:16px;margin-top:16px;padding:12px}
body[data-page="tasks"] .weekday-picker{display:grid;grid-template-columns:repeat(7,minmax(44px,1fr));gap:6px;overflow:auto;padding:4px 0;scrollbar-width:none}
body[data-page="tasks"] .weekday-picker label{min-width:44px}
body[data-page="tasks"] .weekday-picker span{background:var(--task-ui-surface);border:0;border-radius:12px;height:44px;font-size:14px;color:var(--muted)}
body[data-page="tasks"] .weekday-picker input:checked+span{background:var(--ink);color:var(--inverse)}
body[data-page="tasks"] #task-form .modal-actions{position:static;flex-shrink:0;margin-top:20px;padding-top:16px;border-color:var(--line);gap:8px}
body[data-page="tasks"] .form-context{padding:0;border:0;margin:0 0 16px}
body[data-page="tasks"] .item-detail-meta{margin:0 0 20px;gap:8px 20px}
body[data-page="tasks"] .detail-facts{margin:0;gap:0}
body[data-page="tasks"] .detail-facts>div{grid-template-columns:72px minmax(0,1fr);align-items:center;min-height:56px;padding:6px 0;gap:16px;border-bottom:1px solid var(--line)}
body[data-page="tasks"] .detail-facts>div:last-child{border-bottom:0}
body[data-page="tasks"] .detail-facts dt{font-size:13px;line-height:1.5}
body[data-page="tasks"] .detail-facts dd{font-size:15px;line-height:1.5;font-weight:500}
body[data-page="tasks"] .detail-facts .detail-category{display:flex;justify-content:space-between;align-items:center;width:100%;font-weight:500;line-height:1.5}
body[data-page="tasks"] .detail-facts [data-action="focus-list"] span{font-size:20px;font-weight:600;font-variant-numeric:tabular-nums}
body[data-page="tasks"] .task-detail>.detail-actions>.button{color:var(--ink);background:var(--task-ui-surface)}
body[data-page="tasks"] .task-detail>.detail-actions>.button.primary{color:var(--inverse);background:var(--ink)}
body[data-page="tasks"] .category-select-field{display:grid;gap:8px;margin:20px 0;font-size:13px;color:var(--muted)}
body[data-page="tasks"] .category-select-trigger{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:48px;padding:12px 14px;background:var(--task-ui-surface);color:var(--ink);border:0;border-radius:16px;text-align:left;font-size:16px}
body[data-page="tasks"] .category-select-trigger>span{min-width:0;overflow-wrap:anywhere}
body[data-page="tasks"] .category-select-trigger>.icon{width:16px;height:16px;flex-shrink:0;transform:rotate(90deg);color:var(--muted)}
body[data-page="tasks"] .category-select-trigger[aria-expanded="true"]>.icon{transform:rotate(-90deg)}
body[data-page="tasks"] .category-select-options{display:grid;max-height:240px;overflow:auto;overscroll-behavior:contain;padding:6px;border:1px solid var(--line);border-radius:16px;background:var(--bg);scrollbar-width:thin}
body[data-page="tasks"] .category-select-options>button{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;padding:10px 12px;border:0;border-radius:10px;background:transparent;text-align:left;font-size:15px;line-height:1.5}
body[data-page="tasks"] .category-select-options>button[aria-selected="true"],body[data-page="tasks"] .category-select-options>button:hover{background:var(--task-ui-surface)}
body[data-page="tasks"] .category-select-options>button .icon{width:16px;height:16px;flex-shrink:0}
body[data-page="tasks"] #move-category-form .category-move-scope{margin-top:20px}
body[data-page="tasks"] #move-category-form .move-category-context{font-size:16px;font-weight:500;color:var(--ink)}
body[data-page="tasks"] .detail-children{margin-top:24px}
body[data-page="tasks"] .detail-children h3{font-size:16px;margin-bottom:12px}
body[data-page="tasks"] .work-item-list{display:block}
body[data-page="tasks"] .work-item-card{width:100%;border:0;border-bottom:1px solid var(--line);border-radius:0;background:none;padding:12px 0;gap:4px;min-height:68px}
body[data-page="tasks"] .work-item-title{font-size:16px}
body[data-page="tasks"] .work-item-schedule{font-size:13px}
body[data-page="tasks"] .detail-actions{margin-top:24px;padding-top:16px;border-top:1px solid var(--line);gap:8px}
@media(max-width:599px){body[data-page="tasks"] dialog,body[data-page="tasks"] dialog:has(.task-detail){position:fixed;inset:auto 0 0;margin:0;width:100%;max-width:100%;max-height:90dvh;border-radius:24px 24px 0 0}body[data-page="tasks"] #dialog-content,body[data-page="tasks"] dialog:has(#task-form) #dialog-content{padding:24px 20px calc(20px + env(safe-area-inset-bottom));max-height:90dvh}body[data-page="tasks"] .task-design-general:has([name="projectId"]) [name="projectId"]{padding-right:24px}}
@media(max-width:370px){body[data-page="tasks"] .task-list-heading h2{font-size:22px}body[data-page="tasks"] .task-section-actions>.button{padding:10px 12px;font-size:14px}body[data-page="tasks"] .preview-task-meta{gap:8px;flex-wrap:wrap}body[data-page="tasks"] .preview-task-title .category-tag{max-width:76px}body[data-page="tasks"] .weekday-picker{grid-template-columns:repeat(4,minmax(44px,1fr))}}
@media(prefers-reduced-motion:reduce){body[data-page="tasks"] .preview-task-card,body[data-page="tasks"] .repeat-dates-value .icon{transition:none}}

/* Labels scroll within their rail; creation and editing stay outside it. */
body[data-page="tasks"] .category-toolbar{gap:8px;width:100%}
body[data-page="tasks"] .category-rail{overscroll-behavior-x:contain}
body[data-page="tasks"] .category-filter>span{min-width:0;overflow:hidden;text-overflow:ellipsis}
body[data-page="tasks"] .category-actions{flex:none;align-self:stretch;gap:4px;padding-left:8px;border-left:1px solid var(--line);background:var(--bg)}
body[data-page="tasks"] .category-actions .icon-button{background:var(--task-ui-surface)}
.category-edit-actions>.danger{margin-right:auto}

/* One vertical scroll owner, including native date controls and expanded calendars. */
dialog:has(#task-form){overflow:hidden;max-height:min(calc(100dvh - 32px),calc(var(--dialog-viewport-height,100dvh) - 16px))}
dialog:has(#task-form) #dialog-content,body[data-page="tasks"] dialog:has(#task-form) #dialog-content{overflow:hidden;min-width:0;max-height:min(calc(100dvh - 32px),calc(var(--dialog-viewport-height,100dvh) - 16px))}
dialog:has(#task-form) .modal-head{flex-shrink:0;min-width:0}
dialog:has(#task-form) .modal-head>div{min-width:0}
dialog:has(#task-form) .dialog-feedback{flex-shrink:0}
#task-form{display:flex;flex-direction:column;min-height:0;min-width:0;max-width:100%;overflow:hidden;padding:0}
.task-design-form-body,body[data-page="tasks"] .task-design-form-body{min-height:0;min-width:0;max-width:100%;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;touch-action:pan-y;scroll-padding-block:16px;scrollbar-width:thin}
.task-design-form-body>label{display:block;margin:20px 0;font-size:14px;line-height:1.7}
#task-form :is(.task-design-general,.task-design-schedule,.task-basics,.range-fields){min-width:0;grid-template-columns:minmax(0,1fr)}
#task-form .range-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
#task-form :is(label,#date-range,.range-calendar){min-width:0;max-width:100%}
#task-form :is(input:not([type="checkbox"]),select,textarea){min-width:0;max-width:100%;width:100%;box-sizing:border-box}
#task-form input[type="date"]{appearance:none;min-inline-size:0}
#task-form input::-webkit-date-and-time-value{min-width:0;text-align:left}
#task-form .range-day{min-width:0}
#task-form .modal-actions{position:static;flex-shrink:0}
@media(min-width:600px){#task-form .task-basics{grid-template-columns:1.15fr 1fr}}
@media(max-width:599px){
  dialog:has(#task-form),body[data-page="tasks"] dialog:has(#task-form){position:fixed;inset:auto 0 var(--dialog-viewport-bottom,0px);margin:0;width:100%;max-width:100%;max-height:min(90dvh,calc(var(--dialog-viewport-height,100dvh) - 16px));border-radius:24px 24px 0 0}
  dialog:has(#task-form) #dialog-content,body[data-page="tasks"] dialog:has(#task-form) #dialog-content{max-height:min(90dvh,calc(var(--dialog-viewport-height,100dvh) - 16px))}
}
@media(max-width:370px){#task-form .range-fields{grid-template-columns:minmax(0,1fr)}}
