@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@300;400;500;700&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

:root {
  /* ── ベースカラー ── */
  --navy: #1d3461;
  /* 紺碧・深藍 */
  --navy-dark: #122040;
  /* 漆紺 */
  --navy-mid: #2a4a82;
  /* 中濃藍 */
  --navy-light: #3a5fa0;
  /* 薄藍 */
  --cream: #f5f0e0;
  /* 生成り */
  --cream-dark: #ede5cc;
  /* 古紙 */
  --cream-mid: #e0d8c0;
  /* 薄香 */

  /* ── 和のアクセント ── */
  --beni: #8b2635;
  /* 紅 */
  --beni-light: #a83848;
  /* 薄紅 */
  --kincha: #b8860b;
  /* 金茶 */
  --byakudan: #c8a96e;
  /* 白檀 */
  --matcha: #4a6741;
  /* 抹茶 */
  --fuji: #6b5b8a;
  /* 藤 */

  /* ── テキスト ── */
  --ink: #0e1e3a;
  /* 墨 (navy寄り) */
  --ink-mid: #2a3f6a;
  /* 濃紺 */
  --ink-soft: #5a7098;
  /* 青鼠 */
  --ink-ghost: #8ea0be;
  /* 薄青灰 */

  /* ── グレースケール (cream系) ── */
  --wa-50: #faf8f0;
  --wa-100: #f5f0e0;
  --wa-200: #ede5cc;
  --wa-300: #d8cfb0;
  --wa-400: #c0b490;
  --wa-500: #9a8e72;
  --wa-600: #7a6e58;
  --wa-700: #5a5040;

  /* ── ボーダー / シャドウ ── */
  --border: rgba(29, 52, 97, .10);
  --border-mid: rgba(29, 52, 97, .20);
  --shadow-sm: 0 1px 3px rgba(29, 52, 97, .08);
  --shadow-md: 0 2px 12px rgba(29, 52, 97, .10), 0 1px 3px rgba(29, 52, 97, .06);
  --shadow-lg: 0 8px 32px rgba(29, 52, 97, .16), 0 2px 8px rgba(29, 52, 97, .08);

  /* ── JS互換エイリアス ── */
  --bg: #f5f0e0;
  --sumi: #0e1e3a;
  --green-500: #4a6741;
  --green-600: #3a5631;
  --red-500: #8b2635;
  --amber-500: #b8860b;
  --tsuchi: #1d3461;
  --kaki: #b8860b;
  --kon: #1d3461;
  --pri-50: #edf2f8;
  --pri-100: #d4e0f0;
  --pri-500: #1d3461;
  --pri-600: #122040;
  --gray-50: #faf8f0;
  --gray-100: #f5f0e0;
  --gray-200: #ede5cc;
  --gray-300: #d8cfb0;
  --gray-400: #c0b490;
  --gray-500: #9a8e72;
  --gray-600: #7a6e58;
  --gray-700: #5a5040;
}

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

body {
  background: var(--cream);
  color: var(--ink);
  line-height: 1.65;
  font-family: 'Noto Sans JP', 'Hiragino Sans', -apple-system, sans-serif;
  font-size: 14px;
  font-weight: 300;
  overflow-x: hidden;
}

/* ─── HEADER ─── */
#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: rgba(245, 240, 224, .93);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border-mid);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: relative;
}

#app-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy) 40%, var(--byakudan) 40%, var(--byakudan) 70%, var(--navy-light) 70%, var(--navy-light) 100%);
  opacity: .75;
  z-index: 1;
}

#app-header>.header-inner {
  position: relative;
  z-index: 2;
}

.header-inner {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: 'Noto Serif JP', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-dark);
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mark {
  width: 40px;
  height: 40px;

  border: none;
  border-radius: 0;
  background: transparent;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
  flex-shrink: 0;
}

.logo span {
  color: var(--ink-soft);
  font-weight: 300;
  font-size: 11px;
  font-family: 'Noto Sans JP', sans-serif;
  letter-spacing: .04em;
}

.nav-tabs {
  display: flex;
  gap: 0;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 16px;
  border-radius: 0;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .06em;
  cursor: pointer;
  transition: all .2s ease;
  font-family: 'Noto Sans JP', sans-serif;
  height: 56px;
  margin-top: -2px;
}

.nav-btn:hover {
  color: var(--ink);
  background: rgba(45, 35, 24, .04);
}

