:root {
  --bg: #faf6ef;
  --bg-2: #f3ecdf;
  --card: #ffffff;
  --card-2: #fdf9f2;
  --line: #eadfce;
  --line-2: #dccdb6;
  --text: #33291f;
  --text-dim: #98876f;
  --sun: #f25c26;
  --sun-2: #e8442e;
  --sun-soft: #ffe9dc;
  --sun-grad: linear-gradient(135deg, #ffa229, #f25c26 55%, #e8442e);
  --gold: #d99a2b;
  --gold-soft: #fdf3e2;
  --green: #4caf7d;
  --red: #d8402f;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(120, 90, 50, 0.08), 0 4px 14px rgba(120, 90, 50, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--page-bg, var(--bg));
  background-attachment: fixed;
  color: var(--on-bg, var(--text));
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  height: 100%;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- top bar ---------- */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 10px;
  position: sticky;
  top: 0;
  background: linear-gradient(var(--bg) 80%, transparent);
  z-index: 10;
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand-kicker {
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--sun);
  font-weight: 700;
}
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: 0.06em; }
.icon-btn {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text-dim);
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* ---------- main ---------- */
#view {
  flex: 1;
  padding: 4px 16px calc(env(safe-area-inset-bottom, 0px) + 88px);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--sun-grad);
  opacity: 0.9;
}
.card h3 {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.card h3 .en { color: var(--sun); margin-right: 6px; }

.card, #modal { color: var(--text); }
.muted { color: var(--text-dim); font-size: 12px; }
.small { font-size: 12px; }

/* ---------- north star bar ---------- */
.northstar {
  padding: 14px 16px;
  background: var(--sun-grad);
  border: none;
  color: #fff;
}
.northstar::before { display: none; }
.northstar .rinen { font-size: 14px; font-weight: 700; line-height: 1.5; }
.northstar .vision { font-size: 12px; opacity: 0.85; margin-top: 4px; line-height: 1.5; }
.goal-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  white-space: nowrap;
}
.chip.tone {
  border-color: var(--line-2);
  color: var(--sun-2);
  background: var(--sun-soft);
}

/* ---------- date header ---------- */
.date-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 4px 12px;
}
.date-head .big { font-size: 26px; font-weight: 800; letter-spacing: 0.02em; }
.date-head .sub { color: var(--on-bg-dim, var(--text-dim)); font-size: 13px; }
.nav-arrows { display: flex; gap: 8px; }
.nav-arrows button {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 8px;
  min-width: 32px; height: 32px;
  cursor: pointer;
  font-size: 14px;
  padding: 0 8px;
}
.nav-arrows button.on { color: var(--sun); border-color: var(--sun); }

/* ---------- habits ---------- */
.habit-group { font-size: 10px; letter-spacing: 0.14em; color: var(--gold); font-weight: 700; margin: 8px 0 2px; }
.habit-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.habit-row:last-child { border-bottom: none; }
.habit-check {
  width: 30px; height: 30px;
  min-width: 30px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  background: none;
  color: transparent;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s;
}
.habit-check.done {
  background: var(--sun-grad);
  border-color: var(--sun);
  color: #fff;
}
.habit-name { flex: 1; font-size: 14px; }
.habit-name .streak { color: var(--sun); font-size: 11px; margin-left: 6px; font-weight: 700; }
.habit-dots { display: flex; gap: 4px; }
.hdot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.hdot.on { background: var(--sun); }

/* ---------- tasks ---------- */
.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.task-row:last-child { border-bottom: none; }
.task-check {
  width: 24px; height: 24px; min-width: 24px;
  border-radius: 7px;
  border: 2px solid var(--line-2);
  background: none;
  color: transparent;
  font-size: 13px;
  cursor: pointer;
}
.task-check.done { background: var(--sun-grad); border-color: var(--sun); color: #fff; }
.task-title { flex: 1; font-size: 14px; line-height: 1.4; }
.task-title.done { color: var(--text-dim); text-decoration: line-through; }
.task-goal { font-size: 10px; color: var(--sun-2); display: block; margin-top: 2px; }
.task-badge {
  font-size: 9px;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}
.task-del {
  background: none; border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
}

/* ---------- add row / inputs ---------- */
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input[type="text"], .add-row input[type="number"] {
  flex: 1;
  min-width: 0;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}
.add-row input::placeholder { color: var(--text-dim); }
.btn {
  background: var(--sun-grad);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--sun) 30%, transparent);
}
.btn.ghost {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-weight: 500;
  box-shadow: none;
}
.btn.small { padding: 6px 12px; font-size: 12px; }
.select-goal, select.ta {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 12px;
  padding: 0 8px;
  max-width: 130px;
}

