:root {
  --z-pet: 5;
  --z-due-input: 50;
  --z-dropdown: 100;
  --z-modal: 200;
  --z-toast: 300;

  --btn-border: #e0dbd2;
  --btn-bg: none;
  --btn-hover-bg: #ece8e1;
  --btn-active-bg: #eeece8;
  --btn-active-border: #c0bbb4;
  --btn-radius: 5px;
  --btn-font-size: 0.78rem;
  --btn-color: #666;
  --btn-transition: background 0.1s, color 0.1s;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scrollbar-gutter: stable;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fdfdfd;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 48px 16px;
}

.container {
  background: #fdfdfd;
  width: 100%;
  max-width: 580px;
  padding: 40px 44px;
  height: fit-content;
}

/* Breadcrumb */
#breadcrumb {
  font-size: 0.8rem;
  color: #c0bbb4;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

#breadcrumb:empty { display: none; }

#breadcrumb .crumb {
  cursor: pointer;
  color: #aaa;
}

#breadcrumb .crumb:hover { color: #333; text-decoration: underline; }
#breadcrumb .sep { color: #ddd; }

#breadcrumb .crumb-root {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  padding: 4px 6px;
  margin: -4px -6px -4px -4px;
  border-radius: 4px;
}
#breadcrumb .crumb-root:hover { text-decoration: none; color: #333; }
#breadcrumb .crumb-root.current { cursor: default; }
#breadcrumb .crumb-root.current:hover { background: transparent; color: inherit; }

#breadcrumb .crumb-up,
#breadcrumb .crumb-forward {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  padding: 4px 6px;
  margin: -4px 0;
  border-radius: 4px;
  color: #aaa;
}
#breadcrumb .crumb-up { margin-left: -6px; }
#breadcrumb .crumb-up:hover,
#breadcrumb .crumb-forward:hover {
  color: #333;
  text-decoration: none;
  background: #f2efe9;
}
#breadcrumb .crumb-up.disabled,
#breadcrumb .crumb-forward.disabled {
  color: #dcd7cc;
  cursor: default;
}
#breadcrumb .crumb-up.disabled:hover,
#breadcrumb .crumb-forward.disabled:hover {
  color: #dcd7cc;
  background: transparent;
}

#zoomUpHotzone,
#zoomDownHotzone {
  position: fixed;
  top: 0;
  width: 72px;
  height: 100vh;
  z-index: 40;
  pointer-events: none;
}
#zoomUpHotzone   { left: 0; }
#zoomDownHotzone { right: 0; }
#zoomUpHotzone.enabled,
#zoomDownHotzone.enabled { pointer-events: auto; }
#zoomUpHotzone:not(.enabled)   #zoomUpBtn,
#zoomDownHotzone:not(.enabled) #zoomDownBtn { display: none; }
#zoomUpBtn,
#zoomDownBtn {
  position: absolute;
  top: 50vh;
  transform: translateY(-50%);
  width: 44px;
  height: 60vh;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fdfdfd;
  border: 1px solid #e6e0d6;
  border-radius: 6px;
  color: #aaa;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.1s, background 0.1s;
  font: inherit;
}
#zoomUpBtn   { left: 14px; }
#zoomDownBtn { right: 14px; }
#zoomUpHotzone.enabled:hover   #zoomUpBtn,
#zoomDownHotzone.enabled:hover #zoomDownBtn { opacity: 1; }
#zoomUpBtn:hover,
#zoomDownBtn:hover {
  color: #333;
  background: #f6f3ec;
}
#zoomUpBtn.disabled,
#zoomDownBtn.disabled {
  color: #dcd7cc;
  cursor: default;
}
#zoomUpBtn.disabled:hover,
#zoomDownBtn.disabled:hover {
  color: #dcd7cc;
  background: #fdfdfd;
}

/* Title */
h1 {
  font-size: 0.68rem;
  font-weight: 600;
  color: #c0bbb4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 24px;
  display: none;
}