.nav-btn.active {
  color: var(--sumi);
  font-weight: 500;
  border-bottom-color: var(--navy);
  background: rgba(29, 52, 97, .05);
}

.nav-btn svg {
  width: 14px;
  height: 14px;
}

/* ─── MAIN ─── */
#app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ─── CARD ─── */
.card {
  background: rgba(250, 247, 235, .96);
  border-radius: 2px;
  border: 1px solid var(--border-mid);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 2px;
  background: var(--wa-300);
  border-radius: 0 1px 1px 0;
}

/* ─── BUTTON ─── */
.btn {
  border-radius: 2px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .06em;
  padding: 7px 16px;
  transition: all .2s ease;
  cursor: pointer;
  border: none;
  font-family: 'Noto Sans JP', sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-primary {
  background: var(--navy);
  color: var(--cream);
  border: 1px solid var(--navy);
}

.btn-primary:hover {
  background: var(--navy-dark);
  border-color: var(--navy-dark);
}

.btn-outline {
  background: transparent;
  color: var(--ink-mid);
  border: 1px solid var(--border-mid);
}

.btn-outline:hover {
  background: var(--wa-100);
}

.btn-danger {
  background: var(--beni);
  color: var(--cream);
  border: 1px solid var(--beni);
}

.btn-danger:hover {
  background: #6e1d28;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

/* ─── TASKS TAB ─── */
.tasks-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 3fr);
  gap: 24px;
}

.hero-card {
  margin-bottom: 12px;
}

.hero-card::before {
  background: var(--navy);
  opacity: .7;
}

.hero-date {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.hero-date h2 {
  font-family: 'Noto Serif JP', serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--sumi);
  letter-spacing: .1em;
}

.view-toggle {
  display: flex;
  background: var(--wa-100);
  border-radius: 2px;
  border: 1px solid var(--border);
  padding: 2px;
  gap: 2px;
}

.view-toggle button {
  padding: 3px 10px;
  border-radius: 1px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .04em;
  cursor: pointer;
  transition: all .15s;
  font-family: 'Noto Sans JP', sans-serif;
}

.view-toggle button.active {
  background: rgba(248, 245, 228, .97);
  color: var(--sumi);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.hero-hours {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 3px;
}

.hero-actual {
  font-family: 'Noto Serif JP', serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--sumi);
  letter-spacing: -.02em;
}

.hero-total {
  font-size: 14px;
  font-weight: 300;
  color: var(--ink-soft);
}

.hero-pct {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mid);
}

.hero-dot {
  color: var(--wa-300);
  margin: 0 2px;
}

.hero-meta {
  font-size: 11px;
  color: var(--ink-ghost);
  margin-bottom: 10px;
  letter-spacing: .04em;
}

.progress-bar {
  height: 4px;
  background: var(--wa-200);
  border-radius: 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy) 0%, var(--byakudan) 100%);
  transition: width .4s ease;
}

.quick-add-card {
  padding: 10px 14px;
}

.quick-add-card::before {
  background: var(--navy-light);
  opacity: .4;
}

.quick-add-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qa-icon {
  width: 28px;
  height: 28px;
  border-radius: 2px;
  background: var(--wa-100);
  color: var(--ink-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: background .15s;
  border: 1px solid var(--border);
}

.qa-icon:hover {
  background: var(--wa-200);
}

.qa-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--ink);
  background: transparent;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 300;
}

.qa-input::placeholder {
  color: var(--ink-ghost);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .15s;
  user-select: none;
  border-bottom: 1px solid var(--border);
}

.section-header:hover {
  background: rgba(45, 35, 24, .03);
}

.section-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-mid);
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 10px;
  color: var(--ink-ghost);
  font-weight: 300;
}

.section-chevron {
  color: var(--wa-400);
  transition: transform .2s;
  font-size: 11px;
}

.section-chevron.collapsed {
  transform: rotate(-90deg);
}

.section-body {
  overflow: hidden;
}

.section-body.hidden {
  display: none;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(45, 35, 24, .06);
  transition: background .1s;
  animation: fadeIn .2s ease;
}

.task-item:last-child {
  border-bottom: none;
}

.task-item:hover {
  background: rgba(45, 35, 24, .025);
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.drag-handle {
  color: var(--wa-300);
  cursor: grab;
  font-size: 11px;
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: -.5px;
}

.check-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--wa-300);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.check-circle.done {
  background: var(--navy);
  border-color: var(--navy);
}