/* ---------- mood ---------- */
.mood-row { display: flex; gap: 10px; margin-top: 4px; }
.mood-btn {
  flex: 1;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-dim);
  padding: 12px 0;
  font-size: 18px;
  cursor: pointer;
}
.mood-btn.sel { border-color: var(--sun); color: var(--sun-2); background: var(--sun-soft); }
.mood-memo, .ta {
  width: 100%;
  margin-top: 10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.6;
}
.ta { margin-top: 0; font-size: 14px; min-height: 56px; }
label.fl { display: block; font-size: 11px; color: var(--text-dim); margin: 10px 0 4px; letter-spacing: 0.08em; }

/* ---------- schedule (time axis) ---------- */
.sched-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.sched-row:last-child { border-bottom: none; }
.sched-hour {
  width: 34px;
  min-width: 34px;
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.sched-row input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  padding: 7px 6px;
  outline: none;
}
.sched-row.prime { background: var(--sun-soft); border-radius: 6px; }
.sched-row.prime .sched-hour { color: var(--sun-2); font-weight: 700; }
.prime-note { font-size: 11px; color: var(--sun-2); margin-bottom: 6px; }

/* ---------- weekly vertical grid ---------- */
.vgrid { overflow-x: auto; }
.vgrid table { border-collapse: collapse; width: 100%; min-width: 480px; }
.vgrid th {
  font-size: 10px;
  color: var(--text-dim);
  padding: 3px 2px;
  border-bottom: 1px solid var(--line-2);
}
.vgrid th.today-col { color: var(--sun); }
.vgrid td {
  border: 1px solid var(--line);
  font-size: 10px;
  padding: 2px 3px;
  height: 24px;
  min-width: 58px;
  max-width: 70px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  color: var(--text);
}
.vgrid td.hour-label {
  border: none;
  color: var(--text-dim);
  text-align: right;
  padding-right: 6px;
  min-width: 30px;
  cursor: default;
  font-variant-numeric: tabular-nums;
}
.vgrid td.prime { background: var(--sun-soft); }
.vgrid td.filled { background: var(--gold-soft); color: var(--text); font-weight: 500; }

/* ---------- pyramid ---------- */
.pyr-level { border-left: 3px solid var(--sun); padding-left: 12px; }
.goal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.goal-item:last-child { border-bottom: none; }
.goal-item .g-title { flex: 1; line-height: 1.4; }
.goal-item .g-parent { display: block; font-size: 10px; color: var(--text-dim); margin-top: 1px; }
.goal-item .g-due { font-size: 11px; color: var(--gold); white-space: nowrap; }

/* ---------- life domains ---------- */
.domain-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.domain-row .dname {
  width: 62px; min-width: 62px;
  font-size: 12px;
  font-weight: 700;
  color: var(--sun-2);
}
.domain-row input {
  flex: 1;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
}

/* ---------- long range table ---------- */
.lr-table { width: 100%; border-collapse: collapse; }
.lr-table th {
  font-size: 10px;
  color: var(--text-dim);
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid var(--line-2);
}
.lr-table td { padding: 3px 3px; border-bottom: 1px solid var(--line); }
.lr-table td.yr { font-size: 12px; font-weight: 700; color: var(--sun-2); white-space: nowrap; }
.lr-table input {
  width: 100%;
  background: none;
  border: none;
  font-size: 13px;
  color: var(--text);
  padding: 5px 4px;
  outline: none;
}

