/* widgets.css - ウィジェット別スタイル */

/* TODO ウィジェット */
.todo-input-row { display: flex; gap: 6px; margin-bottom: 8px; }
.todo-input-row input { flex: 1; }
.todo-list { list-style: none; padding: 0; margin: 0; }
.todo-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px; border-bottom: 1px solid var(--border);
}
.todo-item:last-child { border-bottom: none; }
.todo-item.done { opacity: 0.55; }
.todo-item.done .todo-text { text-decoration: line-through; }
.todo-check {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border); border-radius: 4px;
  cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center;
  flex-shrink: 0; background: var(--bg-elev);
}
.todo-check.checked { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.todo-check.checked::before { content: "✓"; font-size: 13px; line-height: 1; }
.todo-text { flex: 1; cursor: text; font-size: 13px; }
.todo-pct {
  font-size: 11px; padding: 1px 6px; border-radius: 9px;
  background: var(--bg-sunk); color: var(--fg-mute); cursor: pointer;
}
.todo-pct.p100 { background: var(--ok); color: var(--accent-fg); }
.todo-pct.p50 { background: var(--info); color: var(--accent-fg); }
.todo-pct.p10 { background: var(--warn); color: var(--accent-fg); }
.todo-del {
  background: transparent; border: none; color: var(--fg-dim);
  cursor: pointer; font-size: 14px; padding: 2px 4px;
}
.todo-del:hover { color: var(--danger); }
.todo-detail {
  font-size: 11px; color: var(--fg-mute);
  margin-left: 26px; display: none; padding: 4px 0;
}
.todo-item.expanded .todo-detail { display: block; }
.todo-expand-btn {
  background: transparent; border: none; color: var(--fg-dim);
  cursor: pointer; font-size: 10px; padding: 2px;
}
.todo-section-label {
  font-size: 11px; color: var(--fg-mute);
  margin: 8px 0 4px; text-transform: uppercase; letter-spacing: 0.05em;
}

/* 予定 */
.ev-list { list-style: none; padding: 0; margin: 0; }
.ev-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; }
.ev-time { color: var(--fg-mute); font-size: 11px; min-width: 90px; }
.ev-title { flex: 1; }
.ev-cat { font-size: 11px; color: var(--fg-mute); }