.check-circle.done svg {
  display: block;
}

.check-circle svg {
  display: none;
  width: 8px;
  height: 8px;
}

.task-title-wrap {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 13px;
  font-weight: 300;
  /* 長いタスク名は末尾を省略せず、2行まで折り返して表示する */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 1.5;
  cursor: pointer;
  color: var(--ink);
  letter-spacing: .02em;
}

.task-title.done {
  text-decoration: line-through;
  color: var(--ink-ghost);
}

.task-title-edit {
  border: none;
  outline: none;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 300;
  width: 100%;
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid var(--wa-300);
}

.task-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.tag {
  font-size: 10px;
  border-radius: 1px;
  padding: 1px 6px;
  font-weight: 400;
  white-space: nowrap;
  letter-spacing: .04em;
}

.hours-tag {
  background: var(--wa-100);
  color: var(--ink-mid);
  border-radius: 1px;
  border: 1px solid var(--border);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s;
  font-family: 'Noto Serif JP', serif;
  letter-spacing: .02em;
}

.hours-tag:hover {
  background: var(--wa-200);
}

.hours-select {
  font-size: 11px;
  font-weight: 400;
  border: 1px solid var(--wa-300);
  border-radius: 1px;
  padding: 1px 4px;
  background: rgba(248, 245, 228, .97);
  color: var(--ink);
  cursor: pointer;
  font-family: 'Noto Serif JP', serif;
}

.task-delete {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--wa-400);
  cursor: pointer;
  border-radius: 1px;
  transition: all .15s;
  flex-shrink: 0;
  font-size: 13px;
}

.task-delete:hover {
  color: var(--beni);
  background: rgba(29, 52, 97, .08);
}

/* Timeline */
.timeline-view {
  position: relative;
  display: flex;
}

.timeline-labels {
  width: 48px;
  flex-shrink: 0;
}

.timeline-label {
  height: 50px;
  font-size: 10px;
  color: var(--ink-ghost);
  padding-top: 4px;
  text-align: right;
  padding-right: 10px;
  font-family: 'Noto Serif JP', serif;
  letter-spacing: .04em;
}

.timeline-body {
  flex: 1;
  position: relative;
  border-left: 1px solid var(--wa-200);
}

.timeline-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--wa-100);
}

.timeline-task-block {
  position: absolute;
  left: 4px;
  right: 4px;
  background: var(--navy);
  color: var(--cream);
  border-radius: 2px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 300;
  overflow: hidden;
  cursor: default;
  min-height: 24px;
  letter-spacing: .02em;
}

.timeline-task-block .tl-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-task-block .tl-hours {
  font-size: 10px;
  opacity: .6;
  font-family: 'Noto Serif JP', serif;
}

.unscheduled-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: 'Noto Serif JP', serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-mid);
  cursor: pointer;
  border-radius: 2px;
  transition: background .15s;
  user-select: none;
  letter-spacing: .06em;
}

.unscheduled-header:hover {
  background: rgba(45, 35, 24, .03);
}

/* ─── NOTES ─── */
.notes-panel {
  background: rgba(250, 247, 235, .97);
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  padding: 14px;
  height: calc(100vh - 90px);
  position: sticky;
  top: 72px;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.notes-header h3 {
  font-family: 'Noto Serif JP', serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--sumi);
}

.notes-count {
  font-size: 10px;
  color: var(--ink-ghost);
}

.note-textarea {
  width: 100%;
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 300;
  resize: none;
  outline: none;
  color: var(--ink);
  background: rgba(248, 245, 228, .65);
  transition: border-color .2s;
  min-height: 64px;
  letter-spacing: .02em;
}

.note-textarea:focus {
  border-color: var(--navy-light);
  background: rgba(248, 245, 228, .95);
}

.note-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}



.note-card {
  padding: 8px 10px;
  border: 1px solid rgba(45, 35, 24, .08);
  border-radius: 2px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background .15s;
  border-left: 2px solid var(--navy-light);
}

.note-card:hover {
  background: rgba(45, 35, 24, .025);
}

.note-preview {
  font-size: 12px;
  font-weight: 300;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: .02em;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.note-date {
  font-size: 10px;
  color: var(--ink-ghost);
  letter-spacing: .04em;
}

.note-edit-area {
  width: 100%;
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 300;
  resize: none;
  outline: none;
  color: var(--ink);
  background: rgba(248, 245, 228, .85);
  min-height: 70px;
  margin-bottom: 6px;
}

.note-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.note-delete-btn {
  color: var(--beni);
  background: none;
  border: none;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  font-family: 'Noto Sans JP', sans-serif;
  letter-spacing: .04em;
}

/* ─── CALENDAR ─── */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 0 4px;
}

