/* â”€â”€â”€ Variables â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
:root {
  --hour-height: 80px;
  --snap-px: 20px;
  --time-gutter: 56px;
  --sidebar-width: 220px;
  --header-height: 48px;
  --tabs-height: 40px;

  --bg-main: #1a1a18;
  --bg-sidebar: #202020;
  --bg-sidebar-item: #282826;
  --bg-grid: #1a1a18;
  --bg-popover: #28282a;
  --border-subtle: #2e2e2b;
  --border-medium: #3a3a37;
  --text-primary: #e8e6e0;
  --text-muted: #6b6960;
  --text-dim: #4a4845;
  --accent-hover: rgba(255,255,255,0.04);

  --bg-report: #181816;
  --bg-day-report: #20201e;
  --bg-day-header: #242420;
  --bg-day-note: #242420;
  --bg-progress: rgba(255,255,255,0.025);
  --bg-day-row-marker: rgba(255,255,255,0.025);
  --bg-day-row-current: rgba(255,255,255,0.05);
  --border-day-row: rgba(255,255,255,0.045);

  --color-teal:   #3d9c9c; --color-teal-bg:   rgba(61,156,156,0.16);
  --color-blue:   #4a7fa5; --color-blue-bg:   rgba(74,127,165,0.16);
  --color-green:  #6b8c5a; --color-green-bg:  rgba(107,140,90,0.16);
  --color-pink:   #c07888; --color-pink-bg:   rgba(192,120,136,0.16);
  --color-purple: #8b7ab8; --color-purple-bg: rgba(139,122,184,0.16);
  --color-amber:  #c0962a; --color-amber-bg:  rgba(192,150,42,0.16);
  --color-coral:  #c07058; --color-coral-bg:  rgba(192,112,88,0.16);
  --color-orange: #c07830; --color-orange-bg: rgba(192,120,48,0.16);
  --color-gray:   #7a7268; --color-gray-bg:   rgba(122,114,104,0.16);
  --color-red:    #e05050; --color-red-bg:    rgba(224,80,80,0.16);
  --color-yellow: #eab308; --color-yellow-bg: rgba(234,179,8,0.16);
  --color-indigo: #6366f1; --color-indigo-bg: rgba(99,102,241,0.16);
  --color-lime:   #84cc16; --color-lime-bg:   rgba(132,204,22,0.16);
  --color-rose:   #f43f5e; --color-rose-bg:   rgba(244,63,94,0.16);

  --overlap-color: #e05050;
}

:root.light {
  --bg-main: #f8fafc;
  --bg-sidebar: #f1f5f9;
  --bg-sidebar-item: #e2e8f0;
  --bg-grid: #ffffff;
  --bg-popover: #ffffff;
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --text-primary: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --accent-hover: rgba(0,0,0,0.04);
  
  --bg-report: #f8fafc;
  --bg-day-report: #ffffff;
  --bg-day-header: #f1f5f9;
  --bg-day-note: #f1f5f9;
  --bg-progress: rgba(0, 0, 0, 0.025);
  --bg-day-row-marker: rgba(0, 0, 0, 0.025);
  --bg-day-row-current: rgba(59, 130, 246, 0.08);
  --border-day-row: rgba(0, 0, 0, 0.045);
  
  /* Soften the category block color fills for high contrast text readability */
  --color-teal-bg: rgba(61,156,156,0.12);
  --color-blue-bg: rgba(74,127,165,0.12);
  --color-green-bg: rgba(107,140,90,0.12);
  --color-pink-bg: rgba(192,120,136,0.12);
  --color-purple-bg: rgba(139,122,184,0.12);
  --color-amber-bg: rgba(192,150,42,0.12);
  --color-coral-bg: rgba(192,112,88,0.12);
  --color-orange-bg: rgba(192,120,48,0.12);
  --color-gray-bg: rgba(122,114,104,0.12);
  --color-red-bg:    rgba(224,80,80,0.12);
  --color-yellow-bg: rgba(234,179,8,0.12);
  --color-indigo-bg: rgba(99,102,241,0.12);
  --color-lime-bg:   rgba(132,204,22,0.12);
  --color-rose-bg:   rgba(244,63,94,0.12);
}