/* ---------- partners ---------- */
.partner-card {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.partner-card .p-name { font-weight: 700; font-size: 14px; }
.partner-card .p-rel { color: var(--text-dim); font-size: 11px; margin-left: 6px; }
.partner-card .p-line { font-size: 12px; margin-top: 4px; line-height: 1.5; }
.partner-card .p-line b { color: var(--sun-2); font-weight: 700; font-size: 11px; }

/* ---------- month calendar ---------- */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { font-size: 10px; color: var(--text-dim); padding: 4px 0; }
.cal td {
  border: 1px solid var(--line);
  vertical-align: top;
  height: 44px;
  padding: 3px 4px;
  font-size: 11px;
  cursor: pointer;
}
.cal td.other { background: var(--bg-2); color: var(--text-dim); }
.cal td.today-cell { background: var(--sun-soft); }
.cal td .dnum { font-size: 11px; font-weight: 600; }
.cal td.today-cell .dnum { color: var(--sun-2); }
.cal .cal-dots { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 2px; }
.cal .cdot { width: 5px; height: 5px; border-radius: 50%; background: var(--sun); }
.cal .cdot.done { background: var(--green); }

/* ---------- year view ---------- */
.year-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ym-card {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  min-height: 64px;
}
.ym-card.now { border-color: var(--sun); background: var(--sun-soft); }
.ym-card .ym-name { font-size: 12px; font-weight: 700; color: var(--sun-2); }
.ym-card .ym-goal { font-size: 10px; color: var(--text); margin-top: 3px; line-height: 1.4; }

/* ---------- grid (habit month/week) ---------- */
.hgrid { overflow-x: auto; }
.hgrid table { border-collapse: collapse; font-size: 10px; }
.hgrid th, .hgrid td { padding: 2px; text-align: center; color: var(--text-dim); min-width: 14px; }
.hgrid td .cell { width: 12px; height: 12px; border-radius: 3px; background: var(--bg-2); border: 1px solid var(--line); margin: 0 auto; }
.hgrid td .cell.on { background: var(--sun); border-color: var(--sun); }
.hgrid td .cell.today-mark { outline: 2px solid var(--gold); }
.hgrid th.hname { text-align: left; padding-right: 8px; color: var(--text); font-weight: 500; white-space: nowrap; }

/* ---------- progress / stats ---------- */
.pbar { height: 6px; background: var(--bg-2); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.pbar > div { height: 100%; background: var(--sun-grad); border-radius: 3px; }
.stat-row { display: flex; gap: 10px; }
.stat { flex: 1; background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.stat .num { font-size: 22px; font-weight: 800; color: var(--sun-2); }
.stat .lab { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

/* ---------- details / collapsible ---------- */
details.sc { margin-top: 2px; }
details.sc summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--sun-2);
  font-weight: 700;
  list-style: none;
}
details.sc summary::before { content: "▸ "; }
details.sc[open] summary::before { content: "▾ "; }

/* ---------- tab bar ---------- */
#tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  background: var(--tabbar-bg, rgba(255, 253, 249, 0.92));
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 20;
}
.tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--on-bg-dim, var(--text-dim));
  font-size: 10px;
  padding: 8px 0 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tab .tab-icon { font-size: 17px; }
.tab.active { color: var(--sun-2); font-weight: 700; }

/* ---------- modal ---------- */
#modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(60, 40, 20, 0.45);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
#modal {
  background: var(--card);
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--line);
  width: 100%;
  max-width: 560px;
  padding: 20px 18px calc(env(safe-area-inset-bottom, 0px) + 20px);
  max-height: 85dvh;
  overflow-y: auto;
}
#modal h2 { font-size: 16px; margin-bottom: 14px; }
#modal h4 { font-size: 13px; color: var(--sun-2); margin: 14px 0 4px; }
#modal p { font-size: 13px; line-height: 1.7; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.empty { color: var(--text-dim); font-size: 13px; padding: 8px 0; }

/* ================= 追加：共通フォーム ================= */
.ta.oneline {
  min-height: 0;
  height: 42px;
  resize: none;
}
input.ta::placeholder, textarea.ta::placeholder { color: var(--text-dim); }

/* 番号つき1行入力（理由5つ／やりたいこと100／100年史／計画の目標1-6） */
.num-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.num-row .num-label {
  width: 22px;
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--sun-2);
  text-align: right;
}
.num-row input {
  flex: 1;
  min-width: 0;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 10px;
  font-size: 13px;
}
.num-row input::placeholder { color: var(--text-dim); }
.num-row .age-in { flex: none; width: 62px; text-align: center; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two-col > div { min-width: 0; }
@media (max-width: 380px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ================= 設計タブ：ステップ見出し・ページ切替 ================= */
.stephead {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--sun-2);
  background: var(--sun-soft);
  border-radius: 999px;
  padding: 8px 14px;
  margin-bottom: 12px;
  text-align: center;
}
/* 横スクロールだと画面外のステップに気づけないため、折り返して全部見せる */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 8px;
  margin-bottom: 4px;
}
.pill {
  flex: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 12px;
  padding: 7px 13px;
  cursor: pointer;
  white-space: nowrap;
}
.pill.on {
  background: var(--sun-grad);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--sun) 30%, transparent);
}