.calendar-nav h2 {
  font-family: 'Noto Serif JP', serif;
  font-size: 18px;
  font-weight: 500;
  color: var(--sumi);
  letter-spacing: .1em;
}

.cal-nav-btn {
  background: rgba(248, 245, 228, .92);
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  color: var(--ink-mid);
  font-size: 16px;
}

.cal-nav-btn:hover {
  background: var(--wa-200);
}

.calendar-dow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  margin-bottom: 4px;
}

.calendar-dow-cell {
  text-align: center;
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-ghost);
  padding: 4px 0;
  letter-spacing: .1em;
  font-family: 'Noto Serif JP', serif;
}

.calendar-dow-cell:first-child {
  color: var(--beni);
  opacity: .7;
}

.calendar-dow-cell:last-child {
  color: var(--kon);
  opacity: .7;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  background: var(--wa-200);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--border-mid);
}

.cal-cell {
  aspect-ratio: 1/1;
  padding: 6px;
  display: flex;
  flex-direction: column;
  background: rgba(248, 245, 228, .92);
  cursor: pointer;
  transition: background .15s;
  min-height: 70px;
}

.cal-cell:hover {
  background: var(--wa-50);
}

.cal-cell.today {
  background: rgba(139, 38, 53, .06);
}

.cal-cell.today .cal-day-num {
  color: var(--navy);
  font-weight: 700;
}

.cal-cell.other-month {
  background: rgba(245, 240, 224, .55);
}

.cal-cell.other-month .cal-day-num {
  color: var(--wa-300);
}

.cal-cell.selected {
  background: rgba(122, 98, 72, .08);
}

.cal-day-num {
  font-family: 'Noto Serif JP', serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
}

.cal-task-count {
  font-size: 9px;
  color: var(--ink-soft);
  margin-top: 2px;
  letter-spacing: .04em;
}

.cal-dots {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.cal-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--navy-light);
  opacity: .9;
}

.calendar-detail {
  margin-top: 24px;
  animation: fadeIn .2s ease;
}

.calendar-detail h3 {
  font-family: 'Noto Serif JP', serif;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 14px;
  color: var(--sumi);
  letter-spacing: .1em;
}

.cal-detail-hero {
  background: var(--wa-50);
}

.cal-detail-hero::before {
  display: none;
}

.cal-stat-num {
  font-family: 'Noto Serif JP', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--sumi);
}

.cal-stat-label {
  font-size: 10px;
  color: var(--ink-ghost);
  letter-spacing: .06em;
}

/* ─── SETTINGS ─── */
.settings-card-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 14px;
  color: var(--sumi);
  letter-spacing: .1em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.settings-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(45, 35, 24, .06);
}

.settings-list-item:last-child {
  border-bottom: none;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.settings-label {
  flex: 1;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: .02em;
}

.settings-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}

.settings-input {
  flex: 1;
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 300;
  outline: none;
  background: rgba(248, 245, 228, .85);
  color: var(--ink);
  transition: border-color .2s;
}

.settings-input:focus {
  border-color: var(--navy-light);
}

.settings-color-input {
  width: 36px;
  height: 34px;
  border-radius: 2px;
  border: 1px solid var(--border-mid);
  padding: 2px;
  cursor: pointer;
  background: transparent;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stat-box {
  background: var(--wa-50);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 14px;
  text-align: center;
}

.stat-box-num {
  font-family: 'Noto Serif JP', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--sumi);
}

.stat-box-label {
  font-size: 10px;
  color: var(--ink-ghost);
  letter-spacing: .08em;
  margin-top: 2px;
}

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 16, .55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeOverlay .25s ease;
  backdrop-filter: blur(4px);
}

@keyframes fadeOverlay {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-box {
  background: rgba(248, 244, 228, .99);
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
  overflow: hidden;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-box-top-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--byakudan) 50%, var(--navy-light) 100%);
  opacity: .85;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--sumi);
  letter-spacing: .08em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--ink-ghost);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color .15s;
}

.modal-close:hover {
  color: var(--navy);
}

.modal-body {
  padding: 16px 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: rgba(245, 240, 224, .55);
}

