/* NEKO TASKS — 見た目 */

:root {
  --bg: #F5F2EC;
  --sub: #E6E2DA;
  --card: #FFFFFF;
  --ink: #333333;
  --ink2: #6B6B6B;
  --muted: #888888;
  --accent: #91AC99;
  --accent-dark: #71927C;
  --accent-ink: #5F7D67;
  --accent-soft: #E3EAE3;
  --line: #EAE6DE;
  --danger: #C16D5D;
  --danger-text: #A9503F;
  --hi-bg: #F4DEDA; --hi-fg: #A3443A;
  --mid-bg: #F3EAD2; --mid-fg: #85641F;
  --lo-bg: #ECE9E3; --lo-fg: #666;
  --shadow: 0 1px 2px rgba(52, 52, 52, .04), 0 4px 16px rgba(52, 52, 52, .05);
  --radius: 20px;
  --radius-btn: 16px;
  --gutter: 20px;
  --tabbar-h: 64px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1D1E1B;
  --sub: #2B2C28;
  --card: #262723;
  --ink: #ECEAE4;
  --ink2: #B6B3AC;
  --muted: #8F8C86;
  --accent: #91AC99;
  --accent-dark: #A9C2B0;
  --accent-ink: #AFC7B5;
  --accent-soft: #2F3A32;
  --line: #34352F;
  --danger: #E59A8C;
  --danger-text: #E59A8C;
  --hi-bg: #4A2C28; --hi-fg: #F2B8AF;
  --mid-bg: #443A22; --mid-fg: #E6CC88;
  --lo-bg: #34352F; --lo-fg: #C2BFB7;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
svg { display: block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }

.view { padding: 0 var(--gutter) calc(var(--tabbar-h) + 96px + env(safe-area-inset-bottom)); outline: none; }

/* ---------- 見出し ---------- */
.head { display: flex; align-items: center; gap: 8px; padding: calc(18px + env(safe-area-inset-top)) 0 14px; }
.head h1 { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: .02em; flex: 1; }
.icon-btn {
  width: 44px; height: 44px; border: 0; background: none; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink);
}
.icon-btn svg, .tabbar svg, .row-ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { background: var(--sub); }

/* ---------- 切りかえ（月／週 など） ---------- */
.seg { display: inline-flex; background: var(--sub); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: none; padding: 6px 16px; border-radius: 999px; font-size: .875rem;
  color: var(--ink2); min-height: 34px;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { color: #1D1E1B; }

/* ---------- カード ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px; }
.card-title { margin: 0 0 10px; font-size: 1rem; font-weight: 700; }

/* ---------- 猫エリア（ホーム） ---------- */
.cat-stage {
  position: relative; margin: 0 -16px 14px; padding: 6px 16px 0;
  display: flex; align-items: flex-end; justify-content: space-between; min-height: 150px;
  background: linear-gradient(to bottom, transparent 78%, var(--sub) 78%);
}
.bubble {
  align-self: flex-start; margin-top: 10px; background: var(--card); border-radius: 14px;
  padding: 12px 16px; font-size: .9375rem; line-height: 1.6; box-shadow: var(--shadow);
  max-width: 58%; position: relative;
}
.bubble::after {
  content: ""; position: absolute; right: -7px; top: 22px; border: 7px solid transparent;
  border-left-color: var(--card); border-right: 0;
}
.cat-img { width: 150px; height: auto; display: block; }
.cat-stage .cat-img { margin-bottom: -2px; }
/* ナイトのとき、黒猫が背景にまぎれないよう、ふちをうっすら明るくする */
:root[data-theme="dark"] .cat-img, :root[data-theme="dark"] .empty img, :root[data-theme="dark"] .profile img {
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, .45)) drop-shadow(0 0 8px rgba(255, 255, 255, .08));
}
.cat-stage .cat-img.pop { animation: pop .5s ease; }
@keyframes pop { 40% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .cat-stage .cat-img.pop { animation: none; } }