/* 〆切リマインド */
.dl-list { list-style: none; padding: 0; margin: 0; }
.dl-item { padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.dl-item:last-child { border-bottom: none; }
.dl-rem { color: var(--warn); font-weight: 600; margin-right: 8px; }
.dl-rem.near { color: var(--danger); }
.dl-rem.far { color: var(--fg-mute); font-weight: normal; }
.dl-title { font-weight: 500; }
.dl-ms-row { margin-left: 16px; font-size: 11px; color: var(--fg-mute); padding: 2px 0; }
.dl-progress { display: inline-block; margin-left: 8px; font-size: 11px; color: var(--fg-mute); }

/* 気分 */
.mood-toggle-btn { width: 100%; padding: 8px; background: var(--bg-sunk); border: 1px dashed var(--border); }
.mood-form { display: none; }
.mood-form.open { display: block; }
.mood-score-row { display: flex; gap: 8px; margin-bottom: 8px; }
.mood-emoji { font-size: 22px; cursor: pointer; opacity: 0.4; padding: 4px 6px; border-radius: 6px; }
.mood-emoji.selected { opacity: 1; background: var(--bg-sunk); }
.mood-row { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.mood-row label { color: var(--fg-mute); font-size: 12px; min-width: 70px; }
.mood-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.mood-chk-pill { padding: 2px 8px; border: 1px solid var(--border); border-radius: 9999px; cursor: pointer; font-size: 11px; }
.mood-chk-pill.selected { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.mood-summary { font-size: 12px; color: var(--fg-mute); }

/* 付箋 */
.sb-sticky h4 { margin: 0 0 6px; font-size: 12px; color: var(--fg-mute); display: flex; justify-content: space-between; align-items: center; }
.sticky-list { display: flex; flex-direction: column; gap: 8px; }
.sticky-item {
  background: #fffbe6; color: #2b2a28;
  border: 1px solid #e8d77f; border-radius: 6px;
  padding: 8px; font-size: 12px;
  white-space: pre-wrap; word-break: break-word; position: relative;
}
[data-theme="dark"] .sticky-item,
[data-theme="system"] .sticky-item { background: #3a3520; border-color: #5a5128; color: #ebe9e3; }
.sticky-textarea { width: 100%; min-height: 40px; background: transparent; border: none; resize: vertical; font-family: inherit; font-size: 12px; color: inherit; }
.sticky-textarea:focus { outline: none; }
.sticky-del { position: absolute; top: 2px; right: 4px; background: transparent; border: none; color: rgba(0,0,0,0.4); font-size: 10px; cursor: pointer; padding: 0 4px; }
.sticky-add-btn { width: 100%; margin-top: 6px; font-size: 11px; padding: 4px; }

/* 〆切ビュー */
.dl-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.dl-card .dl-head { display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.dl-card .ms-list { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); display: none; }
.dl-card.expanded .ms-list { display: block; }
.ms-item { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 12px; }
.ms-item .todo-check { width: 14px; height: 14px; }

/* 統計ビュー (Phase 5) */
.stats-tabs { display: inline-flex; gap: 4px; }
.stats-tab { padding: 4px 10px; font-size: 12px; background: var(--bg-sunk); color: var(--fg-mute); border: 1px solid var(--border); border-radius: 9999px; cursor: pointer; }
.stats-tab.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.stats-empty { padding: 12px; color: var(--fg-mute); font-size: 12px; text-align: center; background: var(--bg-sunk); border-radius: var(--radius); }
.stats-bars-grid { display: flex; gap: 2px; align-items: flex-end; height: 110px; padding: 8px 4px 4px; border-bottom: 1px solid var(--border); }
.stats-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.stats-bar { width: 80%; height: 90px; display: flex; align-items: flex-end; justify-content: center; }
.stats-bar-fill { width: 100%; background: linear-gradient(180deg, var(--accent), var(--info)); border-radius: 3px 3px 0 0; min-height: 1px; transition: height 0.18s ease; }
.stats-bar-label { font-size: 10px; color: var(--fg-mute); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.stats-foot { font-size: 12px; color: var(--fg-mute); margin-top: 6px; text-align: right; }
.stats-qty-list { display: flex; flex-wrap: wrap; gap: 12px; }
.stats-qty-row { display: inline-flex; align-items: baseline; gap: 4px; padding: 4px 10px; background: var(--bg-sunk); border-radius: 9999px; font-size: 13px; }
.stats-qty-unit { color: var(--fg-mute); font-size: 11px; }
.stats-qty-val { font-weight: 600; }
.stats-pie { width: 100%; max-width: 280px; height: auto; color: var(--fg); }
.stats-feedback { background: linear-gradient(180deg, var(--bg-elev), var(--bg-sunk)); border: 1px solid var(--accent); }
.feedback-line { font-size: 14px; line-height: 1.5; padding: 6px 0; }
.feedback-meta { font-size: 10px; color: var(--fg-dim); margin-top: 4px; }
.stats-hint { font-size: 11px; color: var(--fg-mute); text-align: center; padding: 8px; }

/* === Phase 6: キャラ立ち絵 / マスコット === */
.char-avatar {
  width: 36px; height: 36px;
  border-radius: 50%; object-fit: cover;
  border: 1px solid var(--border);
  margin-right: 8px;
  vertical-align: middle;
}
.char-floating {
  position: fixed; right: 16px; bottom: 16px;
  width: 96px; height: 96px;
  background: rgba(255,255,255,0.0) center/contain no-repeat;
  pointer-events: auto; cursor: pointer;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.25));
  z-index: 100;
}
[data-theme="dark"] .char-floating { filter: drop-shadow(0 4px 6px rgba(0,0,0,0.55)); }

/* === Phase 7: ポモドーロ === */
.pomo-wg .pomo-time {
  font-size: 36px; font-family: monospace;
  text-align: center; letter-spacing: 0.05em; margin: 8px 0;
  color: var(--accent);
}
.pomo-wg.is-break .pomo-time { color: var(--ok); }
.pomo-phase { color: var(--fg-mute); font-size: 12px; }
.pomo-ctrl { display: flex; gap: 6px; justify-content: center; }
.pomo-cfg { display: flex; gap: 4px; align-items: center; justify-content: center; margin-top: 6px; font-size: 12px; color: var(--fg-mute); }
.pomo-cycles { font-size: 11px; color: var(--fg-mute); text-align: center; margin-top: 4px; }

/* === Phase 7: タイマー === */
.timer-display {
  font-size: 30px; font-family: monospace;
  text-align: center; margin: 8px 0; color: var(--accent);
}
.timer-ctrl { display: flex; gap: 6px; justify-content: center; margin-bottom: 6px; }
.timer-cfg { display: flex; gap: 6px; }
.timer-cfg input, .timer-cfg select { flex: 1; }

/* === Phase 7: 作業記録 === */
.wl-form-row { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.wl-form-row input, .wl-form-row select { font-size: 12px; }
.wl-list { list-style: none; padding: 0; margin: 6px 0 0; }
.wl-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; font-size: 12px;
  border-bottom: 1px dashed var(--border);
}
.wl-item:last-child { border-bottom: none; }
.wl-mins { font-weight: 600; color: var(--accent); min-width: 50px; }
.wl-qty { color: var(--fg-mute); }
.wl-cat { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: var(--bg-sunk); }
.wl-cat.work { background: #3b5b80; color: white; }
.wl-cat.hobby { background: #7a4a8a; color: white; }
.wl-cat.life { background: #547a4d; color: white; }
.wl-type { font-size: 11px; padding: 1px 8px; border-radius: 4px; background: var(--accent, #7aa2f7); color: #fff; font-weight: 600; }
.wl-unit-label { margin-left: 2px; }
.wl-memo { color: var(--fg-mute); font-size: 11px; flex: 1; }
.wg-sum { color: var(--fg-mute); font-size: 11px; }

/* === Phase 7: 月目標 === */
.goal-month-section { margin-bottom: 12px; }
.goal-month-section h4 {
  margin: 8px 0 4px; font-size: 13px;
  color: var(--fg-mute); border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
.goal-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px;
}
.goal-card.achieved { border-color: var(--ok); background: linear-gradient(180deg, var(--bg-elev), rgba(120,180,120,0.08)); }
.goal-head { display: flex; align-items: center; gap: 8px; }
.goal-title { flex: 1; font-weight: 500; }
.goal-month { color: var(--fg-mute); font-size: 11px; }
.goal-progress-bar {
  background: var(--bg-sunk); border-radius: 9999px;
  height: 8px; overflow: hidden; margin: 6px 0;
}
.goal-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--ok));
  transition: width 0.2s ease;
}
.goal-stat { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.goal-pct { color: var(--fg-mute); font-size: 11px; }
.goal-stat button { margin-left: auto; }
.goal-stat button + button { margin-left: 0; }

/* === Phase 8: 設定 — settings 全般用補助 === */
.settings-section { margin-bottom: 16px; }
.settings-section h3 { font-size: 14px; margin: 8px 0; color: var(--fg-mute); border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.settings-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }
.settings-row label { flex: 1; }
.settings-row .desc { display: block; font-size: 11px; color: var(--fg-mute); margin-top: 2px; }

/* === メモビュー (§4.7) === */
.memo-pane {
  display: flex;
  gap: 12px;
  height: 70vh;
  min-height: 400px;
}
.memo-pane-list {
  flex: 0 0 30%;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding-right: 8px;
}
.memo-pane-edit {
  flex: 1;
  overflow-y: auto;
}
.memo-list { list-style: none; padding: 0; margin: 0; }
.memo-list-item {
  padding: 8px 6px;
  border-bottom: 1px dashed var(--border);
  cursor: pointer;
}
.memo-list-item:hover { background: var(--bg-sunk); }
.memo-list-item.selected { background: var(--bg-sunk); border-left: 3px solid var(--accent); }
.memo-list-title { font-weight: 500; font-size: 13px; }
.memo-list-meta { font-size: 10px; color: var(--fg-mute); margin-top: 2px; }

.memo-title-input {
  width: 100%; font-size: 16px; font-weight: 500;
  padding: 6px; border: 1px solid var(--border); border-radius: 4px;
  margin-bottom: 6px; background: var(--bg-elev); color: var(--fg);
}
.memo-edit-ctrl {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 6px; font-size: 12px;
}
.memo-body-input {
  width: 100%; min-height: 200px;
  padding: 8px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-elev); color: var(--fg);
  font-family: monospace; font-size: 13px; resize: vertical;
}
.memo-preview-head {
  margin: 12px 0 6px; font-size: 11px; color: var(--fg-mute);
  border-top: 1px dashed var(--border); padding-top: 8px;
}
.memo-preview { font-size: 13px; line-height: 1.6; }
.memo-body-plain { white-space: pre-wrap; margin: 0; font-family: inherit; }
.memo-body-md h1, .memo-body-md h2, .memo-body-md h3 { margin: 0.8em 0 0.3em; }
.memo-body-md ul { padding-left: 20px; }
.memo-body-md code {
  background: var(--bg-sunk);
  padding: 1px 4px; border-radius: 3px; font-size: 0.9em;
}
.memo-body-md p { margin: 0.4em 0; }

/* === Today 最近のメモ一覧 (§4.1) === */
.memo-recent-list { list-style: none; padding: 0; margin: 0; }
.memo-recent-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 4px; border-bottom: 1px dashed var(--border);
  cursor: pointer; font-size: 13px;
}
.memo-recent-item:hover { background: var(--bg-sunk); }
.memo-recent-title { flex: 1; }
.memo-recent-date { color: var(--fg-mute); font-size: 11px; margin-left: 8px; }

/* === Phase 6+: マスコット v2 (drag + bubble + anime) === */
.msc-fixed {
  position: fixed;
  z-index: 9000;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.msc-fixed:active { cursor: grabbing; }

.msc-fixed-inner {
  width: 100%; height: 100%;
  position: relative;
  transform-origin: center bottom;
}

.msc-fixed-img {
  width: 100%; height: 100%;
  border-radius: 50%; object-fit: cover;
  border: 2px solid var(--accent);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  display: block;
  pointer-events: none;
}
.msc-fixed-emoji {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 2px solid var(--accent);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  pointer-events: none;
}

/* もちもちアニメ (喋ってる) */
@keyframes msc-mochi {
  0%   { transform: scale(1, 1); }
  15%  { transform: scale(1.10, 0.90); }
  30%  { transform: scale(0.92, 1.10); }
  45%  { transform: scale(1.06, 0.95); }
  60%  { transform: scale(0.97, 1.04); }
  100% { transform: scale(1, 1); }
}
/* もちもちアニメ (クリック) */
@keyframes msc-mochi-click {
  0%   { transform: scale(1, 1); }
  15%  { transform: scale(0.82, 1.18); }
  30%  { transform: scale(1.18, 0.84); }
  45%  { transform: scale(0.92, 1.08); }
  60%  { transform: scale(1.05, 0.96); }
  100% { transform: scale(1, 1); }
}
/* idle 浮遊 */
@keyframes msc-idle-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -6px; }
}
.msc-fixed-inner.msc-idle-float {
  animation: msc-idle-float 3.2s ease-in-out infinite;
}
.msc-fixed-inner.msc-talking {
  animation: msc-mochi 0.65s ease;
}
.msc-fixed-inner.msc-clicked {
  animation: msc-mochi-click 0.55s ease;
}
.msc-fixed-inner:hover {
  animation: msc-mochi 0.5s ease;
}

/* フキダシ */
.msc-bwrap {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: calc(100% + 14px);
  max-width: 280px; min-width: 140px;
  pointer-events: auto;
}
.msc-bwrap.msc-bwrap-right {
  right: auto;
  left: calc(100% + 14px);
}
.msc-bubble {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 10px 30px 10px 14px;
  font-size: 13px; line-height: 1.55;
  color: var(--fg);
  box-shadow: 0 6px 22px rgba(0,0,0,.35);
  word-break: break-word;
}
[data-theme="dark"] .msc-bubble { box-shadow: 0 6px 22px rgba(0,0,0,.55); }
.msc-close {
  position: absolute; top: 4px; right: 6px;
  background: transparent; border: none;
  color: var(--fg-mute); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 2px 6px;
  border-radius: 4px;
}
.msc-close:hover { color: var(--fg); background: var(--bg-sunk); }
.msc-text { word-break: break-word; }
/* チップ (アイコンへ向かう三角) */
.msc-tip-l {
  position: absolute; top: 50%; right: -10px;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 10px solid var(--accent);
}
.msc-tip-r {
  position: absolute; top: 50%; left: -10px;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 10px solid var(--accent);
}

/* === V29 新レイアウト追加スタイル === */
.todo-time {
  font-size: 10px; color: var(--fg-mute);
  font-family: monospace; padding: 0 4px;
}
.wl-time { font-size: 10px; color: var(--fg-mute); font-family: monospace; }

/* プロジェクト card */
.proj-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 8px; overflow: hidden;
}
.proj-card.inactive { opacity: 0.55; }
.proj-card.selected { box-shadow: 0 0 0 2px var(--accent); }
.proj-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; cursor: pointer;
}
.proj-color {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
}
.proj-name { flex: 1; font-weight: 500; }
.proj-stat { font-size: 11px; color: var(--fg-mute); }
.proj-detail {
  padding: 8px 12px 12px; border-top: 1px dashed var(--border);
  background: var(--bg);
}

/* 右パネル いつでも TODO リスト */
.anytime-list .todo-item { padding: 4px 0; }
.anytime-list .todo-text { font-size: 12px; }
.anytime-list .todo-del { font-size: 11px; padding: 1px 6px; }

/* === TODO フォーム (+ ボタン展開式) === */
.todo-form-collapsed { padding: 6px 0 0; }
.todo-add-btn {
  width: 100%; padding: 6px;
  background: var(--bg-sunk); color: var(--fg-mute);
  border: 1px dashed var(--border); border-radius: 4px;
  cursor: pointer; font-size: 12px;
}
.todo-add-btn:hover {
  background: var(--bg-elev); color: var(--fg); border-style: solid;
}
.todo-form.open {
  padding: 8px;
  background: var(--bg-sunk);
  border-radius: 6px;
  margin-top: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.todo-form-row1 input { width: 100%; padding: 6px 8px; font-size: 13px; }
.todo-form-row2 {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
}
.todo-form-row2 select,
.todo-form-row2 input { font-size: 12px; padding: 3px 4px; }

/* 優先度バッジ */
.todo-prio {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  width: 14px; height: 14px; line-height: 14px;
  text-align: center; border-radius: 50%;
  flex-shrink: 0;
}
.todo-prio.prio-high { background: var(--danger); color: white; }
.todo-prio.prio-low  { background: var(--bg-sunk); color: var(--fg-mute); }
.todo-item.prio-high .todo-text { font-weight: 600; }

/* リマインダー */
.todo-reminder {
  font-size: 12px;
  cursor: help;
  flex-shrink: 0;
}

/* モード切替ボタン */
.todo-mode-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-mute);
  font-size: 10px; padding: 1px 5px;
  border-radius: 3px; cursor: pointer;
  flex-shrink: 0;
}
.todo-mode-btn:hover { background: var(--bg-sunk); color: var(--fg); }