.review-summary {
  font-family: 'Noto Serif JP', serif;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  color: var(--ink-mid);
  letter-spacing: .04em;
}

.review-task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(45, 35, 24, .06);
}

.review-task-item:last-child {
  border-bottom: none;
}

.review-task-status {
  font-size: 14px;
  color: var(--navy);
}

.review-task-title {
  flex: 1;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: .02em;
}

.review-task-hours {
  font-family: 'Noto Serif JP', serif;
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 400;
}

.review-complete-btn {
  font-size: 10px;
  background: var(--wa-100);
  color: var(--ink-mid);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 3px 8px;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  transition: all .15s;
  white-space: nowrap;
  letter-spacing: .04em;
}

.review-complete-btn:hover {
  background: var(--navy);
  color: var(--cream);
  border-color: var(--navy);
}

/* ─── BOTTOM NAV ─── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(245, 240, 224, .94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-mid);
  z-index: 100;
  padding: 0 8px;
  justify-content: space-around;
  align-items: center;
}

.bnav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 20px;
  border: none;
  background: transparent;
  color: var(--ink-ghost);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .06em;
  cursor: pointer;
  border-radius: 2px;
  transition: all .15s;
  font-family: 'Noto Sans JP', sans-serif;
}

.bnav-btn.active {
  color: var(--navy);
}

.bnav-btn svg {
  width: 20px;
  height: 20px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  #app-header .nav-tabs {
    display: none;
  }

  .bottom-nav {
    display: flex;
  }

  .tasks-grid {
    /* 1fr は中身の最小幅まで広がるため、minmax(0,…) で画面幅に収める */
    grid-template-columns: minmax(0, 1fr);
  }

  #tasks-left,
  #notes-panel {
    min-width: 0;
  }

  .notes-panel {
    position: static;
    height: auto;
    min-height: 300px;
  }

  #app-main {
    padding: 16px 16px 76px;
  }
}

@media (max-width: 480px) {
  /* 追加行は幅が足りなければ折り返す */
  .qa-options {
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .qa-date-group {
    flex-wrap: wrap;
  }

  .cal-cell {
    padding: 3px;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-box {
    border-radius: 4px 4px 0 0;
    max-width: 100%;
  }

  .cal-cell {
    min-height: 50px;
  }

  .cal-day-num {
    font-size: 12px;
  }
}

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--wa-300);
  border-radius: 0;
}

/* ─── QUICK ADD DATE BUTTONS ─── */
.qa-date-btn {
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .04em;
  background: transparent;
  color: var(--ink-mid);
  cursor: pointer;
  transition: all .15s;
  font-family: 'Noto Sans JP', sans-serif;
  white-space: nowrap;
}

.qa-date-btn:hover {
  background: var(--wa-200);
}

.qa-date-btn.active {
  background: var(--navy);
  color: var(--cream);
  border-color: var(--navy);
}

.qa-date-picker-wrap {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  padding: 3px 8px;
}

/* hours-tag — allow HTML inside (actual/est display) */
.hours-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  min-width: 36px;
  justify-content: center;
}

/* ─── TIMELINE DRAG ─── */
.tl-draggable {
  transition: box-shadow .15s;
}

.tl-draggable:active {
  opacity: .92;
}

.tl-time {
  font-family: 'Noto Serif JP', serif;
  letter-spacing: .04em;
}
/* ─── タイムライン: 24時間表示 ─── */
.timeline-scroll {
  max-height: 620px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* 稼働時間外（22時〜翌9時）は控えめに */
.timeline-label.tl-offhours {
  color: var(--wa-400);
}

.timeline-hour-line.tl-offhours-line {
  background: var(--wa-100);
  opacity: .6;
}

/* ─── タイムライン: 完了したタスク ─── */
.timeline-task-block.tl-done {
  opacity: .5;
}

.timeline-task-block.tl-done .tl-title {
  text-decoration: line-through;
}

/* ─── インラインアイコン ─── */
.icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  vertical-align: -2px;
}

.section-title .icon {
  width: 13px;
  height: 13px;
  color: var(--navy-light);
}

/* ─── Notes のプロジェクト選択（自前ドロップダウン）─── */
.ns-select {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: 220px;
}

.ns-trigger {
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  padding: 0 10px;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--ink);
  background: rgba(250, 247, 235, .92);
  cursor: pointer;
  text-align: left;
}