/* â”€â”€â”€ Reset / Base â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  background: var(--bg-main);
  color: var(--text-primary);
}

button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input  { font: inherit; color: inherit; background: none; border: none; outline: none; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

/* â”€â”€â”€ Header â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

#header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

#week-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 190px;
  text-align: center;
  letter-spacing: 0.01em;
}

.nav-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 16px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.1s, background 0.1s;
}
.nav-btn:hover { color: var(--text-primary); background: var(--accent-hover); }
.today-btn { width: auto; padding: 0 9px; font-size: 12px; font-weight: 500; }

/* Current-time sweep line (edit grid + today's view card) */
.now-line {
  position: absolute;
  left: var(--time-gutter);
  right: 8px;
  height: 0;
  border-top: 2px solid var(--overlap-color, #e05050);
  box-shadow: 0 0 6px 0 var(--overlap-color, #e05050);
  z-index: 15;
  pointer-events: none;
  transition: top 0.6s ease;
}
.now-line-dot {
  position: absolute; left: -4px; top: -5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--overlap-color, #e05050);
  animation: now-pulse 2s ease-in-out infinite;
}
@keyframes now-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 80, 80, 0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(224, 80, 80, 0); }
}
.now-line-time {
  position: absolute; right: 0; top: -9px;
  font-size: 10px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #fff; background: var(--overlap-color, #e05050);
  padding: 1px 4px; border-radius: 3px;
}
.now-line-view {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 10px;
  border-top: 2px solid var(--overlap-color, #e05050);
}
.now-line-view-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--overlap-color, #e05050); flex-shrink: 0; }
.now-line-view-time {
  font-size: 10px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--overlap-color, #e05050);
}

#header-actions { display: flex; gap: 8px; }

.action-btn {
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.action-btn:hover { color: var(--text-primary); border-color: var(--border-medium); background: var(--accent-hover); }
.action-btn.danger:hover { color: var(--overlap-color); border-color: rgba(224,80,80,0.3); }

/* â”€â”€â”€ Main Layout â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#main {
  display: flex;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

/* â”€â”€â”€ Sidebar â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sidebar-top {
  padding: 10px 10px 0;
  flex-shrink: 0;
}

.new-block-btn {
  width: 100%;
  padding: 7px 10px;
  border-radius: 5px;
  border: 1px dashed var(--border-medium);
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.new-block-btn:hover { color: var(--text-primary); border-color: var(--text-muted); background: var(--accent-hover); }

.picklist-sort-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 0;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
}

.picklist-sort-row span {
  font-weight: 500;
}

.sort-select {
  font-size: 11px !important;
  padding: 2px 5px !important;
  height: 20px !important;
  line-height: 1 !important;
  width: auto !important;
  border-color: var(--border-subtle) !important;
  cursor: pointer;
}

#picklist {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#picklist::-webkit-scrollbar { width: 4px; }
#picklist::-webkit-scrollbar-track { background: transparent; }
#picklist::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 2px; }

/* â”€â”€â”€ Sidebar Items â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.sidebar-item {
  border-radius: 5px;
  border: 1px solid transparent;
  overflow: hidden;
  transition: border-color 0.1s, background 0.1s;
  user-select: none;
}
.sidebar-item:hover { border-color: var(--border-subtle); background: var(--bg-sidebar-item); }

.sidebar-item-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  cursor: grab;
}
.sidebar-item-row:active { cursor: grabbing; }

.sidebar-item-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.sidebar-item-label {
  flex: 1;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.sidebar-item-duration {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

.sidebar-item-actions {
  display: none;
  gap: 4px;
  padding: 0 6px 0 0;
  flex-shrink: 0;
}
.sidebar-item:hover .sidebar-item-actions { display: flex; }

.sidebar-item-edit-btn,
.sidebar-item-delete-btn {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.1s, background 0.1s;
}
.sidebar-item-edit-btn:hover { color: var(--text-primary); background: var(--border-medium); }
.sidebar-item-delete-btn:hover { color: var(--overlap-color); background: rgba(224,80,80,0.12); }

/* â”€â”€â”€ Inline Forms (sidebar + new block) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.inline-form {
  padding: 8px 10px 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inline-form.hidden { display: none; }

.form-input {
  width: 100%;
  padding: 5px 7px;
  background: var(--bg-main);
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-primary);
  transition: border-color 0.1s;
}
.form-input:focus { border-color: var(--text-muted); }

.duration-input { width: 80px; }

.form-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}

.form-row { display: flex; flex-direction: column; gap: 4px; }

.form-actions {
  display: flex;
  gap: 6px;
}

.btn-primary {
  padding: 5px 12px;
  background: var(--text-muted);
  color: var(--bg-main);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.1s;
}
.btn-primary:hover { background: var(--text-primary); }

.btn-ghost {
  padding: 5px 10px;
  color: var(--text-muted);
  border-radius: 4px;
  font-size: 12px;
  transition: color 0.1s, background 0.1s;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--accent-hover); }

.btn-danger {
  padding: 5px 10px;
  color: var(--overlap-color);
  border-radius: 4px;
  font-size: 12px;
  transition: background 0.1s;
}
.btn-danger:hover { background: rgba(224,80,80,0.1); }

/* â”€â”€â”€ Color Swatches â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.color-swatch-option {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.1s, transform 0.1s;
}
.color-swatch-option:hover { transform: scale(1.15); }
.color-swatch-option.selected { border-color: var(--text-primary); }

/* â”€â”€â”€ Category Legend â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#category-legend {
  padding: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* â”€â”€â”€ Content Area â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* â”€â”€â”€ Day Tabs â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#day-tabs {
  display: flex;
  height: var(--tabs-height);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  padding: 0 12px;
  gap: 2px;
  align-items: flex-end;
}

.day-tab {
  padding: 6px 14px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 5px 5px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer;
  transition: color 0.1s, background 0.1s;
  position: relative;
  bottom: -1px;
}
.day-tab:hover { color: var(--text-primary); background: var(--accent-hover); }
.day-tab.active {
  color: var(--text-primary);
  background: var(--bg-grid);
  border-color: var(--border-subtle);
  border-bottom-color: var(--bg-grid);
}

/* â”€â”€â”€ Time Grid â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#time-grid-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

#time-grid-wrapper::-webkit-scrollbar { width: 6px; }
#time-grid-wrapper::-webkit-scrollbar-track { background: transparent; }
#time-grid-wrapper::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 3px; }

#time-grid {
  position: relative;
  height: calc(24 * var(--hour-height));
  /* left gutter for time labels */
  padding-left: var(--time-gutter);
}

.hour-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--border-subtle);
  pointer-events: none;
}