/* === 優先度バッジ (中も表示) === */
.todo-prio.prio-mid {
  background: var(--bg-sunk); color: var(--fg-mute);
  border: 1px solid var(--border);
}

/* === 新規プロジェクト カテゴリ問い合わせモーダル === */
.proj-cat-picker {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px;
}
.proj-cat-btn {
  flex: 1 1 calc(50% - 4px);
  padding: 12px;
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elev); color: var(--fg);
  cursor: pointer;
}
.proj-cat-btn:hover { background: var(--bg-sunk); border-color: var(--accent); }
.proj-cat-btn.cat-work { border-left: 4px solid #7aa2f7; }
.proj-cat-btn.cat-hobby { border-left: 4px solid #b48ead; }
.proj-cat-btn.cat-life { border-left: 4px solid #a3be8c; }
.proj-cat-btn.proj-cat-skip {
  flex: 1 1 100%;
  color: var(--fg-mute);
  font-size: 12px;
}

/* === リマインダーモーダル === */
.modal-card.reminder-modal {
  border: 2px solid var(--accent);
  animation: reminder-pulse 0.8s ease-in-out 3;
}
@keyframes reminder-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent); }
  50%      { box-shadow: 0 0 0 10px transparent; }
}
.reminder-modal-body { text-align: center; padding: 8px 0; }
.reminder-icon { font-size: 48px; margin-bottom: 8px; }
.reminder-text {
  font-size: 18px; font-weight: 600;
  margin-bottom: 8px; word-break: break-word;
}
.reminder-when {
  font-size: 12px; color: var(--fg-mute); margin: 8px 0;
}
.reminder-actions {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  margin-top: 16px;
}
.reminder-actions button { padding: 8px 16px; font-size: 13px; }

