.week-view .plan-content { overflow: hidden; }
.week-view .plan-toolbar { position: relative; z-index: 10; }
.week-view .plan-list-heading { display: none; }
.week-view .task-list { display: flex; flex-direction: column; flex: 1; min-height: 0; margin-top: 0; }
.week-view .plan-list-footer { flex-shrink: 0; border: 0; padding-block: 12px; }
.week-view .planner { grid-template-columns: 224px minmax(0, 1fr); }
.week-view.sidebar-collapsed .planner { grid-template-columns: 64px minmax(0, 1fr); }
.week-view:not(.has-details) .plan-detail { display: none; }
.week-view.has-modal-editor .plan-detail { display: block; position: absolute; width: 0; height: 0; border: 0; overflow: visible; }
.week-navigation { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 14px; flex-wrap: wrap; }
.week-range { font-size: 12px; color: var(--muted); }
.week-navigation .week-range { display: inline-flex; align-items: center; gap: 6px; border: 0; padding: 0; background: transparent; font: inherit; font-size: 12px; color: var(--muted); }
.week-navigation .week-range:hover { color: var(--ink); }
.week-range .icon { width: 13px; height: 13px; }
.week-picker { position: fixed; inset: auto; margin: 0; width: 310px; max-width: calc(100vw - 24px); padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); box-shadow: 0 6px 24px #00000012; }
.week-picker-heading { display: grid; grid-template-columns: 26px 85px minmax(0, 1fr) 26px; gap: 5px; align-items: center; margin-bottom: 16px; }
.week-picker-heading input { width: 100%; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); padding: 7px 5px; font: inherit; font-size: 11px; }
.week-picker-heading .select-trigger { padding: 7px; font-size: 11px; }
.week-picker-weekdays, .week-picker-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: center; text-align: center; }
.week-picker-weekdays { font-size: 10px; color: var(--muted); margin-bottom: 6px; }
.week-picker-row { width: 100%; border: 1px solid transparent; border-radius: 4px; padding: 9px 0; background: transparent; color: var(--ink); font-size: 11px; }
.week-picker-row:hover { background: var(--bg); border-color: var(--line); }
.week-picker-row.selected { background: var(--soft); }
.week-picker-row .other-month { color: var(--muted); }
.week-picker-row .today { font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.week-picker > p { font-size: 10px; color: var(--muted); text-align: center; margin: 12px 0 0; }
.week-navigation > div { display: flex; align-items: center; gap: 6px; }
.week-navigation button { height: 29px; }
.week-navigation button:disabled { cursor: default; }
.week-navigation [data-week-today] { height: 27px; min-width: 48px; padding: 0 11px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted); font-size: 11px; line-height: 1; transition: color 150ms ease; }
.week-navigation [data-week-today]:hover:not(:disabled) { background: transparent; color: var(--ink); opacity: 1; }
.week-navigation [data-week-today]:disabled { background: transparent; color: var(--ink); opacity: 1; }
.week-navigation [data-week-step] { width: 27px; height: 27px; padding: 5px; border-radius: 4px; }
.week-navigation [data-week-step]:hover { background: var(--bg); }
.week-density-switch { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 5px; margin-right: 8px; }
.week-density-switch button { height: 23px; padding: 0 9px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-size: 10px; }
.week-density-switch button[aria-pressed='true'] { background: var(--soft); color: var(--ink); }
.week-scroll.week-compact { overflow-y: hidden; }
.week-compact .week-timeline { overflow: clip; }
.week-compact .week-time-day { background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--week-hour-height) - 1px), var(--line) calc(var(--week-hour-height) - 1px), var(--line) var(--week-hour-height)); }
.week-compact .week-time-day.is-today { background-color: var(--bg); }
.week-prev { transform: rotate(90deg); }
.week-next { transform: rotate(-90deg); }
.week-scroll { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--line); border-radius: 8px; scrollbar-width: thin; scrollbar-color: var(--art-dim) transparent; }
.week-calendar { min-width: 730px; }
.week-sticky { position: relative; background: var(--surface); }
.week-day-heading { position:sticky; top:0; z-index:5; background:var(--surface); }
.week-day-heading, .week-all-day, .week-timeline { display: grid; grid-template-columns: 62px repeat(7, minmax(0, 1fr)); }
.week-day-heading { border-bottom: 1px solid var(--line); }
.week-gutter { position: sticky; left: 0; z-index: 4; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 9px; background: var(--surface); }
.week-gutter .icon { width: 17px; height: 17px; }
.week-day { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 12px 4px; border-left: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.week-day strong { font-size: 17px; font-weight: 500; color: var(--ink); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; }
.week-day small { font-size: 9px; }
.week-day { border: 0; border-left: 1px solid var(--line); background: transparent; font-family: inherit; cursor: pointer; }
.week-day:hover { background: var(--soft); }
.week-overflow { position: absolute; z-index: 2; min-width: 28px; height: 22px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); font: inherit; font-size: 10px; cursor: pointer; padding: 0 4px; }
.week-overflow:hover { border-color: var(--art-edge); background: var(--soft); }
.day-inspector { width: 680px; max-width: calc(100vw - 24px); height: min(760px, calc(100dvh - 40px)); max-height: calc(100dvh - 24px); padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); overflow: hidden; }
.day-inspector[open] { display: flex; flex-direction: column; gap: 14px; }
.day-inspector::backdrop { background: #0003; }
.day-inspector-heading { display: flex; justify-content: space-between; align-items: center; }
.day-inspector-heading span { font-size: 10px; color: var(--muted); }
.day-inspector-heading h2 { margin: 7px 0 0; font-size: 18px; font-weight: 500; }
.day-inspector-hint { color: var(--muted); font-size: 11px; margin: 0; line-height: 1.7; }
.day-operation-status { color: var(--muted); font-size: 11px; margin: 0; }
.day-operation-status.error { color: #c04444; }
.day-dates { max-height: 150px; overflow: auto; flex-shrink: 0; }
.day-dates h3 { font-size: 11px; color: var(--muted); font-weight: 400; margin: 0 0 7px; }
.day-dates > p { font-size: 10px; color: var(--muted); }
.day-inspector-body { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }
.day-inspector-body .day-timeline-scroll { height: clamp(210px, 45dvh, 360px); min-height: 0; }
.day-inspector-body .day-dates { max-height: none; overflow: visible; margin-top: 20px; }
.day-inspector-body .day-dates h3 { display: flex; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.day-inspector-body .day-dates h3 span { font-size: 10px; }
.day-add-button { margin-left: auto; width: 26px; height: 26px; border-radius: 4px; }
.day-add-button:hover { background: var(--soft); }
.day-time-add { position: absolute; right: 6px; width: 48px; height: 25px; padding: 3px 4px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 9px; text-align: right; }
.day-time-add:hover { background: var(--soft); color: var(--ink); }
.day-time-add:focus-visible { outline: 1px solid var(--art-edge); outline-offset: 1px; }
.day-timeline { display: grid; grid-template-columns: 62px minmax(0, 1fr); height: 1152px; }
.day-timeline .week-time-marker { width: 154px; justify-content: flex-start; text-align: left; border: 1px solid var(--line); border-color: color-mix(in srgb, var(--marker-color) 24%, var(--line)); border-radius: 3px; background: color-mix(in srgb, var(--marker-color) 5%, var(--surface)); overflow: hidden; transition: background-color 150ms ease, border-color 150ms ease; }
.day-timeline .week-time-marker.priority-2 .day-marker-name { font-weight: 600; }
.day-timeline .week-marker-shape { display: none; }
.day-marker-name { position: absolute; left: 9px; right: 7px; top: 6px; display: flex; align-items: center; gap: 5px; font-size: 11px; line-height: 14px; color: var(--ink); white-space: nowrap; }
.day-marker-name > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.day-marker-category { display: inline-flex; flex-shrink: 0; color: var(--marker-color); }
.day-marker-category .icon { width: 12px; height: 12px; stroke-width: 1.8; }
.week-point-marker .day-marker-name { top: 3px; }
.day-marker-time { position: absolute; left: 9px; right: 7px; top: 25px; font-size: 9px; line-height: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.day-timeline .week-time-marker:hover, .day-timeline .week-time-marker.preview-selected, .day-timeline .week-time-marker:focus-visible { background: color-mix(in srgb, var(--marker-color) 9%, var(--surface)); border-color: color-mix(in srgb, var(--marker-color) 45%, var(--line)); }
.day-timeline .week-time-marker:focus-visible { box-shadow: 0 0 0 2px var(--line); }
.day-task-item { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; text-align: left; width: 100%; margin-bottom: 6px; cursor: pointer; }
.day-task-item > span { font-size: 12px; overflow-wrap: anywhere; }
.day-task-item > small { font-size: 10px; color: var(--muted); }
.day-task-item:hover, .day-task-item.preview-selected { border-color: var(--art-edge); background: var(--soft); }
.day-task-row { position: relative; }
.day-task-row:has(.day-restore-button) .day-task-item { padding-right: 48px; }
.day-restore-button { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 4px; }
.day-restore-button:hover { background: var(--soft); }
.overflow-inspector { width: 380px; height: auto; }
.day-task-list { overflow: auto; min-height: 0; }
.week-day.is-today strong { background: var(--ink); color: var(--surface); }
.week-all-day { border-bottom: 1px solid var(--line); }
.week-date-grid { grid-column: 2 / 9; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 24px; padding-block: 4px; border-left: 1px solid var(--line); }
.week-date-overflow { justify-self:center; align-self:center; min-width:28px; height:20px; padding:0 5px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--muted); font:inherit; font-size:10px; cursor:pointer; }
.week-date-overflow:hover { color:var(--ink); background:var(--soft); border-color:var(--art-edge); }
.week-no-dates { grid-column: 1 / 8; align-self: center; padding-left: 10px; color: var(--muted); font-size: 10px; }
.week-timeline { position: relative; height: 1152px; }
.week-hours { position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--line); }
.week-hours > span { position: absolute; right: 10px; font-size: 9px; color: var(--muted); padding-top: 4px; }
.week-time-day { position: relative; border-left: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent 47px, var(--line) 47px, var(--line) 48px); }
.week-time-day.is-today { background-color: var(--bg); }
.week-event { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; border: 1px solid var(--line); border-left: 2px solid var(--art-edge); border-radius: 4px; padding: 5px 7px; background: var(--soft); color: var(--ink); font: inherit; font-size: 11px; overflow: hidden; min-width: 0; }
.week-event.priority-0 { visibility: visible; }
.week-event.priority-2 { border-left-color: var(--ink); }
.week-event > span { flex-shrink: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-event small { font-size: 9px; color: var(--muted); white-space: nowrap; }
.week-date-event { margin: 2px 3px; flex-direction: row; align-items: center; }
.week-date-marker { display: flex; align-items: center; justify-content: center; min-width: 0; padding: 0; margin: 2px 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.week-date-marker.priority-0 { visibility: visible; }
.week-date-marker.priority-2 { color: var(--ink); }
.week-date-point .week-marker-shape { width: 9px; height: 9px; border-radius: 50%; }
.week-date-range .week-marker-shape { width: calc(100% - 100% / var(--date-span) + 9px); height: 9px; border-radius: 999px; }
.week-date-marker:hover, .week-date-marker.preview-selected, .week-date-marker.selected-task { color: var(--ink); }
.week-date-marker:hover .week-marker-shape, .week-date-marker.preview-selected .week-marker-shape, .week-date-marker:focus-visible .week-marker-shape { box-shadow: 0 0 0 4px var(--soft), 0 0 0 5px var(--line); }
.week-date-marker:focus-visible { outline: none; }
.week-time-event { position: absolute; z-index: 1; }
.week-time-marker { position: absolute; z-index: 1; display: flex; align-items: center; justify-content: center; width: 22px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer; }
.week-time-marker.priority-0 { visibility: visible; }
.week-time-marker.priority-2 { color: var(--ink); }
.week-marker-shape { display: block; flex-shrink: 0; background: var(--marker-color, currentColor); transition: box-shadow 150ms ease, background-color 150ms ease; }
.week-range-marker .week-marker-shape { position: absolute; width: 9px; top: calc(-4.5px + var(--marker-trim-start, 0px)); bottom: calc(-4.5px + var(--marker-trim-end, 0px)); border-radius: 999px; }
.week-point-marker .week-marker-shape { width: 9px; height: 9px; border-radius: 50%; }
.week-time-marker:hover, .week-time-marker.preview-selected, .week-time-marker.selected-task { color: var(--ink); z-index: 2; }
.week-time-marker:hover .week-marker-shape, .week-time-marker.preview-selected .week-marker-shape, .week-time-marker:focus-visible .week-marker-shape { box-shadow: 0 0 0 4px var(--soft), 0 0 0 5px var(--line); }
.week-time-marker:focus-visible { outline: none; }
.week-date-event.preview-selected { border-color: var(--art-edge); background: var(--bg); }
.week-preview { position: fixed; inset: auto; margin: 0; width: 290px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow: auto; padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: 0 8px 32px #00000018; }
.week-preview-heading { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; }
.week-preview h2 { margin: 12px 0; font-size: 16px; line-height: 1.6; font-weight: 500; overflow-wrap: anywhere; }
.week-preview-schedule { display: flex; align-items: flex-start; gap: 8px; font-size: 11px; line-height: 1.7; color: var(--muted); }
.week-preview-schedule .icon { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; }
.week-preview-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 16px; }
.week-preview-meta span { padding: 4px 7px; border-radius: 4px; background: var(--soft); font-size: 10px; color: var(--muted); }
.week-preview-meta .preview-category-badge { display: inline-flex; align-items: center; gap: 5px; color: var(--category-color); background: color-mix(in srgb, var(--category-color) 10%, var(--surface)); }
.preview-category-badge .icon { width: 12px; height: 12px; stroke-width: 1.8; }
.week-preview-description { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.8; max-height: 130px; overflow: auto; margin: 0 0 16px; }
.week-preview > .button-secondary { display: inline-flex; align-items: center; gap: 7px; width: 100%; justify-content: center; }
.week-preview > .button-secondary .icon { width: 14px; height: 14px; }
.week-preview-hint { font-size: 9px; color: var(--muted); text-align: center; margin: 10px 0 0; }
.week-preview-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 0 0 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.week-preview-actions .button-secondary { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 8px 4px; font-size: 11px; }
.week-preview-actions .icon { width: 13px; height: 13px; }
.week-preview-actions .preview-delete:hover { color: #c04444; }
.week-preview-subtasks { margin: 0 0 16px; }
.preview-subtasks-heading { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }
.preview-subtasks-heading > span:last-child { font-variant-numeric: tabular-nums; }
.week-preview-subtasks .task-subtask-items { max-height: 220px; overflow-y: auto; }
@media (prefers-reduced-motion: reduce) { .week-marker-shape { transition: none; } }
.week-event:hover, .week-event.selected-task { border-color: var(--art-edge); background: var(--bg); }
.week-view .plan-options-popover label:has(.sort-order) { display: none; }
@media (min-width: 1101px) {
  .week-view.has-details .planner { grid-template-columns: 224px minmax(0, 1fr) 350px; }
  .week-view.has-details.sidebar-collapsed .planner { grid-template-columns: 64px minmax(0, 1fr) 350px; }
}
@media (max-width: 760px) {
  .plans-page.week-view .planner { grid-template-columns: var(--workspace-sidebar-mobile-width) minmax(0, 1fr); }
  .week-range { font-size: 10px; }
  .week-calendar { min-width: 730px; }
}
.week-date-points { display:flex; align-items:center; justify-content:center; gap:1px; min-width:0; }
.week-date-points > .week-date-marker { flex:0 0 20px; height:22px; margin:0; }
.week-date-points > .week-date-overflow { flex-shrink:0; }

.week-date-expand { display:flex; align-items:center; justify-content:center; gap:6px; border:0; background:transparent; color:var(--muted); font:inherit; font-size:10px; cursor:pointer; }
.week-date-expand:hover { color:var(--ink); background:var(--soft); }
.week-date-expand .icon { width:12px; height:12px; }
.week-date-expand[aria-expanded="true"] .icon { transform:rotate(180deg); }
.week-view .cycle-task-section { flex-shrink:0; margin:0 0 14px; }
.week-view .cycle-task-section h2 { margin:0; padding:8px 4px; }
.week-view .cycle-task-body { max-height:150px; overflow:auto; scrollbar-width:thin; }
.week-view .cycle-task-section .task-section-empty { padding:8px 4px; margin:0; font-size:11px; }
/* Scroll down to the cycle list without reducing the calendar's own height. */
.week-view .task-list { overflow:auto; scrollbar-width:thin; }
.week-view .task-list > .week-navigation { flex-shrink:0; }
.week-view .task-list > .week-scroll { flex:0 0 auto; height:max(360px, calc(100dvh - 200px)); }
.week-view .task-list > .cycle-task-section { margin:16px 0 0; }
.week-view .cycle-task-body { max-height:none; overflow:visible; }
.month-view .task-list > .month-scroll { height:auto; min-height:max(480px, calc(100dvh - 200px)); }
.month-view .month-calendar { height:auto; min-height:max(480px, calc(var(--month-weeks) * 112px + 32px)); }
/* The content pane owns page scrolling; calendar and cycle tasks are siblings. */
.week-view .plan-content { overflow:auto; min-height:0; }
.week-view .plan-content > .plan-toolbar { flex-shrink:0; }
.week-view .task-list { flex:0 0 auto; overflow:visible; min-height:auto; }
.week-view .plan-content > .cycle-task-section { flex:0 0 auto; margin:0 0 20px; }
.week-view .plan-content > .cycle-status-group { margin:20px 0 0; padding-top:16px; border-top:1px solid var(--line); }
.cycle-group-title { font-size:13px; font-weight:600; color:var(--ink); }
.week-view .cycle-status-group .task-section { margin:12px 0 0; }
.week-view .cycle-status-group .task-section > h2 { font-size:11px; font-weight:400; }
.calendar-range-navigation { flex:0 0 auto; padding-bottom:16px; margin-bottom:16px; border-bottom:1px solid var(--line); }
.calendar-section-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.calendar-section-heading h2 { margin:0; font-size:13px; line-height:1.5; font-weight:600; }
/* Calendar range and paging follow the same page heading as Today. */
.week-view .plan-list-heading { display:flex; flex-shrink:0; }
.week-view .plan-title-block { min-width:0; }
.week-view #view-title .week-range { display:inline-flex; align-items:center; gap:8px; padding:0; border:0; background:transparent; color:var(--ink); font:inherit; text-align:left; }
.week-view #view-title .week-range .icon { width:16px; height:16px; color:var(--muted); }
.calendar-heading-paging { display:flex; align-items:center; gap:8px; min-height:22px; }
.calendar-heading-paging .text-button, .calendar-heading-paging .button-secondary { padding:2px 4px; border:0; background:transparent; font-size:11px; color:var(--muted); }
.calendar-heading-paging .icon { width:14px; height:14px; }
.calendar-heading-paging .button-secondary:disabled { opacity:1; }
.project-inspector-body { flex:1; min-height:0; overflow:auto; scrollbar-width:thin; }
.project-inspector-actions { display:flex; justify-content:flex-end; }
.project-inspector .project-summary { padding-top:0; margin-bottom:16px; }
.project-inspector .task-row { padding-inline:4px; }
@media (max-width: 760px) {
  .week-view #view-title { font-size:20px; }
  .week-view #view-title .week-range { gap:4px; flex-wrap:wrap; }
  .week-calendar { min-width:0; width:100%; }
  .week-day-heading, .week-all-day, .week-timeline { grid-template-columns:34px repeat(7,minmax(0,1fr)); }
  .week-day { flex-direction:column; gap:3px; padding:8px 0; font-size:9px; min-width:0; }
  .week-day strong { width:25px; height:25px; font-size:14px; }
  .week-day small { font-size:8px; }
  .week-gutter { font-size:8px; padding:0 2px; text-align:center; overflow-wrap:anywhere; }
  .week-hours > span { right:3px; font-size:8px; }
  .week-date-grid { grid-auto-rows:minmax(24px,auto); }
  .week-date-points { flex-wrap:wrap; gap:0; padding:3px 0; }
  .week-date-points > .week-date-marker { flex-basis:10px; height:18px; }
  .week-date-point .week-marker-shape { width:6px; height:6px; }
  .week-date-points > .week-date-overflow { min-width:20px; height:18px; padding:0 2px; font-size:8px; }
  .calendar-section-heading { margin-bottom:10px; gap:8px; }
  .week-density-switch { margin-right:0; }
  .week-density-switch button { padding:0 8px; min-height:28px; }
  .week-scroll { overscroll-behavior-x:contain; }
  .day-inspector { padding:16px; max-width:calc(100vw - 16px); }
}