/* ================= ○△× マーク ================= */
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.legend .lg { font-size: 10px; color: var(--text-dim); }
.legend .lg.m-yes { color: var(--green); }
.legend .lg.m-mid { color: var(--gold); }
.legend .lg.m-no { color: var(--red); }

.tri-btn {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.tri-btn.m-yes { background: var(--green); border-color: var(--green); color: #fff; }
.tri-btn.m-mid { background: var(--gold); border-color: var(--gold); color: #fff; }
.tri-btn.m-no { background: var(--red); border-color: var(--red); color: #fff; }

.markcell {
  display: block;
  width: 16px;
  height: 16px;
  line-height: 15px;
  margin: 0 auto;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-dim);
  font-size: 10px;
  text-align: center;
}
.markcell.tap { cursor: pointer; }
.markcell.m-yes { background: var(--green); border-color: var(--green); color: #fff; }
.markcell.m-mid { background: var(--gold); border-color: var(--gold); color: #fff; }
.markcell.m-no { background: var(--red); border-color: var(--red); color: #fff; }
.markcell.today-mark { outline: 2px solid var(--gold); }

.hdot.mid { background: var(--gold); }
.hdot.no { background: var(--red); }

/* ================= 今日：TO DO 表 ================= */
.todo-head, .todo-row {
  display: grid;
  grid-template-columns: 32px 44px 1fr 48px 26px;
  gap: 6px;
  align-items: center;
}
.todo-head {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.todo-row { padding: 7px 0; border-bottom: 1px solid var(--line); }
.todo-row:last-of-type { border-bottom: none; }
.todo-row .task-title { min-width: 0; }
.mini-in {
  width: 100%;
  min-width: 0;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  padding: 6px 4px;
  font-size: 11px;
  text-align: center;
}
.mini-in::placeholder { color: var(--line-2); }

/* ================= 今日：行動予定／結果のダブル時間軸 ================= */
.dual-head {
  display: grid;
  grid-template-columns: 46px 1fr 1fr;
  gap: 6px;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.dual-head.mk { grid-template-columns: 22px 1fr 1fr; gap: 8px; }
.sched-row.dual {
  display: grid;
  grid-template-columns: 46px 1fr 1fr;
  gap: 6px;
}
.sched-row.dual input { flex: none; min-width: 0; }
.sched-row.dual input.res { background: var(--bg-2); }

/* ================= 今日：健康管理・お金 ================= */
.meal-grid { overflow-x: auto; }
.meal-grid table { border-collapse: collapse; width: 100%; }
.meal-grid th {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  padding: 4px;
}
.meal-grid th.grp { text-align: left; color: var(--text); white-space: nowrap; }
.meal-grid td { padding: 3px; text-align: center; }
.meal-btn {
  width: 34px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--line-2);
  font-size: 13px;
  cursor: pointer;
}
.meal-btn.on { background: var(--green); border-color: var(--green); color: #fff; }

.money-head, .money-row {
  display: grid;
  grid-template-columns: 1fr 96px 26px;
  gap: 6px;
  align-items: center;
}
.money-head {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.money-row { padding: 5px 0; }
.money-row input {
  width: 100%;
  min-width: 0;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
}
.money-row input[type="number"] { text-align: right; }
.money-total {
  text-align: right;
  font-size: 12px;
  color: var(--text-dim);
  margin: 8px 0 10px;
}
.money-total b { font-size: 16px; color: var(--sun-2); margin: 0 2px; }

/* ================= 月：行動計画ブロック・プリセット習慣 ================= */
.plan-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px 12px;
  margin-bottom: 10px;
  background: var(--card-2);
}
.plan-no {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--sun-2);
}
.preset-list { margin: 6px 0 10px; }
.preset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.preset-row:last-child { border-bottom: none; }
.hgrid th.hname.total { color: var(--text-dim); font-weight: 700; }

/* ================= 設計 Step1：キーワード ================= */
.kw-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.kw {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 12px;
  padding: 6px 11px;
  cursor: pointer;
}
.kw.on {
  background: var(--sun-soft);
  border-color: var(--sun);
  color: var(--sun-2);
  font-weight: 700;
}
.rinen3-row {
  border-left: 2px solid var(--sun-soft);
  padding-left: 10px;
  margin-bottom: 10px;
}
.rinen3-row .word { margin-bottom: 6px; font-weight: 700; }

/* ================= 設計 Step2：欲求スケール・チェックリスト ================= */
.needs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.needs-row:last-of-type { border-bottom: none; }
.needs-name { font-size: 13px; }
.needs-btns { display: flex; gap: 4px; flex: none; }
.scale-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
}
.scale-btn.sel { background: var(--sun-grad); border-color: transparent; color: #fff; font-weight: 700; }

.check-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ck {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 12px;
  padding: 6px 11px;
  cursor: pointer;
  text-align: left;
}
.ck.on { background: var(--sun-soft); border-color: var(--sun); color: var(--sun-2); font-weight: 700; }
.ck .cat {
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: var(--line-2);
  border-radius: 4px;
  padding: 1px 4px;
}
.ck.on .cat { background: var(--sun); }

.work-tally {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.tally-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  padding: 3px 0;
}
.tally-row b { color: var(--sun-2); }
.tally-n {
  margin-left: auto;
  font-weight: 700;
  color: var(--text);
  font-size: 13px;
}

/* ================= 設計 Step3：マンダラ・構造化 ================= */
.mandala-wrap {
  padding-bottom: 2px;
  scroll-snap-type: x proximity;
}
.mandala {
  display: grid;
  grid-template-columns: repeat(9, 84px);
  width: max-content;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  overflow: hidden;
  background: var(--line);
}
.mcell {
  width: 84px;
  height: 56px;
  background: var(--card-2);
  border: none;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 11px;
  padding: 5px 6px;
  line-height: 1.35;
}
/* 3×3ブロックの切れ目をはっきりさせる（9列なので 3n が各ブロックの右端） */
.mandala .mcell:nth-child(3n) { border-right: 2px solid var(--line-2); }
.mandala .mcell:nth-child(9n) { border-right: none; }
.mandala .mcell:nth-child(n+19):nth-child(-n+27),
.mandala .mcell:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid var(--line-2); }
.mandala .mcell:nth-child(n+73) { border-bottom: none; }
/* ブロックの先頭列でスクロールを止める */
.mandala .mcell:nth-child(9n+1) { scroll-snap-align: start; }

.mcell.shade { background: var(--bg-2); }
.mcell::placeholder { color: var(--line-2); }
.mcell.bcenter {
  background: var(--gold-soft);
  color: var(--gold);
  font-weight: 700;
}
.mcell.center {
  background: var(--sun-soft);
  color: var(--sun-2);
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--sun);
}
.mcell:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--sun);
  background: #fff;
  position: relative;
  z-index: 1;
}

.struct-table { min-width: 560px; }
.struct-table th {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
  padding: 4px;
  border-bottom: 1px solid var(--line);
}
.struct-table th.hname {
  text-align: left;
  color: var(--text);
  white-space: nowrap;
  padding-right: 8px;
}
.struct-table td { padding: 3px; border-bottom: 1px solid var(--line); }
.struct-table input {
  width: 100%;
  min-width: 130px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  padding: 7px 8px;
  font-size: 12px;
}

/* ================= 設計 Step4：計画表・マトリクス ================= */
.plan-table { min-width: 720px; }
.plan-table th {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
  white-space: nowrap;
  padding: 4px;
  border-bottom: 1px solid var(--line);
}
.plan-table th.colw { min-width: 30px; }
.plan-table td { padding: 3px; border-bottom: 1px solid var(--line); }
.plan-table td.markcol { text-align: center; }
.plan-table input {
  width: 100%;
  min-width: 120px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  padding: 7px 8px;
  font-size: 12px;
}

.matrix { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mx-cell {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
}
.mx-cell .mx-label { font-size: 10px; color: var(--sun-2); font-weight: 700; margin-bottom: 4px; }
.mx-cell .ta { background: var(--card); font-size: 12px; min-height: 44px; }
@media (max-width: 380px) {
  .matrix { grid-template-columns: 1fr; }
}

/* ================= 記録タブ ================= */
.search-in { margin-bottom: 10px; }
.note-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px 10px;
  margin-bottom: 8px;
  background: var(--card-2);
}
.note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.note-row .ta { background: var(--card); }

.hist-item {
  border-left: 2px solid var(--line-2);
  padding: 2px 0 10px 10px;
  margin-bottom: 8px;
}
.hist-head { display: flex; align-items: center; gap: 8px; }
.hist-kind {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--sun-2);
  background: var(--sun-soft);
  border-radius: 999px;
  padding: 2px 8px;
}
.hist-date { font-size: 11px; color: var(--text-dim); }
.hist-text {
  font-size: 13px;
  line-height: 1.6;
  margin-top: 4px;
  white-space: pre-wrap;
}

/* ================= モーダル補助 ================= */
.btn.ghost.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, var(--line)); }