.tick-line {
  position: absolute;
  left: var(--time-gutter);
  right: 0;
  border-top: 1px solid var(--border-subtle);
  opacity: 0.4;
  pointer-events: none;
}

.time-label {
  position: absolute;
  left: 0;
  width: var(--time-gutter);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  text-align: right;
  padding-right: 8px;
  transform: translateY(-50%);
  pointer-events: none;
  white-space: nowrap;
}

/* â”€â”€â”€ Grid Blocks â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.grid-block {
  position: absolute;
  left: calc(var(--time-gutter) + 8px);
  right: 8px;
  border-radius: 4px;
  border-left: 3px solid;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  z-index: 10;
  transition: opacity 0.1s, width 0.2s cubic-bezier(0.4, 0, 0.2, 1), left 0.2s cubic-bezier(0.4, 0, 0.2, 1), height 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
}

.grid-block:active { cursor: grabbing; }

.grid-block.overlap {
  border-left-color: var(--overlap-color) !important;
  right: auto;
}

.block-inner {
  padding: 3px 6px 3px 5px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
}

.block-label {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.block-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.15;
  white-space: nowrap;
  margin-top: 1px;
}

.grid-block.compact .block-inner,
.grid-block.tiny .block-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  padding: 0 6px;
  gap: 5px;
}

.grid-block.compact .block-label,
.grid-block.tiny .block-label {
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block !important;
  flex: 1 1 auto;
  min-width: 0;
}

.grid-block.compact .block-time,
.grid-block.tiny .block-time {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  display: block !important;
  margin-top: 0;
  flex: 0 0 auto;
}

/* Hide end time in compact and tiny blocks to fit text inline */
.grid-block.compact .block-time .time-end,
.grid-block.tiny .block-time .time-end {
  display: none;
}