h1.zoomable {
  display: block;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.01em;
  text-transform: none;
  margin-bottom: 6px;
}
h1.zoomable:hover { color: #555; }

h1.static-title {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.01em;
  text-transform: none;
  margin-bottom: 6px;
}

/* Filters */
.filters {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
}

.filters .spacer { flex: 1; }

/* Sort segment control */
.sort-segment {
  display: flex;
  border: 1px solid #e0ddd6;
  border-radius: 5px;
  overflow: hidden;
}

.sort-segment button {
  background: var(--btn-bg);
  border: none;
  border-right: 1px solid #e0ddd6;
  padding: 4px 11px;
  font-size: var(--btn-font-size);
  cursor: pointer;
  color: #b0ab9f;
  transition: var(--btn-transition);
  font-family: inherit;
}

.sort-segment button:last-child { border-right: none; }
.sort-segment button:hover { background: #f5f3ee; color: #444; }
.sort-segment button.active { background: #eeece8; color: #333; font-weight: 600; }

/* Summary Zone */
.summary-zone {
  margin-bottom: 20px;
}
.summary-zone:empty { display: none; }

.summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.76rem;
  color: #888;
  padding: 0 2px;
}
.summary-stat { display: flex; align-items: center; gap: 4px; }
.summary-stat.alert { color: #b03030; font-weight: 600; }
.summary-stat.warn  { color: #c97820; font-weight: 600; }
.summary-stat.zero  { color: #ccc; }

.summary-ai {
  margin-top: 12px;
  padding: 14px 18px;
  background: #f4f1f8;
  border: 1px solid #e2dce8;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #555;
  line-height: 1.55;
}
.summary-ai-body {
  /* Runt 回避: 最終行が極端に短くならないよう調整 */
  text-wrap: pretty;
}
.summary-ai-loading { color: #b0ab9f; font-style: italic; }
/* sleeping フェーズ: 紫エリアを透明化し、body に猫+ボタンを横並びで配置 */
.summary-ai-sleeping {
  background: transparent;
  border-color: transparent;
  padding-top: 0;
  padding-bottom: 0;
  min-height: 0;
  position: relative;
}
.summary-ai-sleeping .summary-ai-header {
  display: none;
}
.summary-ai-sleeping .summary-ai-body {
  display: flex;
  align-items: center;
  min-height: 72px;    /* 猫の表示高さ(≈69px)に合わせる */
  padding-left: 100px; /* 猫(20px + 70px) + 余白 を避ける */
}
.summary-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.summary-ai-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: #b0a8be;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.summary-refresh-btn {
  background: var(--btn-bg);
  border: 1px solid #e2dce8;
  border-radius: var(--btn-radius);
  padding: 3px 10px;
  font-size: 0.7rem;
  cursor: pointer;
  color: #b0a8be;
  transition: var(--btn-transition);
  font-family: inherit;
}
.summary-refresh-btn:hover { background: #ece8f2; color: #555; }
.summary-refresh-btn:disabled { opacity: 0.4; cursor: default; }

.summary-wake-btn {
  background: var(--btn-bg);
  border: 1px solid #d8d0e4;
  border-radius: var(--btn-radius);
  padding: 7px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  color: #8a7fa0;
  transition: var(--btn-transition);
  font-family: inherit;
  animation: wake-breath 4.5s ease-in-out infinite;
}
.summary-wake-btn:hover {
  background: #ece8f2;
  color: #555;
  animation-play-state: paused;
}

@keyframes wake-breath {
  0%, 100% { box-shadow: 0 0 0 0 rgba(138, 127, 160, 0.35); }
  50%      { box-shadow: 0 0 0 8px rgba(138, 127, 160, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .summary-wake-btn { animation: none; }
}

/* Silvia 選択肢ボタン群 */
.silvia-choices,
.silvia-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.silvia-choice-btn {
  background: var(--btn-bg);
  border: 1px solid #d8d0e4;
  border-radius: var(--btn-radius);
  padding: 5px 12px;
  font-size: 0.76rem;
  cursor: pointer;
  color: #6e6680;
  transition: var(--btn-transition);
  font-family: inherit;
}
.silvia-choice-btn:hover {
  background: #ece8f2;
  color: #3f3850;
  border-color: #c5bad4;
}
.silvia-choice-btn:disabled { opacity: 0.4; cursor: default; }

/* フェードイン */
@keyframes silvia-fade-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}
.silvia-fade-in { animation: silvia-fade-in 0.35s ease-out; }

li.task-item.archived .task-text { color: #c0bbb4; }
li.task-item.archived .bullet    { color: #c0bbb4; }

li.task-item.ancestor-placeholder { opacity: 0.45; }
li.task-item.ancestor-placeholder .task-text { font-style: italic; cursor: default; }
li.task-item.ancestor-placeholder .bullet { cursor: default; }

li.task-item.waiting .bullet     { color: #111; }

/* Waiting but overdue */
li.task-item.waiting-overdue .bullet { color: #c0392b; }

/* Waiting and due within 7 days */
li.task-item.waiting-urgent {
  background: #faf4e2 !important;
  border-radius: 4px;
}
li.task-item.waiting-urgent .task-text { color: #8a5e18; font-weight: 500; }
li.task-item.waiting-urgent .bullet    { color: #8a5e18; }

.waiting-badge {
  font-size: 0.72rem;
  color: #3a7dc9;
  display: none;
}
.waiting-badge.visible { display: inline-flex; align-items: center; }

/* Task list */
ul { list-style: none; }

li.task-item {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  user-select: none;
  padding: 3px 6px;
  border-radius: 5px;
  position: relative;
}

li.task-item:hover { background: #f3f0eb; }

/* Collapse toggle */
.collapse-btn {
  width: 18px;
  min-width: 18px;
  height: calc(0.95rem * 1.65 - 0.25px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #d4cfc8;
  font-size: 0.55rem;
  transition: color 0.15s;
  user-select: none;
  flex-shrink: 0;
  margin-top: calc(0.74rem * 1.2 + 1px);
}
li.task-item:not(:has(.due-badge.visible)):not(:has(.inherited-due-badge.visible)):not(:has(.waiting-badge.visible)):not(:has(.inherited-waiting-badge.visible)):not(:has(.routine-badge.visible)) .collapse-btn {
  margin-top: 0;
}

.collapse-btn:hover { color: #888; }
.collapse-btn.empty { visibility: hidden; pointer-events: none; }

/* Bullet (zoom + drag) */
.bullet {
  width: 18px;
  min-width: 18px;
  height: calc(0.95rem * 1.65 - 0.25px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: #111;
  font-size: 0.55rem;
  transition: color 0.15s;
  user-select: none;
  flex-shrink: 0;
  margin-top: calc(0.74rem * 1.2 + 1px);
}
li.task-item:not(:has(.due-badge.visible)):not(:has(.inherited-due-badge.visible)):not(:has(.waiting-badge.visible)):not(:has(.inherited-waiting-badge.visible)):not(:has(.routine-badge.visible)) .bullet {
  margin-top: 0;
}

.bullet:hover  { cursor: pointer; }
.bullet:active { cursor: grabbing; }
li.task-item.done > .bullet { color: #c0bbb4; }

/* Text row */
.text-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Inline link */
.task-text a.inline-link {
  color: #4a7ec7;
  text-decoration: underline;
  text-decoration-color: #b8d0ea;
  cursor: text;
}
.task-text a.inline-link:hover {
  text-decoration-color: #4a7ec7;
}
li.task-item.done .task-text a.inline-link {
  color: #c0bbb4;
  text-decoration-color: #d4cfc8;
}

/* Menu button */
.menu-btn {
  background: none;
  border: none;
  color: #c0bbb4;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0;
  transition: color 0.15s, opacity 0.15s;
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
  position: relative;
  width: 18px;
  min-width: 18px;
  height: calc(0.95rem * 1.65 - 0.25px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: calc(0.74rem * 1.2 + 1px);
}
li.task-item:not(:has(.due-badge.visible)):not(:has(.inherited-due-badge.visible)):not(:has(.waiting-badge.visible)):not(:has(.inherited-waiting-badge.visible)):not(:has(.routine-badge.visible)) .menu-btn {
  margin-top: 0;
}

li.task-item:hover > .menu-btn { opacity: 1; }
li.task-item.menu-open > .menu-btn { opacity: 1; }
.menu-btn:hover { color: #555; }

/* Dropdown */
.dropdown {
  position: absolute;
  left: 0;
  top: 100%;
  background: #f3f0eb;
  border: 1px solid #e0dbd2;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.05);
  z-index: var(--z-dropdown);
  min-width: 160px;
  padding: 5px 0;
  animation: fadeIn 0.1s ease;
}
.dropdown.ctx {
  position: fixed;
}

.dropdown button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 0.84rem;
  text-align: left;
  cursor: pointer;
  color: #3a3530;
  transition: var(--btn-transition);
  letter-spacing: -0.01em;
}

.dropdown button:hover { background: var(--btn-hover-bg); }
.dropdown button.danger { color: #a03025; }
.dropdown button {display: flex; align-items: center; gap: 0; }
.dropdown button svg { flex-shrink: 0; width: 13px; margin-right: 0; opacity: 0.6; }
.dropdown button .icon-cell { width: 28px; display: flex; justify-content: center; flex-shrink: 0; }
.dropdown button .label-cell { flex: 1; }

/* Date panel */
.date-panel { padding: 10px 12px; }
.date-panel-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #aaa;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.date-panel input[type="date"] {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.84rem;
  border: 1px solid #c8c3bc;
  border-radius: 5px;
  background: #fdfdfd;
  color: #333;
  outline: none;
  margin-bottom: 8px;
}
.date-panel input[type="date"]:focus { border-color: #888; }
.date-panel-actions { display: flex; gap: 6px; }
.date-panel-actions button {
  flex: 1;
  padding: 5px 8px;
  font-size: var(--btn-font-size);
  border: 1px solid var(--btn-border);
  border-radius: var(--btn-radius);
  background: var(--btn-bg);
  cursor: pointer;
  color: var(--btn-color);
  transition: var(--btn-transition);
}
.date-panel-actions button:hover { background: var(--btn-hover-bg); }
.date-panel-actions button.primary {
  background: var(--btn-active-bg);
  border-color: var(--btn-active-border);
  font-weight: 600;
  color: #333;
}
.date-panel-actions button.primary:hover { background: #e4e0d8; }

/* AI hint input */
.ai-hint-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.84rem;
  border: 1px solid #c8c3bc;
  border-radius: 5px;
  background: #fdfdfd;
  color: #333;
  outline: none;
  margin-bottom: 8px;
  box-sizing: border-box;
}
.ai-hint-input:focus { border-color: #888; }
.ai-hint-input::placeholder { color: #bbb; }

/* AI preview modal */
.ai-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.1s ease;
}
.ai-preview-modal {
  background: #f3f0eb;
  border: 1px solid #e0dbd2;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  padding: 16px 20px;
  min-width: 320px;
  max-width: 480px;
  max-height: 70vh;
  overflow-y: auto;
}
.ai-preview-modal .date-panel-label { margin-bottom: 12px; }
.ai-preview-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.ai-preview-item input[type="checkbox"] {
  margin-top: 4px;
  flex-shrink: 0;
}
.ai-preview-item .ai-preview-text {
  flex: 1;
  font-size: 0.84rem;
  color: #3a3530;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  outline: none;
  min-height: 1.4em;
}
.ai-preview-item .ai-preview-text:focus {
  border-color: #c8c3bc;
  background: #fdfdfd;
}
.ai-preview-actions {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  justify-content: flex-end;
}
.ai-preview-actions button {
  padding: 6px 14px;
  font-size: 0.8rem;
  border: 1px solid var(--btn-border);
  border-radius: var(--btn-radius);
  background: var(--btn-bg);
  cursor: pointer;
  color: var(--btn-color);
  transition: var(--btn-transition);
}
.ai-preview-actions button:hover { background: var(--btn-hover-bg); }
.ai-preview-actions button.primary {
  background: var(--btn-active-bg);
  border-color: var(--btn-active-border);
  font-weight: 600;
  color: #333;
}
.ai-preview-actions button.primary:hover { background: #e4e0d8; }
.section-header svg { vertical-align: -2px; margin-right: 5px; opacity: 0.5; }
.waiting-badge svg { vertical-align: -2px; margin-right: 3px; }
.dropdown .divider {
  height: 1px;
  background: #e0dbd2;
  margin: 4px 0;
}

/* Task content */
.task-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Task text (contenteditable) */
.task-text {
  flex: 1;
  min-width: 0;
  user-select: text;
  font-size: 0.95rem;
  color: #111;
  outline: none;
  word-break: break-word;
  line-height: 1.65;
  padding: 1px 2px;
  border-radius: 3px;
  min-height: 1.65em;
  cursor: text;
  white-space: pre-wrap;
}


.task-text:empty::before {
  content: attr(data-placeholder);
  color: #d4cfc8;
  pointer-events: none;
}

li.task-item.done .task-text {
  color: #c0bbb4;
}
li.task-item.done-directly .task-text {
  text-decoration: line-through;
  text-decoration-color: #d4cfc8;
}

/* Meta row (due date + waiting badge) */
.meta-row {
  display: none;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin-left: -18px;
}
.meta-row:has(.due-badge.visible),
.meta-row:has(.inherited-due-badge.visible),
.meta-row:has(.waiting-badge.visible),
.meta-row:has(.inherited-waiting-badge.visible),
.meta-row:has(.routine-badge.visible) { display: flex; }

/* Zoomed-in title meta row (deadline / waiting for the title task) */
.page-title-meta {
  margin-left: 0;
  margin-top: -4px;
  margin-bottom: 10px;
}

/* Due date */
.due-badge {
  font-size: 0.74rem;
  color: #666;
  display: none;
}

.due-badge.visible   { display: inline; }
.due-badge.clickable { cursor: pointer; border-radius: 3px; padding: 0 3px; margin: 0 -3px; }
.due-badge.clickable:hover { background: rgba(0, 0, 0, 0.06); text-decoration: underline; }
.due-badge.overdue   { color: #b03030; font-weight: 600; }
.due-badge.today     { color: #c97820; font-weight: 600; }
li.task-item.done .due-badge { color: #c8c3bc !important; font-weight: normal; }

/* Inherited due date (from collapsed descendants) */
.inherited-due-badge {
  font-size: 0.74rem;
  color: #999;
  display: none;
}
.inherited-due-badge.visible { display: inline; }
.inherited-due-badge.has-own-due {
  border-left: 1px solid #d4cfc8;
  padding-left: 6px;
}
.inherited-due-badge.overdue { color: #c06060; font-weight: 600; }
.inherited-due-badge.today   { color: #d0a050; font-weight: 600; }
li.task-item.done .inherited-due-badge { display: none; }

/* Inherited waiting (from collapsed descendants) */
.inherited-waiting-badge {
  font-size: 0.72rem;
  color: #7aaadb;
  display: none;
}
.inherited-waiting-badge.visible { display: inline-flex; align-items: center; }
.inherited-waiting-badge svg { vertical-align: -2px; margin-right: 3px; }
.meta-row:has(.due-badge.visible) .inherited-waiting-badge.visible,
.meta-row:has(.inherited-due-badge.visible) .inherited-waiting-badge.visible {
  border-left: 1px solid #d4cfc8;
  padding-left: 6px;
}
li.task-item.done .inherited-waiting-badge { display: none; }

li.task-item.overdue .task-text  { color: #b03030; }
li.task-item.overdue .bullet     { color: #b03030; }
li.task-item.today   .task-text  { color: #c97820; }
li.task-item.today   .bullet     { color: #c97820; }

input.due-input {
  font-size: 0.76rem;
  padding: 4px 8px;
  border: 1px solid #c0bbb4;
  border-radius: 6px;
  outline: none;
  color: #444;
  display: none;
  width: fit-content;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  position: absolute;
  top: calc(100% + 4px);
  left: 40px;
  z-index: var(--z-due-input);
}

input.due-input.visible { display: block; }


/* Section headers (date sort mode) */
.section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 6px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: #c8c3bc;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  user-select: none;
  border-top: 1px solid #ede9e2;
}

.section-header:not(:first-child) {
  margin-top: 12px;
}

/* Completion log view */
li.log-entry {
  list-style: none;
  padding: 6px 6px 6px 10px;
  color: #6f6a63;
  line-height: 1.5;
  cursor: default;
  display: grid;
  grid-template-columns: 20px 1fr;
  column-gap: 2px;
}
.log-expand-btn {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  width: 18px;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #a09f9a;
  cursor: pointer;
  user-select: none;
}
.log-expand-btn:hover { color: #888; }
.log-expand-btn.empty { visibility: hidden; pointer-events: none; }
.log-breadcrumb {
  grid-column: 2;
  grid-row: 1;
  font-size: 0.72rem;
  color: #a8a39a;
  line-height: 1.3;
  padding-left: 18px;
  margin-bottom: 1px;
  word-break: break-all;
}
.log-body {
  grid-column: 2;
  grid-row: 2;
  font-size: 0.92rem;
  padding-left: 18px;
  position: relative;
  cursor: default;
}
.log-body::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  color: #b8b1a6;
  font-size: 0.8rem;
}

.log-descendants {
  list-style: none;
  margin: 0;
  padding: 0 0 0 54px;
}
.log-descendants .log-descendants {
  padding-left: 32px;
}
li.log-descendant {
  padding: 3px 6px 3px 10px;
  color: #6f6a63;
  line-height: 1.45;
}
li.log-descendant .log-body {
  display: block;
  font-size: 0.88rem;
  padding-left: 18px;
  position: relative;
}
li.log-descendant .log-body::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  color: #c8c1b4;
  font-size: 0.75rem;
}

/* Drag states */
li.task-item.dragging { opacity: 0.4; }

/* Drop indicator */
#dropIndicator {
  position: fixed;
  height: 2px;
  background: #888;
  border-radius: 1px;
  pointer-events: none;
  display: none;
  z-index: var(--z-dropdown);
}
#dropIndicator::before {
  content: '';
  position: absolute;
  left: -3px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #888;
}

/* Add task hint */
.add-hint {
  padding: 5px 8px;
  color: #d4cfc8;
  font-size: 0.88rem;
  cursor: pointer;
  user-select: none;
  margin-top: 4px;
  border-radius: 5px;
}

.add-hint:hover { color: #888; background: #f3f0eb; }

/* io-row */
.io-row {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.io-row button {
  flex: 1;
  background: var(--btn-bg);
  border: 1.5px solid var(--btn-border);
  border-radius: var(--btn-radius);
  padding: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--btn-color);
  transition: all 0.2s;
}

.io-row button:hover { border-color: #4f46e5; color: #4f46e5; }

.io-row button.active {
  border-color: #4f46e5;
  color: #4f46e5;
  background: #eef2ff;
}

.save-status {
  margin-top: 8px;
  font-size: 0.75rem;
  color: #aaa;
}

#saveToast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #3a3530;
  color: #f7f5f0;
  font-size: 0.82rem;
  padding: 8px 16px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: var(--z-toast);
}
#saveToast.show { opacity: 1; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* li.task-item への fadeIn は render() 再構築時に全項目が点滅する原因になるため削除 */

/* Task enter animation (new tasks only) */
@keyframes task-enter {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.task-item.entering {
  animation: task-enter 0.15s ease-out;
}

/* Checkbox pulse animation */
@keyframes check-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.bullet.pulsing {
  animation: check-pulse 0.2s ease-out;
}

/* Thinking dots animation */
@keyframes thinking-dots {
  0%, 20% { content: '.'; }
  40%     { content: '..'; }
  60%, 100% { content: '...'; }
}
.summary-ai-loading::after {
  content: '';
  animation: thinking-dots 1.2s steps(1) infinite;
}

/* Empty state */
.empty-state {
  text-align: center;
  color: #c0bbb4;
  padding: 60px 0;
  font-size: 0.9rem;
}

/* Multi-select */
li.task-item.selected { background: #e8f0fe !important; }
li.task-item.selected:hover { background: #dce8fd !important; }

/* ⌘K Search overlay */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: var(--z-modal);
  display: flex;
  justify-content: center;
  padding-top: 20vh;
  animation: fadeIn 0.1s ease;
}
.search-modal {
  background: #fdfdfd;
  border: 1px solid #d4cfc8;
  border-radius: 12px;
  width: 480px;
  max-height: 400px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  height: fit-content;
}
.search-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid #e8e4dc;
  padding: 14px 18px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  background: transparent;
  box-sizing: border-box;
}
.search-input::placeholder { color: #c0bbb4; }
.search-results {
  overflow-y: auto;
  max-height: 320px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.search-result-item {
  padding: 10px 18px;
  cursor: pointer;
}
.search-result-item:hover,
.search-result-item.active {
  background: #f3f0eb;
}
.search-result-path {
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 2px;
}
.search-result-text {
  font-size: 0.9rem;
  color: #333;
}

/* Shortcut overlay */
.shortcut-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: var(--z-modal);
  display: flex;
  justify-content: center;
  padding-top: 15vh;
  animation: fadeIn 0.1s ease;
}
.shortcut-modal {
  background: #fdfdfd;
  border: 1px solid #d4cfc8;
  border-radius: 12px;
  width: 420px;
  max-height: 480px;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  padding: 20px 24px;
  height: fit-content;
}
.shortcut-modal h2 {
  font-size: 0.72rem;
  font-weight: 600;
  color: #c0bbb4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.shortcut-category {
  margin-bottom: 16px;
}
.shortcut-category-title {
  font-size: 0.7rem;
  font-weight: 600;
  color: #999;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 0.84rem;
  color: #555;
}
.shortcut-key {
  font-size: 0.76rem;
  color: #888;
  background: #f3f0eb;
  border: 1px solid #e0dbd2;
  border-radius: 4px;
  padding: 2px 8px;
  font-family: inherit;
}

/* Date unified input */
.date-input-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 8px;
  border: 1px solid #c8c3bc;
  border-radius: 5px;
  background: #fdfdfd;
  overflow: hidden;
}
.date-input-row:focus-within { border-color: #888; }
.date-input-row.invalid { border-color: #c0392b; animation: shake 0.3s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

.date-quick-input {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.84rem;
  border: none;
  background: transparent;
  color: #333;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  min-width: 0;
}
.date-quick-input::placeholder { color: #bbb; }

.dropdown .date-cal-btn,
.date-cal-btn {
  background: none;
  border: none;
  border-left: 1px solid #e0dbd2;
  padding: 6px 8px;
  width: 32px;
  min-width: 32px;
  cursor: pointer;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  flex-grow: 0;
}
.dropdown .date-cal-btn:hover,
.date-cal-btn:hover { color: #555; background: #f3f0eb; }

.date-hidden-picker {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

/* Timeframe ボタン行 */
.timeframe-row {
  display: flex;
  gap: 4px;
  padding: 4px 0 2px;
}
.timeframe-btn {
  flex: 1;
  padding: 4px 2px;
  font-size: 11px;
  border: 1px solid #e0dcd6;
  border-radius: 4px;
  background: #fff;
  color: #666;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.timeframe-btn:hover {
  background: #f3f0eb;
  border-color: #ccc;
  color: #333;
}
.timeframe-btn.active {
  background: #e8e4de;
  border-color: #b0a89c;
  color: #333;
  font-weight: 600;
}

/* ==================== ルーティン関連 ==================== */

/* 周期設定ロー（日付パネル内） */
.recurrence-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 2px;
  border-top: 1px solid #eee;
  margin-top: 4px;
}
.recurrence-label {
  font-size: 0.78rem;
  color: #666;
}
.recurrence-select {
  font-size: 0.78rem;
  padding: 3px 6px;
  border: 1px solid #d4cfc8;
  border-radius: 4px;
  background: #fff;
  color: #333;
  cursor: pointer;
}
.recurrence-select:disabled {
  background: #f5f4f1;
  color: #aaa;
  cursor: not-allowed;
}
.recurrence-custom-input {
  width: 56px;
  font-size: 0.78rem;
  padding: 3px 6px;
  border: 1px solid #d4cfc8;
  border-radius: 4px;
}

/* ルーティンバッジ（タスク行） */
.routine-badge {
  font-size: 0.72rem;
  color: #6a7fb8;
  display: none;
}
.routine-badge.visible {
  display: inline-flex;
  align-items: center;
  background: #eef0f7;
  padding: 1px 6px;
  border-radius: 8px;
}
.routine-badge svg { vertical-align: -2px; margin-right: 3px; }
li.task-item.done .routine-badge { color: #c0bbb4; background: #f3f2ee; }

/* 完了ログ: miss エントリ */
.log-entry.missed .log-body { color: #a8a6a1; }
.log-entry.missed .log-breadcrumb { color: #c8c5bf; }

/* ROUTINE ビュー */
.routine-empty {
  color: #888;
  font-size: 0.88rem;
  padding: 24px 8px;
  text-align: center;
  list-style: none;
}
.routine-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  list-style: none;
  transition: background 0.12s;
}
.routine-row:hover {
  background: #faf9f6;
}
.routine-name {
  flex: 1;
  min-width: 120px;
  font-size: 0.9rem;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.streak-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.streak-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.75rem;
  line-height: 1;
  user-select: none;
}
.streak-dot-done {
  color: #fff;
  background: #7fae5a;
}
.streak-dot-partial {
  color: #fff;
  background: #d8a845;
}
.streak-dot-miss {
  color: #fff;
  background: #d08080;
}
.routine-streak-counter {
  font-size: 0.82rem;
  color: #666;
  min-width: 64px;
  text-align: right;
  flex-shrink: 0;
}

/* ==================== Web 版専用ツールバー ==================== */
.web-toolbar { display: none; gap: 8px; padding: 8px 0; }
body.is-web .web-toolbar { display: flex; }
.web-toolbar .toolbar-btn {
  padding: 4px 12px;
  background: #2a2a2a;
  color: #e0e0e0;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
}
.web-toolbar .toolbar-btn:hover { background: #333; }
.web-toolbar .toolbar-btn.active { background: #3a5f8a; border-color: #4a7fb0; color: #fff; }