/* ---------- 進捗 ---------- */
.progress { display: flex; align-items: center; gap: 12px; }
.progress-main { flex: 1; min-width: 0; }
.progress-label { font-size: .875rem; color: var(--ink2); margin: 0; }
.progress-num { margin: 2px 0 10px; font-size: .9375rem; }
.progress-num b { font-size: 1.75rem; font-weight: 700; margin-right: 2px; }
.bar { height: 10px; background: var(--sub); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease; }
.ring { width: 76px; height: 76px; position: relative; flex: none; }
.ring svg { width: 76px; height: 76px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .track { stroke: var(--sub); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 1.0625rem; }

/* ---------- タスク行 ---------- */
.task-list { list-style: none; margin: 0; padding: 0; }
.task {
  display: flex; align-items: center; gap: 10px; min-height: 52px;
  border-top: 1px solid var(--line);
}
.task:first-child { border-top: 0; }
.check {
  flex: none; width: 44px; height: 44px; margin-left: -10px; border: 0; background: none;
  display: grid; place-items: center;
}
.check i {
  width: 24px; height: 24px; border: 1.5px solid var(--ink2); border-radius: 50%;
  display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.check svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.check[aria-checked="true"] i { background: var(--accent); border-color: var(--accent); }
.check[aria-checked="true"] svg { opacity: 1; }
.task-body {
  flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 8px 0;
  display: flex; align-items: center; gap: 8px; min-height: 44px;
}
.task-text { flex: 1; min-width: 0; }
.task-title { display: block; overflow-wrap: anywhere; }
.task-due { display: block; font-size: .75rem; color: var(--ink2); margin-top: 1px; }
.task-due.late { color: var(--danger-text); font-weight: 700; }
.task.done .task-title { color: var(--muted); text-decoration: line-through; }
.task.done .task-due { color: var(--muted); }
.tags { display: flex; gap: 6px; flex: none; align-items: center; }
.tag {
  font-size: .75rem; padding: 2px 9px; border-radius: 999px; background: var(--sub); color: var(--ink2);
  white-space: nowrap; display: inline-flex; align-items: center; gap: 5px;
}
.tag .dot { width: 7px; height: 7px; border-radius: 50%; }
.tag.p-high { background: var(--hi-bg); color: var(--hi-fg); font-weight: 700; }
.tag.p-medium { background: var(--mid-bg); color: var(--mid-fg); }
.tag.p-low { background: var(--lo-bg); color: var(--lo-fg); }
.task.done .tag { opacity: .6; }

.empty { text-align: center; padding: 18px 8px 8px; color: var(--ink2); }
.empty img { width: 110px; margin: 0 auto 8px; display: block; }
.empty p { margin: 0 0 4px; }
.empty small { color: var(--muted); }

.add-line {
  width: 100%; border: 1px dashed var(--muted); background: none; border-radius: 12px;
  min-height: 48px; color: var(--ink2); display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 10px;
}

/* ---------- 追加ボタン ---------- */
.fab {
  position: fixed; z-index: 20; width: 58px; height: 58px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(80, 110, 88, .35);
  display: grid; place-items: center;
  right: max(18px, calc(50% - 240px + 18px));
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
}
.fab svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.fab:active { transform: scale(.96); }

/* ---------- 下のメニュー ---------- */
.tabbar {
  position: fixed; z-index: 30; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; min-height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--muted); font-size: .6875rem;
}
.tabbar a[aria-current="page"] { color: var(--accent-ink); font-weight: 700; }
.tabbar a[aria-current="page"] svg { stroke-width: 2; }

/* ---------- カレンダー ---------- */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-nav h2 { margin: 0; font-size: 1.0625rem; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-wd { font-size: .75rem; color: var(--ink2); padding: 6px 0; }
.cal-wd.sun { color: #B5574C; } .cal-wd.sat { color: #4F7AA6; }
:root[data-theme="dark"] .cal-wd.sun { color: #E59A90; }
:root[data-theme="dark"] .cal-wd.sat { color: #93B6DA; }
.cal-day {
  border: 0; background: none; height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 4px; gap: 3px;
}
.cal-day .n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: .9375rem; }
.cal-day.today .n { box-shadow: inset 0 0 0 1.5px var(--accent); font-weight: 700; }
.cal-day[aria-pressed="true"] .n { background: var(--accent); color: #fff; font-weight: 700; box-shadow: none; }
:root[data-theme="dark"] .cal-day[aria-pressed="true"] .n { color: #1D1E1B; }
.cal-day .mark { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cal-day .mark.late { background: var(--danger); border-radius: 1px; transform: rotate(45deg); }
.cal-day .mark.none { background: transparent; }
.cal-legend { display: flex; gap: 14px; justify-content: flex-end; font-size: .75rem; color: var(--ink2); margin-top: 6px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.cal-legend i.late { background: var(--danger); border-radius: 1px; transform: rotate(45deg); }
.day-title { font-size: 1rem; font-weight: 700; margin: 6px 0 8px; }

/* ---------- タスク一覧 ---------- */
.search {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 0 12px; min-height: 46px; margin-bottom: 10px;
}
.search svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; flex: none; }
.search input { flex: 1; border: 0; background: none; outline: none; min-height: 44px; min-width: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 8px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card); color: var(--ink2);
  border-radius: 999px; padding: 6px 14px; font-size: .8125rem; min-height: 36px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-label { font-size: .75rem; color: var(--muted); align-self: center; flex: none; }
.list-meta { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 8px; font-size: .8125rem; color: var(--ink2); }
.list-meta select {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 8px; min-height: 36px; font-size: .8125rem;
}

/* ---------- 記録 ---------- */
.hero { display: flex; align-items: center; justify-content: space-between; overflow: hidden; padding: 16px 8px 0 18px; background: var(--sub); }
.hero .cat-img { width: 150px; margin-right: -10px; }
.hero-label { font-size: .875rem; color: var(--ink2); margin: 0; }
.hero-num { margin: 0 0 4px; font-size: .9375rem; }
.hero-num b { font-size: 2.25rem; font-weight: 700; margin-right: 2px; }
.hero-sub { font-size: .8125rem; color: var(--ink2); margin: 0 0 14px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; min-width: 0; }
.tile p { margin: 0; font-size: .75rem; color: var(--ink2); }
.tile b { display: block; font-size: 1.5rem; font-weight: 700; margin-top: 4px; }
.tile b small { font-size: .8125rem; font-weight: 400; margin-left: 2px; }
.tile .na { font-size: 1rem; color: var(--muted); }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--ink2); font-size: 11px; }
.chart .bar-mark { fill: var(--accent); }
.chart .bar-mark.today { fill: var(--accent-ink); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar-mark, .chart .hit:focus + .bar-mark { opacity: .8; }
.tip {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: .75rem;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -6px;
}
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 120px; height: 120px; flex: none; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: .875rem; padding: 4px 0; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .nm { flex: 1; }
.legend .ct { font-variant-numeric: tabular-nums; }
.legend .pc { color: var(--muted); font-size: .75rem; width: 3em; text-align: right; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .875rem; }
.history li:first-child { border-top: 0; }
.history .d { width: 6.5em; flex: none; color: var(--ink2); }
.history .b { flex: 1; height: 8px; background: var(--sub); border-radius: 999px; overflow: hidden; }
.history .b i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.history .c { width: 3.5em; text-align: right; flex: none; }
.note { font-size: .75rem; color: var(--muted); margin: 8px 0 0; }

/* ---------- マイページ ---------- */
.profile { display: flex; align-items: center; gap: 14px; }
.profile img { width: 76px; }
.profile h2 { margin: 0; font-size: 1.375rem; letter-spacing: .06em; }
.profile p { margin: 2px 0 0; font-size: .8125rem; color: var(--ink2); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; border-top: 1px solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row > span { font-size: .9375rem; }
.set-row small { display: block; color: var(--muted); font-size: .75rem; }
.link-row {
  width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; border: 0; background: none; text-align: left;
  border-top: 1px solid var(--line); text-decoration: none; padding: 0; font-size: .9375rem;
}
.link-row:first-of-type { border-top: 0; }
.link-row .row-ico { color: var(--ink2); }
.link-row .grow { flex: 1; }
.link-row .chev { color: var(--muted); }
.link-row.danger { color: var(--danger-text); }
.link-row.danger .row-ico { color: var(--danger-text); }
.sns-box { text-align: center; margin: 26px 0 8px; line-height: 1.4; }
.sns-cat { display: inline-block; }
.sns-cat img { display: block; height: auto; }
.sns-link { font-size: .85rem; color: var(--ink); text-decoration: none; }
.sns-link:hover { text-decoration: underline; }
.sns-link.tip-link { display: inline-block; margin-top: 10px; padding: 8px 16px; border: 1.5px solid currentColor; border-radius: 4px; }
.app-info { text-align: center; color: var(--muted); font-size: .75rem; margin: 18px 0 0; }

/* ---------- 追加・詳細・編集（下から出るシート） ---------- */
.editor {
  position: fixed; left: 0; right: 0; top: 0; height: 100%; z-index: 50;
  background: rgba(30, 30, 28, .38); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.bsheet {
  width: 100%; max-width: 480px; max-height: calc(100% - 24px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 6px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  animation: up .24s cubic-bezier(.2, .8, .3, 1);
}
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .editor, .bsheet { animation: none; } }
@media (min-width: 600px) { .editor { align-items: center; } .bsheet { border-radius: 24px; max-height: calc(100% - 64px); } }
.bs-head { position: relative; display: flex; align-items: center; min-height: 52px; padding-top: 8px; }
.bs-head h2 { margin: 0; flex: 1; font-size: 1.125rem; font-weight: 700; }
.bs-head .icon-btn { margin-left: auto; margin-right: -10px; }
.bs-grip { position: absolute; left: 50%; top: 2px; width: 40px; height: 4px; margin-left: -20px; border-radius: 999px; background: var(--pad-edge); }

.field { margin-bottom: 16px; }
.f-label { display: block; font-weight: 700; font-size: .8125rem; color: var(--ink2); margin-bottom: 8px; }
.input, .textarea {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 16px; min-height: 52px;
  font-size: 1rem;
}
.input-title { min-height: 56px; font-size: 1.0625rem; }
.textarea { min-height: 88px; resize: vertical; }
.input:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.input.err { border-color: var(--danger-text); }
.err-msg { color: var(--danger-text); font-size: .8125rem; font-weight: 700; margin: 6px 0 0; }
.f-row { margin-bottom: 16px; }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; min-height: 40px;
  font-size: .875rem; display: inline-flex; align-items: center; gap: 6px; color: var(--ink);
}
.pick[aria-pressed="true"], .pick.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.pick .dot { width: 8px; height: 8px; border-radius: 50%; }
.pick-input { padding: 0 6px 0 12px; }
.pick-input input { border: 0; background: none; font: inherit; color: inherit; min-height: 38px; padding: 0; max-width: 150px; }
.pick-input input:focus { outline: none; }
.pick-input:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.link-btn { border: 0; background: none; color: var(--accent-ink); font-weight: 700; font-size: .9375rem; min-height: 44px; padding: 0; }

.bs-actions { display: flex; gap: 10px; margin-top: 8px; position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); background: var(--bg); padding: 10px 0 4px; }
.btn { flex: 1; min-height: 52px; border-radius: var(--radius-btn); font-weight: 700; font-size: 1rem; }
.btn-del-text { color: var(--danger-text); flex: 0 0 34%; }

/* 詳細 */
.dt-top { display: flex; align-items: flex-start; gap: 6px; margin: 2px 0 14px; }
.dt-top .check { margin-top: -6px; }
.dt-title { margin: 0; flex: 1; font-size: 1.25rem; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.dt-top.done .dt-title { color: var(--muted); text-decoration: line-through; }
.dt-list { margin: 0 0 8px; background: var(--card); border-radius: var(--radius); padding: 4px 16px; }
.dt-list > div { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: baseline; }
.dt-list > div:first-child { border-top: 0; }
.dt-list dt { flex: 0 0 84px; color: var(--ink2); font-size: .8125rem; }
.dt-list dd { margin: 0; flex: 1; min-width: 0; font-size: .9375rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dt-list dd.late { color: var(--danger-text); font-weight: 700; }
.dt-list .dot { width: 8px; height: 8px; border-radius: 50%; }
.dt-memo dd { white-space: pre-wrap; overflow-wrap: anywhere; display: block; }
.dt-sub dd { color: var(--ink2); font-size: .8125rem; }

/* ---------- 確認ダイアログ・お知らせ ---------- */
.dialog-back { position: fixed; inset: 0; z-index: 80; background: rgba(30, 30, 28, .45); display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--card); border-radius: 16px; padding: 22px 20px 16px; width: 100%; max-width: 340px; }
.dialog h2 { margin: 0 0 6px; font-size: 1.0625rem; }
.dialog p { margin: 0 0 18px; color: var(--ink2); font-size: .9375rem; white-space: pre-line; }
.dialog-btns { display: flex; gap: 10px; }
.dialog-btns button { flex: 1; min-height: 48px; border-radius: var(--radius-btn); font-weight: 700; }
.btn-ghost { border: 1px solid var(--line); background: var(--bg); }
.btn-danger { border: 0; background: var(--danger); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #1D1E1B; }
.btn-main { border: 0; background: var(--accent-dark); color: #fff; }
:root[data-theme="dark"] .btn-main { color: #1D1E1B; }
.btn-main:active, .btn-ghost:active { transform: scale(.98); }
.toast {
  position: fixed; z-index: 90; left: 50%; transform: translate(-50%, 20px);
  bottom: calc(var(--tabbar-h) + 90px + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--bg); border-radius: 999px; padding: 10px 18px; font-size: .875rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); color: #fff; }
.banner { background: var(--hi-bg); color: var(--hi-fg); border-radius: 12px; padding: 10px 14px; font-size: .8125rem; margin-bottom: 12px; }

/* ---------- ホーム：日めくり＋いまの線 ---------- */
body.on-home { background: var(--sub); }
body.on-home .view { padding-bottom: 0; }
.pad-wrap { position: relative; padding: calc(58px + env(safe-area-inset-top)) 0 0; }
.pad-wrap.no-cat { padding-top: calc(24px + env(safe-area-inset-top)); }
.pad {
  position: relative; background: var(--card); border-radius: var(--radius); padding: 14px 16px 14px 14px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 3px 0 -1px var(--bg), 0 4px 0 -1px var(--pad-edge), 0 7px 0 -2px var(--bg), 0 8px 0 -2px var(--pad-edge), 0 12px 22px rgba(52, 52, 52, .08);
}
:root { --pad-edge: #D9D4CA; --font-num: "Outfit", -apple-system, "Segoe UI", sans-serif; }
:root[data-theme="dark"] { --pad-edge: #3C3D37; }
.pad-cat { position: absolute; right: 10px; top: -60px; width: 72px; }
.pad-date { flex: none; width: 76px; border-radius: 10px; overflow: hidden; background: var(--bg); text-align: center; }
.pad-band { display: block; background: var(--ink); color: var(--bg); font-family: var(--font-num); font-weight: 500; font-size: .6875rem; letter-spacing: .25em; padding: 3px 0 3px .25em; }
.pad-day { display: block; font-family: var(--font-num); font-weight: 200; font-size: 2.75rem; line-height: 1.15; padding-bottom: 2px; }
.pad-info { flex: 1; min-width: 0; }
.pad-wd { margin: 0; font-size: 1rem; font-weight: 700; letter-spacing: .1em; }
.pad-wd span { font-family: var(--font-num); font-weight: 500; font-size: .75rem; color: var(--muted); letter-spacing: .1em; margin-left: 8px; }
.pad-msg { margin: 2px 0 8px; font-size: .875rem; color: var(--accent-ink); font-weight: 700; }
.pad-prog { display: flex; align-items: center; gap: 10px; }
.pad-prog .bar { flex: 1; height: 6px; }
.pad-num { font-size: .75rem; color: var(--ink2); flex: none; }
.pad-num b { font-family: var(--font-num); font-size: 1rem; font-weight: 500; color: var(--ink); }
.pad-cat.pop { animation: pop .5s ease; }
@media (prefers-reduced-motion: reduce) { .pad-cat.pop { animation: none; } }

.sheet {
  margin: 26px calc(-1 * var(--gutter)) 0; background: var(--bg); border-radius: 26px 26px 0 0;
  padding: 20px var(--gutter) calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
  min-height: calc(100vh - 190px); min-height: calc(100dvh - 190px);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet-head h2 { margin: 0; font-size: 1.125rem; font-weight: 700; }
.pill-add {
  border: 0; background: var(--ink); color: var(--bg); border-radius: 999px; min-height: 40px; padding: 0 16px;
  display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 700;
}
.pill-add svg { width: 15px !important; height: 15px !important; stroke-width: 2.6 !important; }
.pill-add:active { transform: scale(.97); }
.sheet-sub { margin: 14px 0 0; padding-top: 10px; border-top: 1px dashed var(--pad-edge); font-size: .75rem; font-weight: 700; color: var(--ink2); }
.sheet-sub.late { color: var(--danger-text); border-top: 0; padding-top: 0; margin-top: 6px; }
.sheet .empty { padding-top: 26px; }

/* タイムライン */
.tl { list-style: none; margin: 4px 0 0; padding: 0; }
.tl > li { position: relative; display: grid; grid-template-columns: 44px 36px minmax(0, 1fr); align-items: center; min-height: 52px; border: 0; gap: 0; }
.tl > li::before { content: ""; position: absolute; left: 61px; top: 0; bottom: 0; width: 2px; background: var(--sub); }
.tl > li.past::before, .tl > li.tl-now::before { background: var(--accent); }
.tl > li.tl-now::before { bottom: 50%; }
.tl > li:first-child::before { top: 50%; }
.tl > li:last-child::before { bottom: 50%; }
.tl > li:only-child::before { display: none; }
.tl-time { font-family: var(--font-num); font-size: .75rem; color: var(--ink); }
.tl-time.late { color: var(--danger-text); font-weight: 700; }
.tl-row.done .tl-time, .tl-row.past:not(.done) .tl-time:not(.late) { color: var(--muted); }
.check.tl-node { width: 36px; height: 44px; margin: 0; position: relative; z-index: 1; }
.check.tl-node i { width: 22px; height: 22px; border-radius: 50%; border-color: var(--ink); background: var(--bg); }
.check.tl-node[aria-checked="true"] i { background: var(--accent); border-color: var(--accent); }
.check.tl-node svg { width: 13px; height: 13px; stroke-width: 3; }
.tl-body { padding: 6px 4px 6px 6px; }
.tl-row.next .tl-body { background: var(--card); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); margin: 4px 0; }
.tl-row.next .task-title { font-weight: 700; }
.tl-row .tags .tag:not(.p-high) { background: none; padding: 0; }
.tl-now { min-height: 44px !important; }
.tl-now .tl-time { color: var(--accent-ink); font-weight: 500; }
.tl-now .tl-node { display: grid; place-items: center; position: relative; z-index: 1; }
.tl-now .tl-node i { width: 12px; height: 12px; border-radius: 50%; background: var(--accent-ink); box-shadow: 0 0 0 5px var(--accent-soft); }
.tl-now-line { display: flex; align-items: center; gap: 8px; padding-left: 6px; }
.tl-now-line b { flex: 1; height: 1.5px; background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 10px); }
.tl-now-line span { font-family: var(--font-num); font-size: .75rem; font-weight: 500; color: var(--accent-ink); }

@media (max-width: 340px) {
  .pad-date { width: 64px; }
  .pad-day { font-size: 2.25rem; }
}


/* シートを開いているときは、お知らせを上に出す（中身に重ならないように） */
body.sheet-open .toast { bottom: auto; top: calc(14px + env(safe-area-inset-top)); }

/* ---------- 画面の見出し（共通） ---------- */
.page-head { display: flex; align-items: center; gap: 8px; padding: calc(20px + env(safe-area-inset-top)) 0 14px; }
.page-head h1 { margin: 0; flex: 1; font-size: 1.75rem; font-weight: 700; letter-spacing: .02em; }

/* ---------- タスク画面 ---------- */
.search { min-height: 52px; border-radius: 14px; }
.seg-wide { display: flex; background: var(--sub); border-radius: 14px; padding: 4px; margin: 12px 0 10px; }
.seg-wide button { flex: 1; border: 0; background: none; min-height: 40px; border-radius: 11px; font-size: .875rem; color: var(--ink2); padding: 0 4px; white-space: nowrap; }
.seg-wide button[aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(52, 52, 52, .12); }
.list-tools { display: flex; gap: 10px; align-items: center; }
.tool-btn, .tool-sort {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; border: 1px solid var(--line); background: var(--card);
  border-radius: var(--radius-btn); padding: 0 14px; font-size: .875rem; color: var(--ink);
}
.tool-btn svg, .tool-sort svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tool-btn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }
.tool-btn b { background: var(--accent-dark); color: #fff; border-radius: 999px; min-width: 20px; height: 20px; font-size: .75rem; display: inline-grid; place-items: center; padding: 0 6px; }
:root[data-theme="dark"] .tool-btn b { color: #1D1E1B; }
.tool-sort { margin-left: auto; min-width: 0; padding-right: 8px; position: relative; }
.tool-sort select { border: 0; background: none; font: inherit; color: inherit; min-height: 42px; max-width: 150px; padding: 0; }
.tool-sort:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.tool-sort select:focus { outline: none; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.af-chip { display: inline-flex; align-items: center; gap: 4px; border: 0; background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 0 8px 0 12px; min-height: 32px; font-size: .8125rem; font-weight: 700; }
.af-chip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.af-clear { font-size: .8125rem; min-height: 32px; margin-left: 4px; }
.list-count { margin: 12px 2px 6px; font-size: .8125rem; color: var(--ink2); }
.list-card { padding-top: 4px; padding-bottom: 4px; }
.list-card.is-empty { padding: 8px 16px 18px; }
.fs-note { margin: 0 0 14px; font-size: .8125rem; color: var(--ink2); }
.btn:disabled { opacity: .45; }
.tool-btn { flex: none; white-space: nowrap; }
.tool-sort { flex: 1 1 auto; justify-content: flex-start; }
.tool-sort select { flex: 1; min-width: 0; max-width: none; width: 100%; text-overflow: ellipsis; }
@media (max-width: 360px) {
  .task-body { flex-wrap: wrap; row-gap: 4px; }
  .task-body .tags { width: 100%; }
  .tl-body .tags { width: auto; }
}

/* ---------- カレンダー ---------- */
.seg-small { margin: 0; flex: none; }
.seg-small button { min-width: 52px; min-height: 38px; }
.cal-card { padding: 10px 12px 12px; }
.cal-nav { display: flex; align-items: center; gap: 2px; margin-bottom: 4px; }
.cal-nav h2 { margin: 0 4px; font-size: 1.125rem; font-weight: 700; flex: 1; text-align: center; }
.cal-nav h2 + .icon-btn { margin-right: 0; }
.today-btn { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; min-height: 36px; padding: 0 14px; font-size: .8125rem; font-weight: 700; margin-left: 4px; }
.cal-grid { gap: 2px 0; }
.cal-day {
  border: 0; background: none; min-height: 52px; padding: 3px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 12px;
}
.cal-grid.week .cal-day { min-height: 64px; }
.cal-day .n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: .9375rem; }
.cal-day.today .n { box-shadow: inset 0 0 0 1.5px var(--accent); font-weight: 700; }
.cal-day.late .n { box-shadow: inset 0 0 0 2px var(--danger); }
.cal-day[aria-pressed="true"] .n { background: var(--accent-dark); color: #fff; font-weight: 700; box-shadow: none; }
.cal-day.late[aria-pressed="true"] .n { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--danger); }
:root[data-theme="dark"] .cal-day[aria-pressed="true"] .n { color: #1D1E1B; }
.cal-day .mk { height: 12px; display: flex; gap: 3px; align-items: center; justify-content: center; }
.cal-day .mk i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-dark); }
.cal-day .mk i.done { background: var(--pad-edge); }
.cal-day .mk.num { font-size: .625rem; font-weight: 700; line-height: 1; min-width: 16px; height: 14px; padding: 0 3px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
.cal-day:active .n { transform: scale(.94); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: flex-end; font-size: .6875rem; color: var(--ink2); margin-top: 8px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-dark); display: inline-block; transform: none; }
.cal-legend i.ring { width: 10px; height: 10px; background: none; box-shadow: inset 0 0 0 2px var(--danger); }
.cal-legend b { font-size: .625rem; background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 0 4px; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.day-head .day-title { margin: 0; font-size: 1.125rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.today-tag { font-size: .6875rem; background: var(--accent-soft); color: var(--accent-ink); border-radius: 999px; padding: 1px 8px; font-weight: 700; }
.day-count { font-size: .8125rem; color: var(--ink2); white-space: nowrap; }

/* ---------- 記録 ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 12px; }
.tile p { margin: 0 0 4px; font-size: .75rem; color: var(--ink2); }
.tile b { font-family: var(--font-num); font-size: 1.75rem; font-weight: 500; line-height: 1.1; }
.tile b small { font-family: inherit; font-size: .75rem; color: var(--ink2); margin-left: 2px; font-weight: 400; }
.rate-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.rate-top .card-title { margin-bottom: 2px; }
.rate-num { margin: 0; font-size: 1rem; color: var(--ink2); }
.rate-num b { font-family: var(--font-num); font-size: 2.5rem; font-weight: 500; color: var(--ink); line-height: 1.1; margin-right: 2px; }
.rate-num.na { font-size: .9375rem; padding: 10px 0 4px; }
.streak { text-align: right; flex: none; }
.streak p { margin: 0; font-size: .75rem; color: var(--ink2); }
.streak b { font-family: var(--font-num); font-size: 1.5rem; font-weight: 500; color: var(--accent-ink); margin-right: 2px; }
.rate-card .bar { height: 8px; }
.rate-detail { margin: 10px 0 0; font-size: .8125rem; color: var(--ink2); }
.cat-bars { list-style: none; margin: 0; padding: 0; }
.cat-bars li { display: grid; grid-template-columns: 76px minmax(0, 1fr) 40px; align-items: center; gap: 10px; min-height: 34px; }
.cat-bars .nm { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; }
.cat-bars .sw { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cat-bars .b { height: 10px; background: var(--sub); border-radius: 999px; overflow: hidden; }
.cat-bars .b i { display: block; height: 100%; border-radius: 999px; }
.cat-bars .c { font-size: .8125rem; text-align: right; color: var(--ink2); }
.note-card { box-shadow: none; background: transparent; border: 1px solid var(--line); }
.how { margin: 0; padding-left: 1.1em; font-size: .8125rem; color: var(--ink2); line-height: 1.7; }
.how b { color: var(--ink); }
@media (max-width: 340px) { .tile b { font-size: 1.375rem; } .tile { padding: 12px 10px; } }

/* ホーム画面に追加の案内（共通パーツ home-add.js）の色 */
.ha-dlg { --ha-bg: var(--card); --ha-fg: var(--ink); --ha-sub: var(--ink2); --ha-accent: var(--accent-ink); --ha-on-accent: #fff; --ha-line: var(--line); --ha-radius: var(--radius-btn); }

/* ---------- マイページ ---------- */
html[data-font="small"] { font-size: 93.75%; }
html[data-font="large"] { font-size: 112.5%; }
.profile { display: flex; align-items: center; gap: 14px; }
.profile img { width: 72px; flex: none; }
.profile h2 { margin: 0; font-size: 1.25rem; letter-spacing: .06em; }
.profile p { margin: 2px 0 0; font-size: .8125rem; color: var(--ink2); }
.profile .ver { color: var(--muted); font-size: .75rem; }
.set-title { margin: 22px 4px 8px; font-size: .8125rem; font-weight: 700; color: var(--ink2); letter-spacing: .04em; }
.set-card { padding: 4px 16px; }
.set-block { padding: 12px 0; border-top: 1px solid var(--line); }
.set-card > :first-child { border-top: 0; }
.set-name { margin: 0 0 8px; font-size: .9375rem; }
.set-name small, .set-row small, .link-row small { display: block; color: var(--ink2); font-size: .75rem; margin-top: 1px; line-height: 1.5; }
.set-row { min-height: 60px; padding: 8px 0; }
.set-val { font-family: var(--font-num); font-weight: 500; font-size: 1.125rem; flex: none; }
.seg-set { margin: 0; }
.seg-set button { min-height: 40px; }
.set-note { margin: 0; padding: 12px 0; border-top: 1px solid var(--line); font-size: .75rem; color: var(--ink2); line-height: 1.7; }
.set-note .warn { color: var(--danger-text); font-weight: 700; }
.set-card .link-row { min-height: 56px; width: 100%; border-left: 0; border-right: 0; border-bottom: 0; background: none; text-align: left; padding: 8px 0; text-decoration: none; color: var(--ink); }
.set-card .link-row.danger { color: var(--danger-text); }
.set-card .link-row:disabled { opacity: .45; }
.set-card .link-row .chev svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.switch { flex: none; width: 52px; height: 32px; border-radius: 999px; border: 0; background: var(--pad-edge); position: relative; padding: 0; transition: background .2s; }
.switch i { position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--accent-dark); }
.switch[aria-checked="true"] i { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { .switch, .switch i { transition: none; } }

/* 編集の画面：完了チェック＋タスク名、作成・完了の日時 */
.ed-top { display: flex; align-items: flex-start; gap: 6px; }
.ed-top .check { margin-top: 6px; flex: none; }
.ed-title-box { flex: 1; min-width: 0; }
.ed-stamps { margin: 4px 4px 14px; font-size: .75rem; color: var(--ink2); line-height: 1.7; font-family: var(--font-num); }