/* Hover Expansion for Overlapping & Squeezed Blocks */
.grid-block:hover:not(.is-dragging):not(.is-resizing) {
  z-index: 50 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.grid-block.overlap:hover:not(.is-dragging):not(.is-resizing) {
  width: calc(100% - var(--time-gutter) - 16px) !important;
  left: calc(var(--time-gutter) + 8px) !important;
}

.grid-block.compact:hover:not(.is-dragging):not(.is-resizing),
.grid-block.tiny:hover:not(.is-dragging):not(.is-resizing) {
  height: auto !important;
  min-height: 48px !important;
}

.grid-block.compact:hover:not(.is-dragging):not(.is-resizing) .block-time,
.grid-block.tiny:hover:not(.is-dragging):not(.is-resizing) .block-label,
.grid-block.tiny:hover:not(.is-dragging):not(.is-resizing) .block-time {
  display: block !important;
}

.resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.grid-block:hover .resize-handle { opacity: 1; }

.resize-handle::before {
  content: '';
  width: 24px;
  height: 2px;
  border-radius: 1px;
  background: rgba(255,255,255,0.3);
}

/* â”€â”€â”€ Drag Ghost â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.85;
  border-radius: 5px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 500;
  border-left: 3px solid;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

/* â”€â”€â”€ Block Popover â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#block-popover {
  position: fixed;
  z-index: 200;
  background: var(--bg-popover);
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  padding: 12px;
  width: 240px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#block-popover.hidden { display: none; }

.popover-field { display: flex; flex-direction: column; gap: 5px; }

.popover-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
}

/* â”€â”€â”€ Color swatch helpers (applied inline via JS) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
/* Block colors applied via data-color + CSS selectors */
.grid-block[data-color="teal"]   { background: var(--color-teal-bg);   border-left-color: var(--color-teal);   }
.grid-block[data-color="blue"]   { background: var(--color-blue-bg);   border-left-color: var(--color-blue);   }
.grid-block[data-color="green"]  { background: var(--color-green-bg);  border-left-color: var(--color-green);  }
.grid-block[data-color="pink"]   { background: var(--color-pink-bg);   border-left-color: var(--color-pink);   }
.grid-block[data-color="purple"] { background: var(--color-purple-bg); border-left-color: var(--color-purple); }
.grid-block[data-color="amber"]  { background: var(--color-amber-bg);  border-left-color: var(--color-amber);  }
.grid-block[data-color="coral"]  { background: var(--color-coral-bg);  border-left-color: var(--color-coral);  }
.grid-block[data-color="orange"] { background: var(--color-orange-bg); border-left-color: var(--color-orange); }
.grid-block[data-color="gray"]   { background: var(--color-gray-bg);   border-left-color: var(--color-gray);   }
.grid-block[data-color="red"]    { background: var(--color-red-bg);    border-left-color: var(--color-red);    }
.grid-block[data-color="yellow"] { background: var(--color-yellow-bg); border-left-color: var(--color-yellow); }
.grid-block[data-color="indigo"] { background: var(--color-indigo-bg); border-left-color: var(--color-indigo); }
.grid-block[data-color="lime"]   { background: var(--color-lime-bg);   border-left-color: var(--color-lime);   }
.grid-block[data-color="rose"]   { background: var(--color-rose-bg);   border-left-color: var(--color-rose);   }

/* Swatch backgrounds */
[data-swatch="teal"]   { background: var(--color-teal);   }
[data-swatch="blue"]   { background: var(--color-blue);   }
[data-swatch="green"]  { background: var(--color-green);  }
[data-swatch="pink"]   { background: var(--color-pink);   }
[data-swatch="purple"] { background: var(--color-purple); }
[data-swatch="amber"]  { background: var(--color-amber);  }
[data-swatch="coral"]  { background: var(--color-coral);  }
[data-swatch="orange"] { background: var(--color-orange); }
[data-swatch="gray"]   { background: var(--color-gray);   }
[data-swatch="red"]    { background: var(--color-red);    }
[data-swatch="yellow"] { background: var(--color-yellow); }
[data-swatch="indigo"] { background: var(--color-indigo); }
[data-swatch="lime"]   { background: var(--color-lime);   }
[data-swatch="rose"]   { background: var(--color-rose);   }

/* Ghost colors */
.drag-ghost[data-color="teal"]   { background: var(--color-teal-bg);   border-left-color: var(--color-teal);   color: var(--text-primary); }
.drag-ghost[data-color="blue"]   { background: var(--color-blue-bg);   border-left-color: var(--color-blue);   color: var(--text-primary); }
.drag-ghost[data-color="green"]  { background: var(--color-green-bg);  border-left-color: var(--color-green);  color: var(--text-primary); }
.drag-ghost[data-color="pink"]   { background: var(--color-pink-bg);   border-left-color: var(--color-pink);   color: var(--text-primary); }
.drag-ghost[data-color="purple"] { background: var(--color-purple-bg); border-left-color: var(--color-purple); color: var(--text-primary); }
.drag-ghost[data-color="amber"]  { background: var(--color-amber-bg);  border-left-color: var(--color-amber);  color: var(--text-primary); }
.drag-ghost[data-color="coral"]  { background: var(--color-coral-bg);  border-left-color: var(--color-coral);  color: var(--text-primary); }
.drag-ghost[data-color="orange"] { background: var(--color-orange-bg); border-left-color: var(--color-orange); color: var(--text-primary); }
.drag-ghost[data-color="gray"]   { background: var(--color-gray-bg);   border-left-color: var(--color-gray);   color: var(--text-primary); }
.drag-ghost[data-color="red"]    { background: var(--color-red-bg);    border-left-color: var(--color-red);    color: var(--text-primary); }
.drag-ghost[data-color="yellow"] { background: var(--color-yellow-bg); border-left-color: var(--color-yellow); color: var(--text-primary); }
.drag-ghost[data-color="indigo"] { background: var(--color-indigo-bg); border-left-color: var(--color-indigo); color: var(--text-primary); }
.drag-ghost[data-color="lime"]   { background: var(--color-lime-bg);   border-left-color: var(--color-lime);   color: var(--text-primary); }
.drag-ghost[data-color="rose"]   { background: var(--color-rose-bg);   border-left-color: var(--color-rose);   color: var(--text-primary); }

/* â”€â”€â”€ Scrollbar global â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
* { scrollbar-width: thin; scrollbar-color: var(--border-medium) transparent; }

/* â”€â”€â”€ Utilities â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.hidden { display: none !important; }

/* Mode Toggle */
.mode-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  background: rgba(255,255,255,0.02);
}