/* ================= タイトル画面 ================= */
.title-screen {
  min-height: 82dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}
.title-mark {
  font-size: 30px;
  color: var(--sun);
  margin-bottom: 18px;
}
.title-kicker {
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--sun-2);
  font-weight: 700;
}
.title-name {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-top: 6px;
}
.title-rule {
  width: 40px;
  height: 2px;
  background: var(--sun-grad);
  border-radius: 2px;
  margin: 20px 0 22px;
}
.title-lead { font-size: 14px; line-height: 1.9; }
.title-note {
  font-size: 12px;
  line-height: 1.9;
  color: var(--on-bg-dim, var(--text-dim));
  margin-top: 14px;
}
.title-btn { margin-top: 30px; padding: 14px 30px; font-size: 15px; }
.linkish {
  background: none;
  border: none;
  color: var(--on-bg-dim, var(--text-dim));
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  margin-top: 16px;
  font-family: inherit;
}

/* ================= セットアップ ================= */
.setup-head { margin-bottom: 14px; }
.setup-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--on-bg-dim, var(--text-dim));
  margin-bottom: 8px;
}
.setup-meta span:first-child { color: var(--sun-2); font-weight: 700; letter-spacing: 0.1em; }
.setup-nav {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.setup-nav .btn { flex: 1; padding: 14px 0; }
.setup-nav .btn:disabled { opacity: 0.4; }
.setup-skip { text-align: center; padding-bottom: 10px; }

/* ================= 編集モード ================= */
.edit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--sun-soft);
  border: 1px solid var(--sun);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.edit-title { font-size: 14px; font-weight: 800; color: var(--sun-2); }