.ns-trigger::after {
  content: '';
  width: 9px;
  height: 6px;
  flex-shrink: 0;
  background: currentColor;
  opacity: .5;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.ns-trigger:hover {
  border-color: var(--navy-light);
}

.ns-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ns-menu {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  background: rgba(250, 247, 235, .99);
  box-shadow: var(--shadow-md);
  padding: 3px;
}

/* 下に入りきらないときは上向きに開く */
.ns-menu.ns-menu-up {
  top: auto;
  bottom: calc(100% + 3px);
}

.ns-opt {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 6px 9px;
  font-size: 13px;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--ink-mid);
  border-radius: 2px;
  cursor: pointer;
}

.ns-opt:hover {
  background: var(--wa-100);
  color: var(--ink);
}

.ns-opt.is-current {
  background: var(--pri-50);
  color: var(--ink);
  font-weight: 500;
}

/* 編集フォームの中では幅いっぱいに */
.note-card .ns-select {
  max-width: none;
  margin-bottom: 6px;
}

/* ─── メモカード: タップ時の青い塗りを抑える ─── */
/* スマホ表示（DevToolsのデバイスモード含む）では、クリックした要素に
   ブラウザ既定のハイライトが乗り、カード全体が青く見えることがある。
   さらに再描画の前後で選択範囲が残ると、その範囲も青く塗られる。 */
.note-card {
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* 入力欄の中だけは今までどおり選択できるようにする */
.note-card textarea,
.note-card input,
.note-card .note-preview {
  -webkit-user-select: text;
  user-select: text;
}

.ns-trigger,
.ns-opt {
  -webkit-tap-highlight-color: transparent;
}

/* ─── やり残し（期日を過ぎた未完了タスク） ─── */
.overdue-card::before {
  background: var(--beni);
  opacity: .85;
}

.overdue-title {
  color: var(--beni);
}

.overdue-tag {
  background: transparent;
  color: var(--beni);
  border: 1px solid var(--beni);
  opacity: .8;
  padding: 0 5px;
}

/* ─── 年月ジャンプ（カレンダー見出しのアイコン） ─── */
.cal-title-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-jump-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  width: 26px;
  height: 26px;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: all .15s;
}

.cal-jump-btn:hover,
.cal-jump-btn.open {
  color: var(--ink-mid);
  border-color: var(--border-mid);
  background: var(--wa-100);
}

.cal-jump-btn .icon {
  width: 15px;
  height: 15px;
}

/* 中身だけ差し替えられるよう、置き場所を実体のない箱として切り出す。
   position:absolute なので見出しの横並びには影響しない。 */
.cal-picker-host {
  position: absolute;
  top: 100%;
  left: 50%;
}

.cal-picker {
  position: absolute;
  top: 8px;
  left: 0;
  transform: translateX(-50%);
  z-index: 60;
  width: 232px;
  background: rgba(247, 252, 254, .99);
  border: 1px solid var(--border-mid);
  border-radius: 3px;
  box-shadow: var(--shadow-lg);
  padding: 10px;
}

/* 共通の slideUp は transform を上書きしてしまい、
   中央寄せ（translateX(-50%)）が外れて横にずれる。専用の動きを用意する。 */
.cal-picker.opening {
  animation: calPickerIn .15s ease;
}

@keyframes calPickerIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.cal-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cal-picker-year {
  font-family: 'Noto Serif JP', serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mid);
  letter-spacing: .08em;
}

.cal-picker-nav {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  color: var(--ink-mid);
  font-size: 14px;
  line-height: 1;
  transition: background .15s;
}

.cal-picker-nav:hover {
  background: var(--wa-100);
}

.cal-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.cal-picker-month {
  position: relative;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 7px 0;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 11px;
  font-weight: 300;
  color: var(--ink-mid);
  cursor: pointer;
  transition: all .15s;
}

.cal-picker-month:hover {
  background: var(--wa-100);
  border-color: var(--border-mid);
}

.cal-picker-month.this-month {
  border-color: var(--beni);
  color: var(--beni);
}

.cal-picker-month.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--cream);
  font-weight: 400;
}

.cal-picker-dot {
  position: absolute;
  left: 50%;
  bottom: 3px;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
}

.cal-picker-today {
  width: 100%;
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  padding: 6px 0;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: .06em;
  color: var(--ink-mid);
  cursor: pointer;
  transition: background .15s;
}

.cal-picker-today:hover {
  background: var(--wa-100);
}