.mode-btn {
  min-width: 48px;
  height: 24px;
  padding: 0 9px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--text-muted);
  transition: color 0.1s, background 0.1s;
}
.mode-btn:hover { color: var(--text-primary); background: var(--accent-hover); }
.mode-btn.active { color: var(--bg-main); background: var(--text-primary); }

body.view-mode #sidebar,
body.view-mode .edit-only { display: none; }

body.view-mode #main { display: block; }
body.view-mode #content { height: calc(100vh - var(--header-height)); }
body.view-mode #day-tabs { display: none; }
body.view-mode #time-grid-wrapper { height: 100%; }

/* Schedule View */
.schedule-view {
  height: auto !important;
  min-height: 100%;
  padding: 18px 22px 48px;
}

.weekly-report {
  background: var(--bg-report);
  color: var(--text-primary);
}

.week-report-header {
  max-width: 1220px;
  margin: 0 auto 14px;
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(0, 1.3fr);
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-medium);
}

.week-report-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.week-report-subtitle {
  margin-top: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.week-report-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 5px 12px;
  align-content: start;
}

.week-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 11px;
  color: var(--text-muted);
}

.week-legend-item span:first-child {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.week-legend-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-day-grid {
  max-width: 1220px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.day-report {
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  background: var(--bg-day-report);
  overflow: hidden;
}

.day-report.today {
  border-color: rgba(232,230,224,0.55);
}

.day-report-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px 9px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-day-header);
}

.day-report h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.15;
  letter-spacing: 0;
}

.day-report-meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-muted);
}

.day-total {
  flex-shrink: 0;
  align-self: start;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
}

.day-progress {
  padding: 8px 11px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-progress);
}

.day-progress-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-progress-track {
  height: 3px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--border-subtle);
  overflow: hidden;
}

.day-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-teal), var(--color-amber));
}

.day-report-list {
  display: flex;
  flex-direction: column;
}

.day-report-empty {
  padding: 12px 11px;
  font-size: 12px;
  color: var(--text-muted);
}

.day-row {
  position: relative;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 78px;
  gap: 8px;
  align-items: baseline;
  padding: 6px 10px 6px 9px;
  border-left: 3px solid var(--border-medium);
  border-bottom: 1px solid var(--border-day-row);
  min-height: 30px;
}

.day-row:last-child { border-bottom: none; }
.day-row-marker {
  border-left-color: transparent;
  background: var(--bg-day-row-marker);
}
.day-row-marker .day-row-label {
  font-weight: 600;
  color: var(--text-primary);
}
.day-row.past { opacity: 0.42; }
.day-row.current {
  background: var(--bg-day-row-current);
  border-left-color: var(--text-primary) !important;
}
.day-row.current::after {
  content: 'NOW';
  position: absolute;
  right: 8px;
  top: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-primary);
}

.day-row-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  line-height: 1.2;
  color: var(--text-muted);
  white-space: nowrap;
}

.day-row-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.25;
  color: var(--text-primary);
}

.day-row-duration {
  justify-self: end;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
}

.day-row.current .day-row-duration { visibility: hidden; }

.day-report-note {
  padding: 8px 11px 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
  background: var(--bg-day-note);
}