.edit-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.edit-actions {
  display: flex;
  gap: 10px;
  margin: 18px 0 10px;
}
.edit-actions .btn { flex: 1; padding: 14px 0; }

/* ================= 設計図（閲覧専用） ================= */
.bp-star .rinen.dim { opacity: 0.6; font-weight: 500; }
.bp-notice { font-size: 12px; line-height: 1.7; color: var(--text-dim); }
.bp-notice b { color: var(--sun-2); }

.bp-sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--sun-2);
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.bp-row {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.bp-row:last-child { border-bottom: none; }
.bp-label {
  flex: none;
  width: 96px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.7;
}
.bp-value { flex: 1; font-size: 13px; line-height: 1.7; white-space: pre-wrap; }
.bp-list { margin: 4px 0 4px 18px; }
.bp-list li { font-size: 13px; line-height: 1.8; }
.bp-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0; }
.bp-quote {
  border-left: 3px solid var(--sun);
  background: var(--sun-soft);
  border-radius: 0 10px 10px 0;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.9;
  white-space: pre-wrap;
  margin-bottom: 6px;
}

.bp-check { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bp-ck {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-2);
  border-radius: 999px;
  padding: 5px 10px;
}
.bp-ck.on { background: #e6f4ec; color: #2f7a55; font-weight: 700; }

.bp-bar-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.bp-bar-name { flex: none; width: 76px; font-size: 12px; }
.bp-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
}
.bp-bar > span { display: block; height: 100%; background: var(--sun-grad); }
.bp-bar-n { flex: none; font-size: 12px; font-weight: 700; color: var(--sun-2); }

