/* ── Schedule ── */
.schedule-date-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  padding: 0 0 10px;
}

.schedule-date-row button {
  padding: 2.5px 10px;
  font-size: 16px;
  line-height: 1;
  background: none;
  border: none;
  color: var(--border);
}

#schedule-date-label {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

/* ── Schedule week row ── */
#schedule-week-row {
  display: flex;
  justify-content: space-around;
  padding: 5px 0;
}

.schedule-week-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 8px;
  min-width: 30px;
  user-select: none;
}

.schedule-week-cell:hover .schedule-week-day-num {
  background: var(--hover-overlay);
}

.schedule-week-day-letter {
  font-size: 10px;
  color: var(--border);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.schedule-week-day-num {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.1s;
}

.schedule-week-cell.weekend .schedule-week-day-letter,
.schedule-week-cell.weekend .schedule-week-day-num {
  opacity: 0.6;
}

.schedule-week-cell.today .schedule-week-day-num {
  background: var(--error);
  color: var(--text-on-error);
}

.schedule-week-cell.selected:not(.today) .schedule-week-day-num {
  background: var(--week-selected-bg);
  color: var(--text-on-accent);
}

.schedule-week-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-top: 1px;
  flex-shrink: 0;
}

.schedule-week-dot.dot-empty    { background: transparent; }
.schedule-week-dot.dot-event    { background: var(--dot-event); }
.schedule-week-dot.dot-pending  { background: var(--warning); }
.schedule-week-dot.dot-done     { background: var(--success); }
.schedule-week-dot.dot-overdue  { background: var(--error); }


#schedule-timeline-wrapper {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 10px 10px 0 5px;
}

#scheduleGrid {
  position: relative;
  margin: 10px 0 20px;
}

.schedule-time-label {
  position: absolute;
  left: 0;
  width: 50px;
  font-size: 10px;
  color: var(--time-label);
  text-align: left;
  padding-left: 5px;
  transform: translateY(-50%);
  box-sizing: border-box;
  pointer-events: none;
}

.schedule-gridline {
  position: absolute;
  left: 40px;
  right: 0;
  border-top: 0.5px solid var(--gridline);
  margin: 0 10px 0 5px;
}

.schedule-gridline-hour {
  border-top-color: var(--gridline-hour);
}

.schedule-item {
  position: absolute;
  left: 40px;
  right: 0;
  background-color: var(--sched-item-bg);
  border-left: 3px solid var(--sched-item-border);
  border-radius: 0 5px 5px 0;
  padding: 2px 6px;
  margin: 0 10px 0 5px;
  font-size: 12px;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: 0.35em;
  cursor: default;
}

.schedule-item.completed {
  opacity: 0.45;
}

.schedule-item.completed .schedule-item-name {
  text-decoration: line-through;
}

.schedule-item input[type="checkbox"] {
  margin-left: 2px;
  margin-top: 0.1em;
  flex-shrink: 0;
}

.schedule-item-name {
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-item-name:hover {
  text-decoration: underline;
}

.schedule-event-icon {
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1;
  margin-top: 0.1em;
}

/* ── Schedule all-day section (above timed grid, outside the scrollable wrapper) ── */
/* flex-shrink:0 keeps it at its natural height; the timeline wrapper below takes the rest. */
.schedule-allday-section {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  padding: 0 10px 4px 5px;
}

/* Left column: holds the straight/loopy toggle line SVG */
.schedule-allday-line-col {
  width: 40px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding-top: 0;
}

/* The SVG toggle line itself */
.schedule-allday-toggle {
  color: var(--border);
  opacity: 0.45;
  flex-shrink: 0;
}

.schedule-allday-line-col[role="button"] {
  cursor: pointer;
}

.schedule-allday-line-col[role="button"] .schedule-allday-toggle {
  transition: color 0.15s, opacity 0.15s;
}

.schedule-allday-line-col[role="button"]:hover .schedule-allday-toggle {
  color: var(--text);
  opacity: 0.8;
}

/* Right column: the scrollable items list */
.schedule-allday-items-col {
  flex: 1;
  min-width: 0;
}

/* Collapsed: show only 2 items, scroll to see the rest */
.schedule-allday-section.collapsed .schedule-allday-items-col {
  max-height: 66px;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox: hide scrollbar */
}

.schedule-allday-section.collapsed .schedule-allday-items-col::-webkit-scrollbar {
  display: none; /* Chrome/Safari: hide scrollbar */
}

.schedule-allday-section .schedule-item {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  margin: 0 10px 5px 5px;
  align-items: center;
  box-sizing: border-box;
}

/* ── Conflict indicator: red text for items within 15 min of each other ── */
.schedule-item.conflict .schedule-item-name {
  color: var(--error);
}

/* ── Schedule now indicator ── */
.schedule-now-indicator {
  position: absolute;
  left: 38px;
  right: 5px;
  height: 2px;
  background-color: var(--error);
  z-index: 10;
  pointer-events: none;
}

.schedule-now-indicator::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--error);
}

/* ── Task status dots ── */
.task-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
  /* Align with the first text line, mirroring the checkbox alignment */
  align-self: flex-start;
  margin-top: 0.2em;
}

/* In markdown preview, dot sits inline at the end of the task text */
.task-status-dot.dot-inline {
  margin-left: 5px;
  vertical-align: middle;
}

.dot-unscheduled { background-color: var(--text); }
.dot-overdue     { background-color: var(--error); }
.dot-today       { background-color: var(--warning); }
.dot-future      { background-color: var(--success); }

/* ── Schedule drag-to-move and drag-to-resize ────────────────────────────── */

/* Grab cursor only on the title span — the only drag handle (hover-capable devices only) */
@media (hover: hover) {
  .schedule-item-name { cursor: grab; }
}

/* Dim the original block while it is being moved */
.schedule-item-drag-source {
  opacity: 0.2;
  pointer-events: none;
}

/* Global grabbing cursor + no text selection while any drag is active */
body.schedule-dragging,
body.schedule-dragging * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

/* Floating clone that follows the cursor during drag-to-move */
.schedule-drag-clone {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.85;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  border-radius: 0 5px 5px 0;
  border-left: 3px solid var(--sched-item-border);
  background: var(--sched-item-bg);
  font-size: 12px;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: 0.35em;
  padding: 2px 6px;
}

/* Drop target outline — shows where the item will land */
.schedule-drop-outline {
  position: absolute;
  left: 40px;
  right: 0;
  margin: 0 10px 0 5px;
  border: 2px dashed var(--sched-item-border);
  border-radius: 0 5px 5px 0;
  background: var(--sched-item-bg);
  opacity: 0.5;
  pointer-events: none;
  box-sizing: border-box;
  z-index: 5;
  display: none;
}

/* Resize handle: invisible 8px strip at the bottom of each timed block */
.schedule-resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
  border-radius: 0 0 5px 0;
  touch-action: none;
}

/* Hide resize handle inside the all-day section (those items are not resizable) */
.schedule-allday-section .schedule-resize-handle { display: none; }

/* For very short timed events (≤20px), shrink the resize handle so it doesn't
   block clicks on the task checkbox or event title. */
.schedule-item-short .schedule-resize-handle { height: 3px; }

/* Prevent scroll-hijacking on draggable items (touch).
   The all-day items are also .schedule-item, so this rule covers them too. */
.schedule-item { touch-action: pan-y; }

/* Drop-target highlight when a timed item is dragged over the all-day section */
.schedule-allday-section.schedule-allday-drop-target {
  outline: 2px dashed var(--sched-item-border);
  outline-offset: -2px;
  border-radius: 5px;
  background: var(--sched-item-bg);
}