.day-row[data-color="teal"]   { border-left-color: var(--color-teal); }
.day-row[data-color="blue"]   { border-left-color: var(--color-blue); }
.day-row[data-color="green"]  { border-left-color: var(--color-green); }
.day-row[data-color="pink"]   { border-left-color: var(--color-pink); }
.day-row[data-color="purple"] { border-left-color: var(--color-purple); }
.day-row[data-color="amber"]  { border-left-color: var(--color-amber); }
.day-row[data-color="coral"]  { border-left-color: var(--color-coral); }
.day-row[data-color="orange"] { border-left-color: var(--color-orange); }
.day-row[data-color="gray"]   { border-left-color: var(--color-gray); }
.day-row[data-color="red"]    { border-left-color: var(--color-red); }
.day-row[data-color="yellow"] { border-left-color: var(--color-yellow); }
.day-row[data-color="indigo"] { border-left-color: var(--color-indigo); }
.day-row[data-color="lime"]   { border-left-color: var(--color-lime); }
.day-row[data-color="rose"]   { border-left-color: var(--color-rose); }

@media (max-width: 1060px) {
  .week-day-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-report-header { grid-template-columns: 1fr; }
}

/* Sidebar Toggle & Overlay */
#sidebar-toggle-btn {
  display: none;
}

#sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
  opacity: 1;
  transition: opacity 0.25s ease;
}
#sidebar-overlay.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

/* Snapping Drag Preview */
.grid-drag-preview {
  position: absolute;
  left: calc(var(--time-gutter) + 8px);
  right: 8px;
  border: 1.5px dashed var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4px;
  color: var(--text-muted);
  font-size: 11px;
}
:root.light .grid-drag-preview {
  background: rgba(0, 0, 0, 0.03);
}
.grid-drag-preview .preview-label {
  font-weight: 500;
  font-size: 11px;
  opacity: 0.8;
}
.grid-drag-preview .preview-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  margin-top: 2px;
  opacity: 0.7;
}

/* Form Helper Classes */
.form-select {
  padding: 5px 7px;
  background: var(--bg-main);
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  transition: border-color 0.1s;
}
.form-select:focus {
  border-color: var(--text-muted);
}
.form-row-side {
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-row-side .form-select {
  flex: 1;
  min-width: 0;
}
.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.form-checkbox-label input[type="checkbox"] {
  width: 13px;
  height: 13px;
  cursor: pointer;
}

.category-select-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.category-preview-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--border-medium);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
  transition: background-color 0.15s ease;
}

/* Modal Overlay & Days Checkboxes */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.2s ease;
}
.modal-overlay.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}
.modal-content {
  background: var(--bg-popover);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  padding: 20px;
  width: 360px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-content h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.modal-content p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.modal-days-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.modal-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}
.modal-checkbox-label input {
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.modal-actions {
  display: flex;
  gap: 8px;
}
.modal-actions .action-btn {
  flex: 1;
  padding: 4px;
  font-size: 11px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 720px) {
  :root { --header-height: 86px; }
  html, body { overflow: hidden; }
  #header {
    height: auto;
    min-height: var(--header-height);
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
    align-items: flex-start;
  }
  #header-nav {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  #sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #sidebar {
    position: fixed;
    top: 0;
    left: calc(-1 * var(--sidebar-width));
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 100;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.4);
    background: var(--bg-sidebar);
  }
  body.sidebar-open #sidebar {
    left: 0;
  }
  #week-label {
    min-width: 0;
    flex: 1;
    font-size: 12px;
  }
  #mode-toggle { order: 3; width: 100%; }
  .mode-btn { flex: 1; }
  #header-actions { flex-wrap: wrap; }
  .schedule-view { padding: 12px 10px 32px; }
  .week-report-header { gap: 10px; margin-bottom: 10px; }
  .week-report-title { font-size: 18px; }
  .week-report-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-day-grid { grid-template-columns: 1fr; gap: 10px; }
  .day-row { grid-template-columns: 94px minmax(0, 1fr) 72px; gap: 7px; }
  .day-row-label { font-size: 12px; }

  #block-popover {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: calc(100% - 32px) !important;
    max-width: 320px !important;
    margin: 0 !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5) !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  #block-popover::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    z-index: -1;
    pointer-events: none;
  }
}

@media (max-width: 420px) {
  .week-report-legend { grid-template-columns: 1fr; }
  .day-row { grid-template-columns: 86px minmax(0, 1fr); }
  .day-row-duration { display: none; }
  .day-row.current::after { right: 7px; }
}

