/* ============================================================
   今日の設計図 — 紙の手帳モチーフ
   紙白 #F6F5F1 / 墨 #1C1B18 / 藍 #2B4A8B / 朱 #C2331F
   見出し: 明朝 / 本文: ゴシック
   ============================================================ */

:root {
  --paper: #F6F5F1;
  --card: #FFFFFF;
  --ink: #1C1B18;
  --ink-soft: #5C5850;
  --line: #DAD6CB;
  --ai: #2B4A8B;      /* 藍 */
  --shu: #C2331F;     /* 朱 */
  --done: #9A968B;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  --sans: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", sans-serif;
}

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

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 88px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- header ---------- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 8px 4px 14px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 18px;
}
.header-eyebrow {
  font-size: 12px;
  letter-spacing: 0.35em;
  color: var(--ink-soft);
}
.header-date {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: 0.04em;
}
.header-status { display: flex; align-items: center; gap: 6px; padding-bottom: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dot.ok { background: #2E7D46; }
.dot.ng { background: var(--shu); }
.dot-label { font-size: 11px; color: var(--ink-soft); }

/* ---------- cards / buttons ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}
.btn {
  font-family: var(--sans);
  font-size: 15px;
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.btn:focus-visible { outline: 3px solid var(--ai); outline-offset: 2px; }
.btn-primary { background: var(--ai); border-color: var(--ai); color: #fff; font-weight: 600; }
.btn-ghost { border: none; background: none; color: var(--ai); text-decoration: underline; margin-top: 12px; }
.btn-small { font-size: 13px; padding: 7px 12px; }
.btn-quiet { border-color: var(--line); color: var(--ink-soft); }

/* ---------- wake card ---------- */
.wake-card { text-align: center; padding: 32px 20px; }
.wake-title { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.wake-sub { color: var(--ink-soft); font-size: 14px; margin: 6px 0 20px; }
.wake-controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.time-input {
  font-size: 20px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--sans);
}

/* ---------- plan ---------- */
.plan-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.plan-actions { display: flex; gap: 8px; }

/* ---------- timeline ---------- */
.timeline { list-style: none; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 74px;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--line);
}
.tl-item {
  display: grid;
  grid-template-columns: 62px 24px 1fr;
  align-items: flex-start;
  padding: 10px 0;
  position: relative;
}
.tl-time {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: right;
  line-height: 1.4;
  padding-top: 2px;
}
.tl-time .end { color: var(--line); font-size: 11px; display: block; }
.tl-node {
  width: 11px; height: 11px;
  border-radius: 50%;
  margin: 6px auto 0;
  background: var(--card);
  border: 2px solid var(--ai);
  position: relative; z-index: 1;
}
.tl-item.event .tl-node { border-color: var(--ink); background: var(--ink); border-radius: 2px; }
.tl-body {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tl-item.event .tl-body { background: #EDEBE4; border-color: #CFCBBE; }
.tl-title { font-size: 15px; flex: 1; }
.tl-tag {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}
.tl-check {
  width: 22px; height: 22px;
  accent-color: var(--ai);
  cursor: pointer;
  flex-shrink: 0;
}
.prio-1 .tl-title::before { content: "★ "; color: var(--shu); font-size: 12px; }

/* 現在時刻の朱ライン */
.now-line {
  position: relative;
  height: 0;
  border-top: 2px solid var(--shu);
  margin-left: 62px;
  list-style: none;
}
.now-line::before {
  content: "今";
  position: absolute;
  left: -34px; top: -11px;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--shu);
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- unplaced / done ---------- */
.unplaced {
  margin-top: 18px;
  border: 1px dashed var(--shu);
  border-radius: 8px;
  padding: 12px 16px;
  background: #FBF3F1;
}
.unplaced-title { font-size: 13px; font-weight: 600; color: var(--shu); margin-bottom: 4px; }
.unplaced ul { list-style: none; font-size: 14px; }

.done-box { margin-top: 18px; color: var(--ink-soft); font-size: 14px; }
.done-box summary { cursor: pointer; padding: 6px 0; }
.done-box ul { list-style: none; padding: 6px 0 0 12px; }
.done-box li { text-decoration: line-through; color: var(--done); padding: 3px 0; }

/* ---------- tasks view ---------- */
.section-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-soft); }
.field-wide { grid-column: 1 / -1; }
.field input, .field select {
  font-family: var(--sans);
  font-size: 15px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}
.hint { font-size: 12px; color: var(--ink-soft); margin-top: 10px; }

.task-list { list-style: none; }
.task-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.task-info { flex: 1; }
.task-name { font-size: 15px; }
.task-detail { font-size: 12px; color: var(--ink-soft); }
.task-del {
  border: none; background: none;
  color: var(--shu); font-size: 13px;
  cursor: pointer; text-decoration: underline;
}
.prio-badge {
  font-size: 11px; font-weight: 700;
  border-radius: 4px; padding: 2px 7px;
  color: #fff; white-space: nowrap;
}
.prio-badge.p1 { background: var(--shu); }
.prio-badge.p2 { background: var(--ai); }
.prio-badge.p3 { background: var(--done); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  padding: 14px;
  font-size: 15px;
  font-family: var(--sans);
  border: none;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  border-top: 3px solid transparent;
}
.tab.active { color: var(--ink); font-weight: 700; border-top-color: var(--shu); }

@media (prefers-reduced-motion: no-preference) {
  .tl-body { transition: opacity 0.25s ease, transform 0.25s ease; }
  .tl-item.leaving .tl-body { opacity: 0; transform: translateX(12px); }
}

.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-head .section-title { margin-bottom: 0; }