.bp-partner {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.bp-partner-name { font-size: 14px; font-weight: 700; margin-bottom: 4px; }

.bp-ver {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.bp-ver:last-of-type { border-bottom: none; }
.bp-ver-date { flex: 1; font-size: 13px; }

.bp-editnote {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

/* 読み取り専用のマンダラ／構造化表 */
.mandala .mcell.ro {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  word-break: break-all;
}
.struct-table.ro td {
  font-size: 12px;
  line-height: 1.6;
  min-width: 120px;
  vertical-align: top;
  padding: 6px 4px;
}

/* ================= 横スクロール領域の共通仕上げ ================= */
.vgrid, .hgrid, .meal-grid, .mandala-wrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
/* 細く丸い、配色に合わせたスクロールバー（見えることが「横に続く」合図になる） */
.vgrid::-webkit-scrollbar,
.hgrid::-webkit-scrollbar,
.meal-grid::-webkit-scrollbar,
.mandala-wrap::-webkit-scrollbar { height: 6px; }
.vgrid::-webkit-scrollbar-track,
.hgrid::-webkit-scrollbar-track,
.meal-grid::-webkit-scrollbar-track,
.mandala-wrap::-webkit-scrollbar-track {
  background: var(--bg-2);
  border-radius: 3px;
}
.vgrid::-webkit-scrollbar-thumb,
.hgrid::-webkit-scrollbar-thumb,
.meal-grid::-webkit-scrollbar-thumb,
.mandala-wrap::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 3px;
}
.vgrid::-webkit-scrollbar-thumb:active,
.hgrid::-webkit-scrollbar-thumb:active,
.meal-grid::-webkit-scrollbar-thumb:active,
.mandala-wrap::-webkit-scrollbar-thumb:active { background: var(--sun); }

/* 先頭列を固定して、横に送っても「どの行か」を見失わない */
.hgrid th.hname,
.meal-grid th.grp,
.struct-table th.hname,
.vgrid td.hour-label,
.plan-table .colfix {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--card);
  box-shadow: 6px 0 6px -6px rgba(120, 90, 50, 0.22);
}
.vgrid td.hour-label { z-index: 3; }
.plan-table th.colfix { z-index: 4; }
.struct-table th.hname { z-index: 3; }

/* 表そのものの縁取りを揃える */
.vgrid table, .hgrid table, .meal-grid table {
  border-radius: 10px;
}
.hgrid table { border-spacing: 0; }

/* 週の縦型タイムグリッド：ヘッダも固定して曜日を見失わない */
.vgrid th {
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}
.vgrid th.hname, .vgrid th:first-child { z-index: 4; left: 0; }
.plan-table .colfix { min-width: 140px; }
.plan-table th.colfix { text-align: left; padding-left: 4px; }

/* ================= セグメント切り替え ================= */
.seg {
  display: flex;
  gap: 4px;
  background: var(--bg-2);
  border-radius: 10px;
  padding: 3px;
  margin: 10px 0;
}
.seg-btn {
  flex: 1;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 0;
  cursor: pointer;
  font-family: inherit;
}
.seg-btn.on {
  background: var(--card);
  color: var(--sun-2);
  box-shadow: 0 1px 3px rgba(120, 90, 50, 0.12);
}
.scroll-hint {
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--line-2);
  margin-bottom: 4px;
}

/* ================= マンダラ：ブロックごと表示 ================= */
.mblocks { display: grid; gap: 10px; }
.mblock {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--line);
}
.mblock.core { border-color: var(--sun); }
.mblock-head {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-2);
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.mblock.core .mblock-head { background: var(--sun-soft); color: var(--sun-2); }
.mblock-n {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--line-2);
  color: #fff;
  font-size: 10px;
  line-height: 20px;
  text-align: center;
}
.mblock.core .mblock-n {
  width: auto;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--sun);
}
.mblock-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
}
.mblock-grid .mcell {
  width: auto;
  height: 64px;
  border: none;
  font-size: 12px;
}
/* グリッドの1frが input の既定幅に押し広げられないようにする */
.mblock-grid .mcell { min-width: 0; }
.vgrid td.hour-label.prime { background: var(--sun-soft); color: var(--sun-2); font-weight: 700; }

/* ================= タイムライン（開始・終了を持つ予定） ================= */
.tl-hint { margin: 2px 0 10px; line-height: 1.7; }
.tl {
  position: relative;
  padding-left: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-2);
  margin-bottom: 10px;
}
.tl-hour {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--line);
}
.tl-hour.prime { background: var(--sun-soft); }
.tl-hour:first-child { border-top: none; }
.tl-hour-label {
  position: absolute;
  left: 6px;
  top: 2px;
  font-size: 10px;
  color: var(--text-dim);
}
.tl-hour.prime .tl-hour-label { color: var(--sun-2); font-weight: 700; }