/* ─── Checklist Mode ─────────────────────────────────────────────────────── */

/* Body class: sidebar visible, edit-only actions hidden */
body.checklist-mode .edit-only { display: none; }
body.checklist-mode #sidebar { display: flex; }
body.checklist-mode #sidebar-top { display: none; }
body.checklist-mode #day-tabs { display: none; }
body.checklist-mode #time-grid-wrapper { height: 100%; }
body.checklist-mode #main { display: flex; }
body.checklist-mode #content { height: calc(100vh - var(--header-height)); }

/* checklist-only elements: hidden in all non-checklist modes */
.checklist-only { display: none !important; }
body.checklist-mode .checklist-only { display: inline-flex !important; }

/* Sidebar in checklist mode */
.checklist-sidebar-title {
  padding: 10px 10px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#picklist.checklist-editor {
  padding: 0 0 8px;
  gap: 0;
}

.checklist-editor-section {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
  margin-bottom: 2px;
}

.checklist-editor-section:last-child {
  border-bottom: none;
}

.checklist-editor-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.checklist-add-btn {
  font-size: 11px;
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.checklist-add-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
  background: var(--accent-hover);
}

.checklist-editor-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 6px 4px;
}

.checklist-editor-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
  border-radius: 4px;
  transition: background 0.1s;
}
.checklist-editor-row:hover {
  background: var(--bg-sidebar-item);
}

.checklist-editor-label {
  flex: 1;
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checklist-editor-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.1s;
  flex-shrink: 0;
}
.checklist-editor-row:hover .checklist-editor-actions {
  opacity: 1;
}

.checklist-move-btn {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.1s, background 0.1s;
}
.checklist-move-btn:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--border-medium);
}
.checklist-move-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.checklist-editor-empty {
  padding: 6px 6px 4px;
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

/* Inline add form inside checklist section */
.checklist-add-form {
  margin: 4px 6px 6px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-main);
}

/* ─── Checklist View (day cards) ─────────────────────────────────────────── */

.checklist-view {
  /* same .schedule-view + .weekly-report base, just override header legend */
}

.checklist-header-legend {
  grid-template-columns: 1fr !important;
  gap: 6px !important;
  align-content: center !important;
}

.checklist-day-card {
  /* inherits .day-report */
}

/* Completion badge in card header */
.checklist-badge {
  flex-shrink: 0;
  align-self: start;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-main);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  min-width: 36px;
  text-align: center;
}
.checklist-badge.complete {
  color: var(--color-teal);
  border-color: rgba(61, 156, 156, 0.35);
  background: rgba(61, 156, 156, 0.08);
}

/* Morning / Evening section within a card */
.checklist-section {
  border-top: 1px solid var(--border-subtle);
}
.checklist-section:first-of-type {
  border-top: none;
}

.checklist-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 5px;
  background: var(--bg-day-header);
  border-bottom: 1px solid var(--border-subtle);
}

.checklist-period-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.checklist-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.checklist-progress-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-dim);
  min-width: 26px;
  text-align: right;
}

.checklist-progress-track {
  width: 48px;
  height: 3px;
  border-radius: 999px;
  background: var(--border-subtle);
  overflow: hidden;
}

.checklist-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-teal), var(--color-amber));
  transition: width 0.25s ease;
}

.checklist-progress-fill.complete {
  background: var(--color-teal);
}

/* Item list */
.checklist-item-list {
  display: flex;
  flex-direction: column;
}

/* Each checklist item row — label element for native click-on-checkbox */
.checklist-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px 7px 9px;
  border-left: 3px solid var(--border-medium);
  border-bottom: 1px solid var(--border-day-row);
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
  min-height: 34px;
}
.checklist-item:last-child {
  border-bottom: none;
}
.checklist-item:hover {
  background: var(--accent-hover);
}

/* Color bar variants */
.checklist-item[data-color="teal"]   { border-left-color: var(--color-teal); }
.checklist-item[data-color="blue"]   { border-left-color: var(--color-blue); }
.checklist-item[data-color="green"]  { border-left-color: var(--color-green); }
.checklist-item[data-color="pink"]   { border-left-color: var(--color-pink); }
.checklist-item[data-color="purple"] { border-left-color: var(--color-purple); }
.checklist-item[data-color="amber"]  { border-left-color: var(--color-amber); }
.checklist-item[data-color="coral"]  { border-left-color: var(--color-coral); }
.checklist-item[data-color="orange"] { border-left-color: var(--color-orange); }
.checklist-item[data-color="gray"]   { border-left-color: var(--color-gray); }
.checklist-item[data-color="red"]    { border-left-color: var(--color-red); }
.checklist-item[data-color="yellow"] { border-left-color: var(--color-yellow); }
.checklist-item[data-color="indigo"] { border-left-color: var(--color-indigo); }
.checklist-item[data-color="lime"]   { border-left-color: var(--color-lime); }
.checklist-item[data-color="rose"]   { border-left-color: var(--color-rose); }