/* === カレンダービュー (月グリッド) === */
.cal-head {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 0; margin-bottom: 2px;
}
.cal-head span {
  text-align: center; font-size: 11px; font-weight: 600;
  color: var(--fg-mute); padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.cal-head span:first-child { color: var(--danger); }
.cal-head span:last-child { color: var(--info); }

.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px; background: var(--border);
}
.cal-cell {
  background: var(--bg-elev);
  min-height: 80px; padding: 4px 6px;
  cursor: pointer; position: relative;
  overflow: hidden;
  transition: background 0.12s;
}
.cal-cell:hover { background: var(--bg-sunk); }
.cal-cell .day {
  font-size: 12px; font-weight: 600; margin-bottom: 2px;
}
.cal-cell.is-today {
  background: rgba(122, 162, 247, 0.10);
}
.cal-cell.is-today .day {
  display: inline-block;
  background: var(--accent); color: var(--accent-fg);
  border-radius: 50%; width: 22px; height: 22px;
  line-height: 22px; text-align: center;
}
.cal-cell.is-other-month {
  background: var(--bg-sunk); opacity: 0.45;
}
.cal-cell .ev {
  font-size: 10px; line-height: 1.3;
  padding: 1px 4px; margin-top: 1px;
  border-radius: 3px;
  background: var(--accent); color: var(--accent-fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-cell .ev:nth-child(3) { background: var(--info); }
.cal-cell .ev:nth-child(4) { background: var(--ok); }

.cal-bulk {
  display: flex; flex-direction: column;
}
.cal-bulk textarea {
  width: 100%; font-family: inherit; font-size: 12px;
  resize: vertical;
}
.err-line {
  font-size: 11px; color: var(--danger);
  padding: 2px 0;
}

/* === 作業記録 編集モーダル === */
.wl-edit-form { display: flex; flex-direction: column; gap: 8px; }
.wl-edit-form label { font-size: 12px; color: var(--fg-mute); }
.wl-edit-form input, .wl-edit-form select { width: 100%; }

/* === 付箋 画像サポート === */
.sticky-ce {
  min-height: 40px;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 12px;
  color: inherit;
}
.sticky-ce:empty::before {
  content: attr(data-placeholder);
  color: rgba(0,0,0,0.35);
}
[data-theme="dark"] .sticky-ce:empty::before { color: rgba(255,255,255,0.3); }
.sticky-ce img {
  max-width: 100%; border-radius: 4px; margin: 4px 0; display: block;
}

/* === Today グリッド (V28風 行モデル) === */
.wg-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  align-items: stretch;
}
.wg-row {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: stretch;
  min-height: 60px;
  padding: 4px;
  border-radius: 10px;
  transition: background 0.15s, outline 0.1s;
}
.wg-row > .wg {
  flex: 1 1 0;
  min-width: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.wg-row > .wg > .wg-body {
  flex: 1 1 auto;
  overflow: auto;
}
/* 行間ドロップゾーン (新行作成) */
.wg-row-sep {
  height: 8px;
  margin: 2px 0;
  border-radius: 8px;
  transition: background 0.12s, height 0.12s;
}
.wg-row-sep:hover {
  background: color-mix(in srgb, var(--accent, #5b8af0) 8%, transparent);
}
.wg-row.dnd-drop-active,
.wg-row-sep.dnd-drop-active {
  background: color-mix(in srgb, var(--accent, #5b8af0) 12%, transparent);
  outline: 2px dashed color-mix(in srgb, var(--accent, #5b8af0) 55%, transparent);
  outline-offset: -2px;
}
.wg-row-sep.dnd-drop-active { height: 40px; }
.wg-grid-empty {
  padding: 24px;
  text-align: center;
  color: var(--fg-mute);
  font-size: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

/* .wg ヘッダをドラッグハンドルに */
.wg-head { cursor: grab; user-select: none; position: relative; }
.wg-head:active { cursor: grabbing; }

/* 畳みボタン */
.wg-tog {
  font-size: 11px;
  padding: 1px 6px;
  margin-left: auto;
  color: var(--fg-mute);
  background: transparent;
  border: none;
  cursor: pointer;
  line-height: 1;
}
.wg-tog:hover { background: var(--bg-sunk); color: var(--fg); }
.wg-collapsed > .wg-body { display: none; }
.wg-collapsed { min-height: 0; }
.wg-collapsed > .wg-head { border-bottom: none; }

/* === デイリーサマリー === */
.wg--daily-summary .wg-body { padding: 0; }
.ds-body { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; }
.ds-block { display: flex; flex-direction: column; gap: 4px; }
.ds-block-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text-sub, var(--c-text-sub));
  text-transform: uppercase;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border, #e0e0e0);
}
.ds-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.ds-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  line-height: 1.45;
  padding: 2px 0;
  color: var(--text, var(--c-text));
}
.ds-item--done { opacity: .5; text-decoration: line-through; }
.ds-item--over .ds-date { color: var(--danger, #e05); font-weight: 600; }
.ds-empty { color: var(--text-sub, var(--c-text-sub)); font-size: 12px; font-style: italic; }
.ds-time, .ds-date {
  flex-shrink: 0;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-sub, var(--c-text-sub));
  min-width: 36px;
}
.ds-check { flex-shrink: 0; font-size: 12px; }

/* settings subhead row */
.settings-row--subhead { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border, #e0e0e0); }
.settings-row--subhead label { font-weight: 600; font-size: 12px; color: var(--text-sub, var(--c-text-sub)); }

/* === pointer DnD 汎用スタイル === */
.dnd-ghost {
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  border-radius: 10px;
  pointer-events: none;
}
.dnd-placeholder {
  background: color-mix(in srgb, var(--accent, #5b8af0) 10%, transparent);
  border: 2px dashed color-mix(in srgb, var(--accent, #5b8af0) 45%, transparent);
  border-radius: 10px;
}
.dnd-source-hidden { visibility: hidden; }

@media (max-width: 700px) {
  .wg-row { flex-direction: column; }
}

/* === 期間イベントのカレンダーバー (multi-day event bars) === */
/* セルから少しはみ出してバーを連結させたいので overflow を緩める */
.cal-cell { overflow: visible; }
/* 日付ナンバーの高さを today / 非today で揃える (バーの縦位置を一致させる) */
.cal-cell .day {
  display: inline-block;
  height: 22px;
  line-height: 22px;
  min-width: 22px;
  text-align: center;
  margin-bottom: 2px;
  vertical-align: top;
  box-sizing: border-box;
}
.cal-cell.is-today .day {
  /* is-today 用の円形を維持 (size は親側で固定済み) */
  border-radius: 50%;
}
/* バー基本: 角丸なし。空ラベル時もバー高さが潰れないよう min-height を確保。
   スロット間引きの空きはダミーで高さを揃える */
.cal-cell .ev.ev-span,
.cal-cell .ev.ev-span-empty {
  border-radius: 0;
  background: var(--info);
  color: var(--accent-fg);
  min-height: 17px;
  box-sizing: border-box;
  line-height: 1.4;
  position: relative;
  z-index: 1;
}
.cal-cell .ev.ev-span-empty {
  visibility: hidden;
  background: transparent;
}
/* セル padding 6px + grid gap 1px = 7px を負マージンで覆って隣セルへ連結 */
/* 開始日: 左角丸 + 右側をセル右パディング + gap を越えて延長 */
.cal-cell .ev.ev-span-start {
  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;
  margin-right: -7px;
}
/* 中間日: 角丸なし、左右ともセル境界を越えて延長 */
.cal-cell .ev.ev-span-mid {
  margin-left: -7px;
  margin-right: -7px;
}
/* 終了日: 右角丸 + 左側を延長 */
.cal-cell .ev.ev-span-end {
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
  margin-left: -7px;
}
/* start かつ end (1日だが endDate あり扱い) — 万一の保険 */
.cal-cell .ev.ev-span-single {
  border-radius: 3px;
}
/* 週またぎ: 週頭セルは左を延長せず左角丸でキャップ。週末セルは右を延長せず右角丸でキャップ */
.cal-cell .ev.ev-span.is-week-start {
  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;
  margin-left: 0;
}
.cal-cell .ev.ev-span.is-week-end {
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
  margin-right: 0;
}

/* === 日別予定 編集モーダル === */
.day-edit { display: flex; flex-direction: column; gap: 10px; }
.day-edit-list { display: flex; flex-direction: column; gap: 8px; }
.day-edit-empty { color: var(--fg-mute); padding: 8px 0; font-size: 13px; }
.day-edit-row {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  background: var(--bg-elev);
  display: flex; flex-direction: column; gap: 6px;
}
.day-edit-row.is-span { border-left: 3px solid var(--info); }
.der-r1 { display: flex; gap: 6px; align-items: center; }
.der-r1 input[type="text"] { flex: 1; min-width: 120px; }
.der-r2 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.der-r2 label { color: var(--fg-mute); font-size: 11px; }
.der-r2 input[type="text"] { flex: 1; min-width: 100px; }
.day-edit-add {
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 10px;
  background: var(--bg-sunk);
  display: flex; flex-direction: column; gap: 6px;
}
.der-title { font-weight: 600; font-size: 13px; color: var(--fg-mute); margin-bottom: 2px; }
.src-badge {
  font-size: 10px;
  background: var(--info);
  color: var(--accent-fg);
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 2px;
}
button.danger {
  background: var(--danger, #d9534f);
  color: var(--accent-fg, #fff);
  border: none;
}

/* === アクセントカラー スウォッチ === */
.accent-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.accent-swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  padding: 0;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s, border-color 0.12s;
}
.accent-swatch:hover {
  transform: scale(1.1);
  border-color: var(--fg-mute);
}
.accent-swatch.selected {
  border-color: var(--fg);
  box-shadow: 0 0 0 2px var(--bg-elev), 0 0 0 3px var(--fg);
}

/* === デイリーメモウィジェット (iPhone Notes 風) === */
.dmemo-widget .wg-body.dmemo-body {
  display: flex; flex-direction: column; gap: 8px;
}
.dmemo-title-input {
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 6px 4px;
  color: var(--fg);
}
.dmemo-title-input:focus { outline: none; border-bottom-color: var(--accent); }
.dmemo-body-input,
.memo-body-input.ipnotes {
  width: 100%;
  font-size: 14px;
  line-height: 1.7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               "Hiragino Sans", "Yu Gothic UI", sans-serif;
  color: var(--fg);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 180px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.dmemo-body-input:focus,
.memo-body-input.ipnotes:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* デイリーメモのタグバー */
.dmemo-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dmemo-tag {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 2px 4px 2px 8px;
  font-size: 11px;
}
.dmemo-tag-name { cursor: pointer; color: var(--accent); font-weight: 600; }
.dmemo-tag-name:hover { text-decoration: underline; }
.dmemo-tag-del {
  background: transparent; border: none; color: var(--fg-dim);
  cursor: pointer; font-size: 12px; padding: 0 4px;
}
.dmemo-tag-del:hover { color: var(--danger); }
.dmemo-tag-add {
  background: transparent; border: 1px dashed var(--border);
  border-radius: 9999px; padding: 2px 8px;
  font-size: 11px; color: var(--fg-mute); cursor: pointer;
}
.dmemo-tag-add:hover { border-color: var(--accent); color: var(--accent); }

/* === メモビュー (iPhone Notes 風 2 行リスト + タグバー) === */
.memo-pane {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 2fr;
  gap: 10px;
  margin-top: 8px;
}
.memo-pane-list {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  max-height: 75vh; overflow: auto;
}
.memo-pane-edit {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 75vh;
}

/* タグバー */
.memo-tagbar {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding-bottom: 8px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.memo-tagbar-chip {
  background: var(--bg-sunk); border: 1px solid var(--border);
  border-radius: 9999px; padding: 2px 8px;
  font-size: 11px; color: var(--fg-mute); cursor: pointer;
}
.memo-tagbar-chip:hover { border-color: var(--accent); color: var(--fg); }
.memo-tagbar-chip.active {
  background: var(--accent); color: var(--accent-fg); border-color: var(--accent);
}

/* 2 行リスト (iPhone Notes 風) */
.memo-list { list-style: none; padding: 0; margin: 0; }
.memo-list-empty { padding: 16px; color: var(--fg-mute); font-size: 12px; text-align: center; }
.memo-list-item {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
}
.memo-list-item:hover { background: var(--bg-sunk); }
.memo-list-item.selected {
  background: var(--bg-sunk);
  border-left: 3px solid var(--accent);
  padding-left: 5px;
}
.memo-list-item.is-daily { background: rgba(232, 215, 127, 0.06); }
.memo-list-title {
  font-size: 13px; font-weight: 700; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.memo-list-preview {
  font-size: 12px; color: var(--fg-mute);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.memo-list-meta { display: flex; gap: 6px; font-size: 10px; color: var(--fg-dim); flex-wrap: wrap; }
.memo-list-date { color: var(--fg-mute); }
.memo-list-tag {
  background: var(--bg-sunk); border-radius: 9999px;
  padding: 0 6px; color: var(--accent);
}

/* エディタ */
.memo-edit-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; min-height: 200px;
}
.memo-edit-empty-msg { color: var(--fg-mute); padding: 20px; text-align: center; }
.memo-edit-badge {
  display: inline-block;
  background: var(--bg-sunk);
  color: var(--fg-mute);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-bottom: 6px;
}
.memo-editor { display: flex; flex-direction: column; gap: 8px; }
.memo-title-input {
  width: 100%;
  font-size: 18px; font-weight: 700;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 6px 4px;
  color: var(--fg);
}
.memo-title-input:focus { outline: none; border-bottom-color: var(--accent); }
.memo-edit-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 24px; }
.memo-edit-tag {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 2px 4px 2px 8px;
  font-size: 11px;
}
.memo-edit-tag-name { cursor: pointer; color: var(--accent); font-weight: 600; }
.memo-edit-tag-name:hover { text-decoration: underline; }
.memo-edit-tag-del {
  background: transparent; border: none; color: var(--fg-dim);
  cursor: pointer; font-size: 12px; padding: 0 4px;
}
.memo-edit-tag-del:hover { color: var(--danger); }
.memo-edit-tag-add {
  background: transparent; border: 1px dashed var(--border);
  border-radius: 9999px; padding: 2px 8px;
  font-size: 11px; color: var(--fg-mute); cursor: pointer;
}
.memo-edit-tag-add:hover { border-color: var(--accent); color: var(--accent); }
.memo-edit-ctrl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* === タグストリーム モーダル (room research 風 縦連続表示) === */
.tag-stream {
  display: flex; flex-direction: column; gap: 12px;
  max-height: 75vh; overflow-y: auto;
  padding: 4px;
}
.tag-stream-empty {
  padding: 20px; color: var(--fg-mute); text-align: center;
}
.tag-stream-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 12px;
}
.tag-stream-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--fg-mute); margin-bottom: 6px;
}
.tag-stream-date { font-weight: 600; }
.tag-stream-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.tag-stream-body {
  font-size: 13px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  color: var(--fg);
}

@media (max-width: 700px) {
  .memo-pane { grid-template-columns: 1fr; }
  .memo-pane-list { max-height: 40vh; }
}

/* === Workspace レイアウト (Today = メモ大 + 右サイド) === */
.ws-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: flex-start;
}
.ws-main { min-width: 0; }
.ws-side { display: flex; flex-direction: column; gap: 12px; }
.ws-side .ws-side-widget { width: 100%; }

/* メインのデイリーメモ (workspace) */
.dmemo-workspace .wg-body.dmemo-body {
  display: flex; flex-direction: column; gap: 10px;
}
.dmemo-workspace .dmemo-body-input {
  min-height: 60vh;
  font-size: 15px;
  line-height: 1.75;
}
.dmemo-workspace .dmemo-preview {
  min-height: 60vh;
  padding: 8px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* タグパネル (サイド) */
.ws-tag-panel .ws-tag-list {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.ws-tag-chip {
  background: var(--bg-sunk); color: var(--accent);
  border: 1px solid var(--border); border-radius: 9999px;
  padding: 2px 8px; font-size: 11px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.ws-tag-chip:hover { border-color: var(--accent); }
.ws-tag-count {
  background: var(--accent); color: var(--accent-fg);
  font-size: 10px; padding: 0 5px; border-radius: 9999px;
}

/* モバイル: 縦並びに */
@media (max-width: 900px) {
  .ws-layout { grid-template-columns: 1fr; }
}

/* === Markdown レンダリング === */
.memo-body-md { font-size: 14px; line-height: 1.7; }
.memo-body-md h1 { font-size: 22px; margin: 12px 0 8px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.memo-body-md h2 { font-size: 18px; margin: 10px 0 6px; }
.memo-body-md h3 { font-size: 16px; margin: 8px 0 4px; }
.memo-body-md h4,
.memo-body-md h5,
.memo-body-md h6 { font-size: 14px; margin: 6px 0 4px; color: var(--fg-mute); }
.memo-body-md p { margin: 6px 0; }
.memo-body-md ul { margin: 6px 0; padding-left: 24px; }
.memo-body-md li { margin: 2px 0; }
.memo-body-md code {
  background: var(--bg-sunk); padding: 1px 4px; border-radius: 3px;
  font-family: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 12px;
}
.memo-body-md a { color: var(--info); text-decoration: underline; }
.memo-body-md .md-task {
  display: flex; align-items: center; gap: 6px; padding: 2px 0;
}
.memo-body-md .md-task-done { color: var(--fg-mute); text-decoration: line-through; }
.memo-body-md .wikilink {
  color: var(--accent);
  text-decoration: none;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  cursor: pointer;
}
.memo-body-md .wikilink:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}

/* バックリンク表示 */
.memo-backlinks {
  margin-top: 16px; padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.memo-backlinks-head {
  font-size: 11px; color: var(--fg-mute);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.memo-backlinks-empty { font-size: 12px; color: var(--fg-dim); }
.memo-backlink-item {
  font-size: 13px; padding: 4px 8px;
  border-radius: 4px; cursor: pointer;
  margin-bottom: 2px;
}
.memo-backlink-item:hover { background: var(--bg-sunk); }

/* === コマンドパレット (Obsidian / VSCode 風) === */
.cmdp { display: flex; flex-direction: column; gap: 8px; min-width: 480px; max-width: 720px; }
.cmdp-input {
  width: 100%; font-size: 15px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elev); color: var(--fg);
}
.cmdp-input:focus { outline: none; border-color: var(--accent); }
.cmdp-list {
  max-height: 50vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1px;
}
.cmdp-empty { padding: 16px; color: var(--fg-mute); text-align: center; }
.cmdp-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.cmdp-row:hover { background: var(--bg-sunk); }
.cmdp-row.selected { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--fg); }
.cmdp-label { flex: 1; }
.cmdp-hint {
  font-size: 10px; color: var(--fg-dim);
  background: var(--bg-sunk); padding: 1px 6px; border-radius: 9999px;
}

/* モード切替ボタン (active 強調) */
.dmemo-workspace .wg-head .ghost.active {
  background: var(--accent); color: var(--accent-fg); border-color: var(--accent);
}

/* === Daily Stream (Roam 風: 今日の下に過去のデイリーが連続) === */
.dstream {
  margin-top: 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.dstream-sep {
  text-align: center;
  color: var(--fg-mute);
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 12px 0;
  border-top: 1px dashed var(--border);
}
.dstream-sep span { background: var(--bg); padding: 0 12px; }
.dstream-list {
  display: flex; flex-direction: column; gap: 12px;
}
.dstream-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: opacity 0.2s;
}
.dstream-card.is-empty { opacity: 0.65; }
.dstream-card.is-empty:focus-within { opacity: 1; }
.dstream-date {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.dstream-jump {
  font-size: 10px;
  padding: 2px 8px;
}
.dstream-title-input {
  width: 100%;
  font-size: 15px; font-weight: 600;
  border: none;
  background: transparent;
  color: var(--fg);
  padding: 2px 0;
}
.dstream-title-input:focus { outline: none; border-bottom: 1px solid var(--accent); }
.dstream-body-input {
  width: 100%;
  font-size: 13.5px; line-height: 1.65;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               "Hiragino Sans", "Yu Gothic UI", sans-serif;
  color: var(--fg);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 6px 8px;
  resize: vertical;
  min-height: 90px;
  transition: border-color 0.12s, background 0.12s;
}
.dstream-body-input:hover { border-color: var(--border); }
.dstream-body-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-elev);
}
.dstream-card .dmemo-tags { margin-top: 2px; }
.dstream-sentinel {
  height: 1px;
  margin-top: 8px;
}
.dstream-more {
  align-self: center;
  margin: 8px 0;
}
.dstream-limit {
  text-align: center;
  color: var(--fg-dim);
  font-size: 12px;
  padding: 16px;
  border-top: 1px dashed var(--border);
}

/* === Workspace モード切替タブ === */
.ws-mode-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  background: var(--bg-sunk);
  border-radius: 9999px;
  width: fit-content;
}
.ws-mode-tab {
  background: transparent;
  border: none;
  padding: 4px 14px;
  font-size: 12px;
  color: var(--fg-mute);
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.ws-mode-tab:hover { color: var(--fg); }
.ws-mode-tab.active {
  background: var(--bg-elev);
  color: var(--fg);
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* モードクラスでメイン/サイドの表示を切替 */
.ws-layout.ws-mode-memo   { grid-template-columns: 1fr; }
.ws-layout.ws-mode-memo   > .ws-side { display: none; }

.ws-layout.ws-mode-widget { grid-template-columns: 1fr; }
.ws-layout.ws-mode-widget > .ws-main { display: none; }
.ws-layout.ws-mode-widget > .ws-side {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}

/* split は既定の grid-template-columns (1fr 320px) を使う — 何もしない */

/* === サイドウィジェット DnD === */
.ws-side-list { display: flex; flex-direction: column; gap: 12px; }
.ws-side-widget {
  cursor: grab;
  transition: opacity 0.12s;
}
.ws-side-widget:active { cursor: grabbing; }
.ws-side-widget.dragging {
  opacity: 0.35;
}
/* ドロップ位置のインジケータ (上端 / 下端に色付きライン) */
.ws-side-widget.drop-target { position: relative; }
.ws-side-widget.drop-target.drop-above::before,
.ws-side-widget.drop-target.drop-below::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
}
.ws-side-widget.drop-target.drop-above::before { top: -8px; }
.ws-side-widget.drop-target.drop-below::after { bottom: -8px; }
/* wg-head に "つかみマーク" を出して D&D 可能を明示 */
.ws-side-widget .wg-head::before {
  content: '⋮⋮';
  color: var(--fg-dim);
  font-size: 11px;
  margin-right: 6px;
  cursor: grab;
  letter-spacing: -2px;
  opacity: 0.6;
}

/* === Live Preview (textarea + 整形プレビュー 2カラム) === */
.dmemo-live {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 60vh;
  align-items: stretch;
}
.dmemo-live > .dmemo-body-input {
  min-height: 60vh;
  margin: 0;
}
.dmemo-live > .dmemo-preview {
  min-height: 60vh;
  margin: 0;
  padding: 10px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-y: auto;
}
/* Live モードのプレビューは空でもエリアを保つ */
.dmemo-live > .dmemo-preview:empty::after {
  content: '右側に整形プレビューが表示されます';
  color: var(--fg-dim);
  font-size: 12px;
}

/* モード別の見た目調整 */
.dmemo-mode-live .dmemo-body-input {
  font-family: ui-monospace, "SF Mono", "Menlo", "Consolas", "Hiragino Sans", monospace;
}

/* mode ボタン群 (active 強調) */
.dmemo-mode-btns { display: inline-flex; gap: 2px; }
.dmemo-widget .wg-head .ghost.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

/* 狭い画面では live を縦並びに */
@media (max-width: 1100px) {
  .dmemo-live { grid-template-columns: 1fr; }
  .dmemo-live > .dmemo-body-input,
  .dmemo-live > .dmemo-preview { min-height: 280px; }
}

/* === Live モード: textarea ↔ rendered を同位置で切替 (分割なし) === */
/* 旧分割CSSを上書きするため、後勝ちで全画面1カラムに戻す */
.dmemo-live {
  display: block;
  grid-template-columns: none;
}
.dmemo-live-area {
  position: relative;
  display: block;
  width: 100%;
  min-height: 50vh;
}
.dmemo-live-area > .dmemo-body-input,
.dmemo-live-area > .dmemo-rendered {
  width: 100%;
  box-sizing: border-box;
}
.dmemo-live-area > .dmemo-body-input {
  min-height: 50vh;
  margin: 0;
}
/* 整形ビュー: 編集領域と同じ枠で見やすく */
.dmemo-live-area > .dmemo-rendered {
  min-height: 50vh;
  background: var(--bg-elev);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: text;
  transition: border-color 0.12s, background 0.12s;
}
.dmemo-live-area > .dmemo-rendered:hover {
  border-color: var(--border);
}
.dmemo-live-area.is-editing > .dmemo-rendered { display: none !important; }
.dmemo-rendered-empty {
  color: var(--fg-dim);
  font-size: 13px;
  font-style: italic;
}
/* Daily Stream カード内では高さを抑える */
.dstream-card .dmemo-live-area { min-height: 0; }
.dstream-card .dmemo-live-area > .dmemo-body-input { min-height: 100px; }
.dstream-card .dmemo-live-area > .dmemo-rendered {
  min-height: 60px;
  padding: 6px 10px;
  background: transparent;
}
.dstream-card .dmemo-live-area > .dmemo-rendered:hover {
  background: var(--bg-sunk);
}

/* === ライン単位 Live エディタ === */
.dmemo-line-area {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 50vh;
  padding: 8px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.dmemo-line-area.is-edit-only { padding: 0; background: transparent; border: none; }
.dmemo-line-area.is-edit-only > textarea {
  width: 100%; font-size: 14px; line-height: 1.7;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-elev); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               "Hiragino Sans", "Yu Gothic UI", sans-serif;
  min-height: 50vh;
}
.dmemo-line-area .line-rendered,
.dmemo-line-area .line-edit {
  width: 100%;
  font-size: 14px;
  line-height: 1.7;
  border-radius: 4px;
  padding: 2px 8px;
  box-sizing: border-box;
}
.dmemo-line-area .line-rendered {
  cursor: text;
  min-height: 1.7em;
  transition: background 0.1s;
}
.dmemo-line-area .line-rendered:hover {
  background: var(--bg-sunk);
}
.dmemo-line-area .line-rendered.is-empty {
  height: 1.7em;
  position: relative;
}
.dmemo-line-area .line-rendered.is-empty::after {
  content: '';
  display: block;
}
/* Markdown レンダリング: 段落マージンを抑え、1行が1ブロックっぽく見える */
.dmemo-line-area .line-rendered > .memo-body-md > * { margin: 0; }
.dmemo-line-area .line-rendered > .memo-body-md h1 { font-size: 22px; font-weight: 700; }
.dmemo-line-area .line-rendered > .memo-body-md h2 { font-size: 18px; font-weight: 700; }
.dmemo-line-area .line-rendered > .memo-body-md h3 { font-size: 16px; font-weight: 700; }
.dmemo-line-area .line-rendered > .memo-body-md ul { padding-left: 22px; }
.dmemo-line-area .line-rendered > .memo-body-md ul > li { margin: 0; }

/* 編集中の行 textarea: 違和感のないシームレスな見た目 */
.dmemo-line-area .line-edit {
  font-family: ui-monospace, "SF Mono", "Menlo", "Consolas", "Hiragino Sans", monospace;
  background: var(--bg-sunk);
  color: var(--fg);
  border: 1px solid var(--accent);
  outline: none;
  resize: none;
  overflow: hidden;
  caret-color: var(--accent);
}

/* dstream カード内ではコンパクトに */
.dstream-card .dmemo-line-area {
  min-height: 0;
  padding: 6px 8px;
  background: transparent;
  border: 1px dashed var(--border);
}
.dstream-card .dmemo-line-area .line-rendered,
.dstream-card .dmemo-line-area .line-edit {
  font-size: 13px;
  line-height: 1.6;
}

/* ============================================================
   〆切カード v38: 大きな色分け「あとN日」バッジ
   ============================================================ */
.dl-card.dl-card--crit { border-left: 4px solid #e5534b; }
.dl-card.dl-card--warn { border-left: 4px solid #e08a2b; }
.dl-card.dl-card--soon { border-left: 4px solid #c9a227; }
.dl-card.dl-card--ok   { border-left: 4px solid #2f9e84; }
.dl-card.dl-card--over { border-left: 4px solid #c0392b; }

.dl-head--rich { gap: 10px; align-items: stretch; }
.dl-head--rich .dl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.dl-head--rich .dl-row1 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dl-head--rich .dl-row1 .dl-title { font-weight: 600; font-size: 14px; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
.dl-head--rich .dl-row2 { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg-mute); }
.dl-head--rich .dl-sep { opacity: 0.5; }
.dl-proj-pill { font-size: 11px; padding: 1px 8px; border-radius: 9999px; white-space: nowrap; }
.dl-head--rich .dl-progress { font-size: 11px; color: var(--fg-mute); }
.dl-rem-txt { font-weight: 600; }
.dl-rem-txt--crit, .dl-rem-txt--over { color: #d0463d; }
.dl-rem-txt--warn { color: #c8711c; }
.dl-rem-txt--soon { color: #a07d10; }
.dl-rem-txt--ok   { color: #2f9e84; }
.dl-side { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.dl-del { align-self: flex-start; }

/* 大きな日数バッジ */
.dl-badge {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 54px; padding: 6px 8px; border-radius: 12px; line-height: 1.05;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.dl-badge-top { font-size: 10px; opacity: 0.85; }
.dl-badge-num { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.dl-badge-bot { font-size: 10px; opacity: 0.85; }
.dl-badge--crit { background: #fbe2df; color: #c0392b; }
.dl-badge--warn { background: #fdecd6; color: #b96414; }
.dl-badge--soon { background: #fbf0c9; color: #8a6d06; }
.dl-badge--ok   { background: #dcf1ea; color: #1f7d68; }
.dl-badge--over { background: #f6cfcf; color: #a01020; }

[data-theme="dark"] .dl-badge--crit, [data-theme="true-black"] .dl-badge--crit { background: #5a2420; color: #ffb3ab; }
[data-theme="dark"] .dl-badge--warn, [data-theme="true-black"] .dl-badge--warn { background: #543518; color: #f3c389; }
[data-theme="dark"] .dl-badge--soon, [data-theme="true-black"] .dl-badge--soon { background: #4a3f12; color: #e6d27a; }
[data-theme="dark"] .dl-badge--ok,   [data-theme="true-black"] .dl-badge--ok   { background: #18443a; color: #8fe0cb; }
[data-theme="dark"] .dl-badge--over, [data-theme="true-black"] .dl-badge--over { background: #5a1a1a; color: #ffb0b0; }

/* コンパクト版 (Today リマインダー) の色分け */
.dl-list .dl-rem--crit { background: color-mix(in srgb, #e5534b 30%, transparent); color: #b32b22; font-weight: 600; }
.dl-list .dl-rem--warn { background: color-mix(in srgb, #e08a2b 28%, transparent); color: #a6610f; font-weight: 600; }
.dl-list .dl-rem--soon { background: color-mix(in srgb, #c9a227 28%, transparent); color: #836a08; font-weight: 600; }
.dl-list .dl-rem--ok   { background: color-mix(in srgb, #2f9e84 24%, transparent); color: #1f7d68; }
[data-theme="dark"] .dl-list .dl-rem--crit, [data-theme="true-black"] .dl-list .dl-rem--crit { color: #ffb3ab; }
[data-theme="dark"] .dl-list .dl-rem--warn, [data-theme="true-black"] .dl-list .dl-rem--warn { color: #f3c389; }
[data-theme="dark"] .dl-list .dl-rem--soon, [data-theme="true-black"] .dl-list .dl-rem--soon { color: #e6d27a; }
[data-theme="dark"] .dl-list .dl-rem--ok,   [data-theme="true-black"] .dl-list .dl-rem--ok   { color: #8fe0cb; }

/* ============================================================
   統計ダッシュボード v38: 比較サマリー + パネル表示切替
   ============================================================ */
.stats-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stats-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stats-tile { background: var(--bg-sunk); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.stats-tile-label { font-size: 11px; color: var(--fg-mute); }
.stats-tile-main { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.stats-tile-sub { font-size: 12px; color: var(--fg-mute); }
.stats-delta { font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.stats-delta--up { color: #1f9e6f; }
.stats-delta--down { color: #d0463d; }
.stats-delta--flat { color: var(--fg-mute); }
[data-theme="dark"] .stats-delta--up, [data-theme="true-black"] .stats-delta--up { color: #6fdcb0; }
[data-theme="dark"] .stats-delta--down, [data-theme="true-black"] .stats-delta--down { color: #ff9b91; }
.stats-panel-toggle { font-size: 11px; padding: 2px 8px; border-radius: 9999px; background: var(--bg-sunk); border: 1px solid var(--border); color: var(--fg-mute); cursor: pointer; }
.stats-panel-toggle:hover { border-color: var(--accent); color: var(--fg); }
.stats-hidden-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 0; }
.stats-hidden-bar .label { font-size: 11px; color: var(--fg-mute); }
.stats-chip { font-size: 11px; padding: 2px 10px; border-radius: 9999px; background: var(--bg-sunk); border: 1px dashed var(--border); color: var(--fg-mute); cursor: pointer; }
.stats-chip:hover { border-color: var(--accent); color: var(--fg); border-style: solid; }

/* ─── 統計: タグ別時間パネル (v46) ─── */
.stats-tt-list { display: flex; flex-direction: column; gap: 3px; margin: 4px 0 8px; }
.stats-tt-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(60px, 2fr) 62px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.stats-tt-row.is-child { opacity: 0.85; font-size: 11.5px; }
.stats-tt-name {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg);
}
.stats-tt-dot {
  width: 9px; height: 9px; border-radius: 50%;
  flex: 0 0 auto;
  display: inline-block;
}
.stats-tt-tag, .stats-tt-proj {
  font-size: 10px;
  color: var(--fg-mute);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 5px;
  flex: 0 0 auto;
}
.stats-tt-bar {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-sunk);
  overflow: hidden;
}
.stats-tt-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
}
.stats-tt-val {
  text-align: right;
  font-size: 11.5px;
  color: var(--fg-mute);
  font-variant-numeric: tabular-nums;
}
.stats-tt-sub {
  font-size: 11px;
  color: var(--fg-mute);
  letter-spacing: 0.04em;
  margin: 10px 0 2px;
  padding-top: 6px;
  border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.stats-tt-note {
  font-size: 10.5px;
  color: var(--fg-dim);
  line-height: 1.5;
}
.proj-tag-chip {
  font-size: 10.5px;
  color: var(--info);
  background: color-mix(in srgb, var(--info) 12%, transparent);
  border-radius: 8px;
  padding: 0 6px;
  margin-left: 4px;
}
.proj-tag-hint {
  font-size: 11px;
  color: var(--fg-dim);
  margin-top: 6px;
  line-height: 1.5;
}

/* ── v49: カレンダーのひと言日記 (デイリーメモの副題) ── */
.cal-cell .cal-daily-sub {
  font-size: 11px;
  line-height: 1.3;
  margin: 1px 0 2px;
  padding: 1px 4px;
  border-left: 2px solid var(--accent, #6c8ebf);
  color: var(--fg-sub, #666);
  background: var(--bg-sunk, rgba(0, 0, 0, .04));
  border-radius: 2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.cal-cell .cal-daily-sub:hover { color: var(--fg, #222); }