.tl-track {
  position: absolute;
  left: 46px;
  right: 0;
  top: 0;
  bottom: 0;
  touch-action: pan-y;
}
.tl-block {
  position: absolute;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--sun);
  border-radius: 8px;
  padding: 4px 4px 4px 7px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(120, 90, 50, 0.12);
  cursor: grab;
  touch-action: pan-y;   /* 指でなぞったら必ず縦スクロールできるようにする */
  user-select: none;
}
.tl-block:active { cursor: grabbing; }
.tl-block.m-yes { border-left-color: var(--green); background: #f3faf6; }
.tl-block.m-mid { border-left-color: var(--gold); background: var(--gold-soft); }
.tl-block.m-no { border-left-color: var(--red); background: #fdf1ef; opacity: 0.75; }
.tl-b-body { flex: 1; min-width: 0; }
.tl-b-time { font-size: 9px; color: var(--text-dim); letter-spacing: 0.02em; }
.tl-b-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-b-res {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.tl-b-res.m-yes { background: var(--green); border-color: var(--green); color: #fff; }
.tl-b-res.m-mid { background: var(--gold); border-color: var(--gold); color: #fff; }
.tl-b-res.m-no { background: var(--red); border-color: var(--red); color: #fff; }
.tl-b-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 12px;
  cursor: ns-resize;
  touch-action: none;
}
.tl-b-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 22px;
  height: 3px;
  margin-left: -11px;
  border-radius: 2px;
  background: var(--line-2);
}
.tl-now {
  position: absolute;
  left: 40px;
  right: 0;
  height: 2px;
  background: var(--sun-2);
  z-index: 3;
  pointer-events: none;
}
.tl-now::before {
  content: "";
  position: absolute;
  left: 0;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sun-2);
}

/* ================= 日記 ================= */
.ta.diary { min-height: 180px; line-height: 1.9; }
.diary-foot { text-align: right; font-size: 11px; color: var(--text-dim); margin-top: 6px; }
/* 30分以下の短い予定は1行にまとめる */
.tl-block.compact { align-items: center; padding-top: 2px; padding-bottom: 2px; }
.tl-block.compact .tl-b-body { display: flex; align-items: baseline; gap: 6px; }
.tl-block.compact .tl-b-time { flex: none; }
.tl-block.compact .tl-b-title { white-space: nowrap; font-size: 11px; }
.tl-block.compact .tl-b-handle { height: 8px; }
.tl-block.compact .tl-b-handle::after { bottom: 2px; }
/* 狭い画面でも2列を保つ（開始・終了など短い項目用） */
.two-col.tight { grid-template-columns: 1fr 1fr; }
select.ta.wide { max-width: none; width: 100%; font-size: 14px; color: var(--text); }

/* ================= 配色ピッカー ================= */
.preset-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.sw {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 8px;
  cursor: pointer;
  font-family: inherit;
}
.sw.on { border-color: var(--sun); background: var(--sun-soft); }
.sw-c {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.sw-n {
  font-size: 11px;
  color: var(--text);
  margin-left: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sw.on .sw-n { color: var(--sun-2); font-weight: 700; }

.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 8px;
}
.color-row input[type="color"] {
  width: 40px;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
}
.color-row span { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.color-row .btn.small.on { border-color: var(--sun); color: var(--sun-2); }
.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  cursor: pointer;
}
.checkline input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--sun); }

/* プリセットの見本は、その配色の背景色そのものを地にする */
.sw.dark { border-color: rgba(255, 255, 255, 0.22); }
.sw.dark .sw-n { color: rgba(255, 255, 255, 0.92); }
.sw.dark.on { border-color: var(--sun); }
.sw.dark.on .sw-n { color: #fff; }
.sw.on { box-shadow: inset 0 0 0 1px var(--sun); }

/* ================= Todoist連携 ================= */
.sync-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.sync-state { flex: 1; font-size: 11px; color: var(--text-dim); line-height: 1.5; }
.sync-state.err { color: var(--red); }
.task-badge.td { color: var(--sun-2); border-color: var(--sun-2); }
#td-test-r { color: var(--text-dim); }

/* 予定を移動するための取っ手（指ではここからだけドラッグできる） */
.tl-b-grip {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 10px;
  cursor: grab;
  touch-action: none;
}
.tl-b-grip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  width: 22px;
  height: 3px;
  margin-left: -11px;
  border-radius: 2px;
  background: var(--line-2);
}
.tl-block.compact .tl-b-grip { height: 7px; }
.tl-block.compact .tl-b-grip::after { top: 2px; }
.tl-b-body { padding-top: 6px; }
.tl-block.compact .tl-b-body { padding-top: 3px; }