/* Custom checkbox */
.checklist-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-medium);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}
.checklist-checkbox:hover {
  border-color: var(--text-muted);
}
.checklist-checkbox:checked {
  background: var(--color-teal);
  border-color: var(--color-teal);
}
.checklist-checkbox:checked::after {
  content: '';
  display: block;
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: 1.5px solid var(--bg-main);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* Checked item — strikethrough + dim */
.checklist-item-label {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.25;
  transition: color 0.15s, text-decoration-color 0.15s;
  text-decoration: none;
  flex: 1;
}
.checklist-item.checked .checklist-item-label {
  color: var(--text-dim);
  text-decoration: line-through;
  text-decoration-color: var(--text-dim);
}
.checklist-item.checked {
  opacity: 0.65;
}

/* ─── Inline editing on day cards ────────────────────────────────────────── */

/* Card header: badge + copy-day button */
.checklist-card-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: start;
  flex-shrink: 0;
}

.checklist-copy-day-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-main);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.checklist-copy-day-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
  background: var(--accent-hover);
}

/* Section header right side: progress + add button */
.checklist-section-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checklist-section-add-btn {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-main);
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.checklist-section-add-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
  background: var(--accent-hover);
}

/* Per-item inline controls (revealed on row hover) */
.checklist-item-actions {
  display: flex;
  gap: 1px;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.1s;
}
.checklist-item:hover .checklist-item-actions,
.checklist-item:focus-within .checklist-item-actions {
  opacity: 1;
}

.checklist-item-btn {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: color 0.1s, background 0.1s;
}
.checklist-item-btn:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--border-medium);
}
.checklist-item-btn.danger:hover:not(:disabled) {
  color: var(--color-red);
}
.checklist-item-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

/* Keep actions visible right after an arrow-move so repeated clicks land */
.checklist-item.actions-visible .checklist-item-actions {
  opacity: 1;
}

/* Drag handle for reordering checklist items */
.checklist-drag-handle {
  flex-shrink: 0;
  width: 13px;
  margin-left: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-dim);
  cursor: grab;
  opacity: 0.25;
  touch-action: none;
  transition: opacity 0.1s, color 0.1s;
}
.checklist-item:hover .checklist-drag-handle,
.checklist-item:focus-within .checklist-drag-handle {
  opacity: 0.6;
}
.checklist-drag-handle:hover {
  opacity: 1;
  color: var(--text-primary);
}
.checklist-drag-handle:active {
  cursor: grabbing;
}

/* The row being dragged (its ghost follows the pointer) */
.checklist-item.dragging {
  opacity: 0.4;
}

/* Blue line showing where a dragged item will drop */
.checklist-drop-indicator {
  height: 2px;
  margin: 0 8px;
  background: var(--color-blue);
  border-radius: 1px;
  pointer-events: none;
}

/* Empty-section hint inside a card */
.checklist-section-empty {
  padding: 8px 10px;
  font-size: 11px;
  font-style: italic;
  color: var(--text-dim);
}

/* Inline add/edit form inside a day-card section */
.checklist-day-card .checklist-add-form,
.checklist-day-card .checklist-edit-form {
  margin: 6px 8px 8px;
  padding: 8px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-main);
}

/* ─── Checklist sidebar help panel ───────────────────────────────────────── */
#picklist.checklist-help {
  padding: 4px 12px 12px;
  overflow-y: auto;
}
.checklist-help-block {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.checklist-help-block p { margin: 0 0 10px; }
.checklist-help-block ul {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.checklist-help-block li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checklist-help-key {
  flex-shrink: 0;
  min-width: 26px;
  height: 22px;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-main);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 12px;
}
.checklist-help-note {
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

/* Mobile: checklist sidebar same as planner (already handled by ≤720px media query) */
@media (max-width: 720px) {
  body.checklist-mode #sidebar {
    position: fixed;
    top: 0;
    left: calc(-1 * var(--sidebar-width));
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 100;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.4);
  }
  body.checklist-mode.sidebar-open #sidebar {
    left: 0;
  }
  body.checklist-mode #sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

