/* css/style.css
   ニュートラルポップ。ベース：オフホワイト、アクセント：テラコッタ／セージ／ダスティピンク。
   絵文字を全廃して Lucide風線画SVGに統一。タスク4タブを上、リファレンス3タブをボトムナビへ。
*/

:root {
  --offwhite: #FBF9F4;
  --warm-greige: #E8E0D5;
  --warm-greige-dim: #F2EBE0;
  --terracotta: #D4795A;
  --terracotta-light: #E89878;
  --dusty-pink: #E8B4A0;
  --soft-blush: #FDE5D8;
  --warm-cream: #FDF4EE;
  --sage: #A8B89A;
  --sage-light: #D8E0CC;
  --ink: #3A332C;
  --ink-strong: #2D2A26;
  --ink-soft: #6B6055;
  --ink-mute: #9A8E80;
  --accent-clay: #B5856B;
  --line: #DCD3C5;
  --shadow: 0 2px 12px rgba(58, 51, 44, 0.08);
  --shadow-strong: 0 4px 20px rgba(58, 51, 44, 0.12);
  --radius: 16px;
  --radius-lg: 24px;
  --bottom-nav-h: 64px;
  --font-display: 'DM Serif Display', 'Cormorant Garamond', serif;
  --font-italic: 'Cormorant Garamond', 'DM Serif Display', serif;
  --font-body: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --offwhite: #1F1B17;
    --warm-greige: #2C2620;
    --warm-greige-dim: #25201B;
    --terracotta: #E89878;
    --terracotta-light: #F0AC8E;
    --dusty-pink: #C99A85;
    --sage: #8C9D7E;
    --sage-light: #3A4438;
    --ink: #F0EAE0;
    --ink-soft: #C8BFB2;
    --ink-mute: #948A7E;
    --line: #3A3329;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    --shadow-strong: 0 4px 20px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--offwhite);
  color: var(--ink);
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.serif {
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a { color: var(--terracotta); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Lucide風アイコン共通 ===== */
.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  color: inherit;
}
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 72px; height: 72px; stroke-width: 1.2; }

/* ===== Onboarding (index.html) ===== */
body.onboarding {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.onboarding-container {
  max-width: 480px;
  width: 100%;
  background: var(--warm-greige-dim);
  border-radius: var(--radius-lg);
  padding: 40px 28px;
  box-shadow: var(--shadow-strong);
  text-align: center;
}
.step { display: none; }
.step.active { display: block; animation: fade-in 200ms ease; }
.welcome-icon {
  color: var(--terracotta);
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}
.onboarding-container h1.serif {
  font-size: 36px;
  letter-spacing: 0.05em;
  color: var(--terracotta);
  margin: 0 0 4px 0;
}
.onboarding-container h2 {
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0 0 16px 0;
  font-weight: 500;
}
.lead {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 0 24px 0;
}
.login-info {
  font-size: 12px;
  color: var(--ink-mute);
  margin: 0 0 16px 0;
}
.btn-primary {
  background: var(--terracotta);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 700;
  width: 100%;
  max-width: 320px;
  transition: background 150ms ease;
}
.btn-primary:hover { background: var(--terracotta-light); }
.btn-secondary {
  background: var(--warm-greige);
  color: var(--ink);
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 14px;
}
.btn-danger {
  background: transparent;
  color: var(--terracotta);
  border: 1px solid var(--terracotta);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
}
.form { text-align: left; margin-top: 16px; }
.form label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 16px 0 6px;
  font-weight: 500;
}
.form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--offwhite);
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
}
.form input:focus {
  outline: none;
  border-color: var(--terracotta);
}
.form .btn-primary { margin-top: 24px; }

/* ===== App layout (app.html) ===== */
body.app {
  background: var(--offwhite);
  /* ボトムナビ分の余白 */
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--offwhite);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
}
.app-title {
  display: flex;
  flex-direction: column;
  margin: 0;
  line-height: 1.1;
}
.app-title .serif {
  font-size: 22px;
  color: var(--terracotta);
  letter-spacing: 0.05em;
}
.app-title-sub {
  font-size: 11px;
  color: var(--ink-mute);
  font-weight: 500;
}
.icon-btn {
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: 12px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--warm-greige-dim); color: var(--ink); }

/* ===== 上部タブ（タスク系4タブ） ===== */
.tabbar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 12px 10px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: background 150ms, color 150ms;
}
.tab .tab-icon { display: inline-flex; }
.tab:hover { background: var(--warm-greige-dim); color: var(--ink); }
.tab.active {
  background: var(--terracotta);
  color: white;
}

.app-main {
  /* 各セクション（hero / highlight / app-header / tab-content）が個別に padding を持つ。
     ここでは横幅の上限と中央寄せのみ。 */
  max-width: 720px;
  margin: 0 auto;
  padding: 0;
}
#tab-content {
  padding: 16px;
}
.tab-content {
  transition: opacity 150ms ease;
  animation: tabContentIn 0.3s ease;
}
@keyframes tabContentIn {
  0%   { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.tab-content.fading { opacity: 0; }
.loading {
  text-align: center;
  color: var(--ink-mute);
  padding: 48px 0;
}

/* ===== ボトムナビ（リファレンス系3タブ） ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  background: var(--offwhite);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(58, 51, 44, 0.04);
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  padding: 8px 4px;
  color: var(--ink-mute);
  font-size: 11px;
  font-weight: 500;
  min-height: var(--bottom-nav-h);
  transition: color 150ms ease;
}
.bnav-item .bnav-icon { display: inline-flex; }
.bnav-item.active {
  color: var(--terracotta);
}
.bnav-item.active .bnav-icon { color: var(--terracotta); }
.bnav-item:hover { color: var(--ink); }

/* ===== Category & cards ===== */
.category {
  margin-bottom: 32px;
}
.category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 12px;
  padding-left: 4px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.category-icon {
  display: inline-flex;
  color: var(--terracotta);
}
.category-name { flex: 1; min-width: 0; }
.category-sub {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 8px;
  background: var(--sage-light);
  color: var(--ink-soft);
  font-size: 11px;
  border-radius: 999px;
  font-weight: 500;
}
.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card {
  background: var(--warm-greige-dim);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow);
  transition: background 200ms ease;
}
.card.completed {
  background: var(--sage-light);
}
.card.card-readonly {
  /* リファレンスカード（チェック不可・読むだけ） */
}
.card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.check-btn {
  flex-shrink: 0;
  background: transparent;
  border: 2px solid var(--line);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-top: 2px;
  color: transparent;
  transition: border-color 150ms, background 150ms, color 150ms;
}
.check-btn:hover { border-color: var(--terracotta); }
.check-btn.is-checked {
  border-color: var(--sage);
  background: white;
  color: var(--sage);
}
@media (prefers-color-scheme: dark) {
  .check-btn.is-checked { background: var(--ink); }
}
.card-titles { flex: 1; min-width: 0; }
.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}
.card.completed .card-title { color: var(--ink-mute); }
.card-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-mute);
}
.card-meta {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
}
.meta .icon { color: var(--ink-mute); }
.meta-amount {
  color: var(--terracotta);
  font-weight: 700;
}
.meta-amount .icon { color: var(--terracotta); }
.card.completed .meta-amount { color: var(--sage); }
.card.completed .meta-amount .icon { color: var(--sage); }
.meta-phone, .meta-address {
  color: var(--ink-soft);
}
.meta-phone:hover, .meta-address:hover {
  color: var(--terracotta);
  text-decoration: none;
}
.meta-phone:hover .icon, .meta-address:hover .icon { color: var(--terracotta); }
.card-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.card-details summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--terracotta);
  list-style: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-details summary::-webkit-details-marker { display: none; }
.card-details[open] summary .icon { transform: rotate(180deg); }
.card-details summary .icon { transition: transform 150ms ease; }
.card-details p {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.card-link {
  margin: 8px 0 0;
  font-size: 13px;
}

/* ===== Deadline 3段階表示（hard / soft / null） ===== */
/* バッジは1個に統合：hard/soft いずれの状態でも .deadline-badge が同じ位置に出る。
   色は親カードのクラス（.card-hard-* / .card-soft-*）が決める。 */
.card-deadline {
  margin: 4px 0 0;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.deadline-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--warm-greige);
  color: var(--ink-soft);
}

/* hard：くすんだ赤（テラコッタ系） */
.card.card-hard-deadline:not(.completed),
.card.card-hard-expired:not(.completed) {
  border-left: 3px solid #D85B5B;
}
.card.card-hard-deadline:not(.completed) .deadline-badge,
.card.card-hard-expired:not(.completed) .deadline-badge {
  background: #D85B5B;
  color: #fff;
}

/* hard 期限切れ：グレーアウト＋チェック不可 */
.card.card-hard-expired:not(.completed) {
  opacity: 0.55;
  background: #F5F2ED;
}
.card.card-hard-expired:not(.completed) .check-btn {
  pointer-events: none;
  opacity: 0.4;
  cursor: not-allowed;
}
@media (prefers-color-scheme: dark) {
  .card.card-hard-expired:not(.completed) {
    background: #2A2520;
    opacity: 0.55;
  }
}

/* soft：くすんだ黄（マスタード） */
.card.card-soft-deadline:not(.completed) {
  border-left: 3px solid #E8B84F;
}
.card.card-soft-deadline:not(.completed) .deadline-badge,
.card.card-soft-expired:not(.completed) .deadline-badge {
  background: #F5DC9E;
  color: #8A6B1F;
}
/* soft 期限切れは border なし・グレーアウトなし・チェック可（通常表示＋黄バッジのみ） */
@media (prefers-color-scheme: dark) {
  .card.card-soft-deadline:not(.completed) .deadline-badge,
  .card.card-soft-expired:not(.completed) .deadline-badge {
    background: #4A3C20;
    color: #F5DC9E;
  }
}

/* 完了済みは全て上書き：badge 非表示・border 解除・通常背景は既存 sage 緑 */
.card.completed { border-left: 0; opacity: 1; }
.card.completed .deadline-badge { display: none; }

/* ===== Importance: optional（任意・チェック対象外） ===== */
/* 小さめ・薄め・インデント・チェックボックス非表示で控えめに表示 */
.card.card-optional {
  margin-left: 24px;
  padding: 10px 14px;
  background: rgba(251, 249, 244, 0.5);
  opacity: 0.85;
  border: 1px solid #EFEAE0;
  box-shadow: none;
}
@media (prefers-color-scheme: dark) {
  .card.card-optional {
    background: rgba(31, 27, 23, 0.6);
    border-color: rgba(220, 211, 197, 0.15);
  }
}
.card.card-optional .card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-mute);
}
.card.card-optional .card-subtitle {
  font-size: 11px;
}
.card.card-optional .card-deadline { font-size: 10px; }
.card.card-optional .deadline-badge { padding: 1px 8px; font-size: 10px; }
.card.card-optional .card-meta { gap: 4px; }
.card.card-optional .meta { font-size: 12px; }
.card.card-optional .card-details summary { font-size: 12px; }
/* optional は border-left（ハード/ソフトの色帯）も付けない（控えめにするため） */
.card.card-optional.card-hard-deadline,
.card.card-optional.card-soft-deadline,
.card.card-optional.card-hard-expired,
.card.card-optional.card-soft-expired {
  border-left: 1px solid #EFEAE0;
}

@media (max-width: 420px) {
  .card.card-optional { margin-left: 16px; padding: 9px 12px; }
}

/* ===== Expired section（タブ最下部の折りたたみ） ===== */
.expired-section {
  margin-top: 32px;
  padding: 0 0 8px;
  border-top: 1px dashed var(--line);
  padding-top: 16px;
}
.expired-toggle {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-family: var(--font-body);
  color: var(--ink-mute);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}
.expired-toggle:hover {
  background: var(--warm-greige-dim);
  color: var(--ink-soft);
}
.expired-chevron {
  display: inline-flex;
  transition: transform 0.3s ease;
  color: inherit;
}
.expired-toggle.expanded .expired-chevron {
  transform: rotate(180deg);
}
.expired-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 0;
}
.expired-content.expanded {
  max-height: 5000px;
  opacity: 1;
  margin-top: 12px;
}

/* ===== Money summary ===== */
.money-summary {
  background: linear-gradient(135deg, var(--terracotta), var(--dusty-pink));
  color: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  text-align: center;
  box-shadow: var(--shadow-strong);
}
.money-summary-label {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  opacity: 0.85;
}
.money-summary-total {
  margin: 6px 0 12px;
  font-size: 32px;
  font-weight: 700;
  font-family: 'DM Serif Display', serif;
  letter-spacing: 0.02em;
}
.money-summary-breakdown {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.money-pill {
  background: rgba(255,255,255,0.25);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.money-pill.received { background: rgba(168, 184, 154, 0.7); }

/* ===== Progress summary (prep tab) ===== */
.progress-summary {
  background: var(--warm-greige-dim);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.progress-label {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 500;
}
.progress-bar {
  background: var(--warm-greige);
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  background: var(--terracotta);
  height: 100%;
  transition: width 300ms ease;
}
.progress-count {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-mute);
  text-align: right;
}

/* ===== Timeline header ===== */
.timeline-header {
  background: var(--warm-greige-dim);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  text-align: center;
}
.timeline-label { margin: 0; font-size: 11px; color: var(--ink-mute); letter-spacing: 0.1em; }
.timeline-due {
  margin: 4px 0;
  font-size: 22px;
  font-weight: 700;
  font-family: 'DM Serif Display', serif;
  color: var(--terracotta);
}
.timeline-week { margin: 0; font-size: 13px; color: var(--ink-soft); }
.timeline-empty { margin: 0; font-size: 13px; color: var(--ink-mute); }

/* ===== Card detail content（構造化された詳細展開） ===== */
.detail-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}
.detail-section h4 {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--terracotta);
  letter-spacing: 0.06em;
}
.detail-section p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.detail-section ol,
.detail-section ul {
  margin: 0;
  padding-left: 1.2em;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.detail-section li { margin-bottom: 2px; }

.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.ai-ask-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--terracotta);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.ai-ask-btn:hover { background: var(--terracotta-light); }
.ai-ask-btn:active { transform: scale(0.96); }

/* ===== Related links（関連リンク・複数表示） ===== */
.related-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.related-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink-strong);
  font-family: var(--font-body);
  font-size: 14px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.related-link:hover {
  background: #FAF6EE;
  border-color: var(--terracotta);
  text-decoration: none;
}
@media (prefers-color-scheme: dark) {
  .related-link {
    background: var(--warm-greige-dim);
    color: var(--ink);
  }
  .related-link:hover {
    background: var(--warm-greige);
  }
}
.related-link-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  color: var(--ink-soft);
}
.related-link-label {
  flex: 1;
  text-align: left;
  line-height: 1.4;
  word-break: break-word;
}
.related-link-type {
  flex-shrink: 0;
  padding: 2px 8px;
  background: var(--warm-greige-dim);
  color: var(--ink-mute);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* タイプ別の色分け（クラス名に日本語が入るのは仕様通り） */
.related-link-公式 .related-link-type {
  background: #FDE9E1;
  color: #B5856B;
}
.related-link-公式 .related-link-icon { color: #B5856B; }

.related-link-病院 .related-link-type {
  background: #E8F0E5;
  color: #6B8B5F;
}
.related-link-病院 .related-link-icon { color: #6B8B5F; }

.related-link-商品 .related-link-type {
  background: #F5DC9E;
  color: #8A6B1F;
}
.related-link-商品 .related-link-icon { color: #8A6B1F; }

.related-link-資料 .related-link-type {
  background: #E5EBF0;
  color: #5F758B;
}
.related-link-資料 .related-link-icon { color: #5F758B; }

.related-link-その他 .related-link-icon { color: var(--ink-mute); }

@media (prefers-color-scheme: dark) {
  .related-link-公式 .related-link-type { background: #4A2E20; color: #E8B89A; }
  .related-link-病院 .related-link-type { background: #2E3A2A; color: #B0CC9A; }
  .related-link-商品 .related-link-type { background: #4A3C20; color: #F5DC9E; }
  .related-link-資料 .related-link-type { background: #2A3340; color: #B0C0D8; }
}

@media (max-width: 420px) {
  .related-link {
    font-size: 13px;
    padding: 9px 12px;
    gap: 10px;
  }
  .related-link-type { font-size: 10px; padding: 2px 6px; }
}

/* ===== AI質問モーダル ===== */
.ai-modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--offwhite);
  color: var(--ink);
  max-width: 460px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-strong);
}
.ai-modal::backdrop {
  background: rgba(0, 0, 0, 0.4);
}
.ai-modal-inner {
  padding: 24px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0;
  color: var(--ink-strong);
  font-weight: 400;
  letter-spacing: 0.02em;
}
.ai-input {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--warm-greige-dim);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
}
.ai-input:focus {
  outline: none;
  border-color: var(--terracotta);
}
.ai-submit-btn {
  align-self: flex-start;
  background: var(--terracotta);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}
.ai-submit-btn:hover { background: var(--terracotta-light); }
.ai-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ai-answer {
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
  min-height: 60px;
  word-break: break-word;
}
@media (prefers-color-scheme: dark) {
  .ai-answer {
    background: var(--warm-greige-dim);
    border-color: var(--line);
  }
}
.ai-answer:empty::before {
  content: '質問を入力して「質問する」を押してください';
  color: var(--ink-mute);
  font-style: italic;
}
.ai-answer.loading {
  color: var(--ink-mute);
  font-style: italic;
}
.ai-close-btn {
  align-self: flex-end;
  background: transparent;
  border: 1px solid var(--line);
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink-soft);
  font-size: 13px;
  transition: background 0.2s ease;
}
.ai-close-btn:hover { background: var(--warm-greige-dim); color: var(--ink); }

/* ===== Confirm dialog（チェック前の確認モーダル） ===== */
.confirm-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--offwhite);
  color: var(--ink);
  max-width: 360px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-strong);
  animation: confirm-pop 180ms ease;
}
.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}
.confirm-dialog-inner {
  padding: 24px 20px 20px;
  text-align: center;
}
.confirm-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.confirm-desc {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
  word-break: break-word;
}
.confirm-desc strong {
  color: var(--terracotta);
  font-weight: 700;
}
.confirm-actions {
  display: flex;
  gap: 8px;
}
.confirm-actions .btn-primary,
.confirm-actions .btn-secondary {
  flex: 1;
  max-width: none;
  padding: 12px 14px;
  font-size: 14px;
}
@keyframes confirm-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ===== Settings dialog ===== */
.settings-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--offwhite);
  color: var(--ink);
  max-width: 440px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-strong);
}
.settings-dialog::backdrop {
  background: rgba(58, 51, 44, 0.4);
}
.settings-form {
  padding: 24px;
}
.settings-form h2 {
  margin: 0 0 16px;
  font-size: 18px;
}
.setting-row {
  margin: 4px 0;
  font-size: 13px;
}
.setting-label {
  color: var(--ink-mute);
  margin-right: 6px;
}
.settings-form hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}
.settings-form label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 12px 0 4px;
  font-weight: 500;
}
.settings-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--warm-greige-dim);
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
}
.settings-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.settings-actions .btn-primary { flex: 1; max-width: none; }
.hint {
  font-size: 12px;
  color: var(--ink-mute);
  margin: 8px 0;
}
.settings-form details summary {
  font-size: 13px;
  color: var(--terracotta);
  cursor: pointer;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Splash screen ===== */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(135deg, var(--offwhite) 0%, var(--soft-blush) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: splashFadeOut 0.4s ease 0.8s forwards;
}
.splash-content {
  text-align: center;
  animation: splashContentIn 0.6s ease forwards;
}
.splash-icon {
  width: 72px;
  height: 72px;
  color: var(--terracotta);
  margin: 0 auto 16px;
  animation: heartBeat 1.2s ease infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}
.splash-icon .icon { width: 72px; height: 72px; }
.splash-title {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--ink-strong);
  letter-spacing: 0.02em;
  margin: 0;
  font-weight: 400;
}
.splash-subtitle {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: 16px;
  color: var(--ink-mute);
  margin: 4px 0 0;
  letter-spacing: 0.1em;
  font-weight: 400;
}
@keyframes splashContentIn {
  0%   { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes splashFadeOut {
  to { opacity: 0; visibility: hidden; }
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}

/* ===== Hero section ===== */
.hero {
  padding: 32px 24px 40px;
  background: linear-gradient(180deg, var(--offwhite) 0%, var(--warm-cream) 60%, var(--offwhite) 100%);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-illustration {
  width: 200px;
  height: 200px;
  margin: 0 auto 24px;
  opacity: 0;
  animation:
    heroFadeUp 0.6s ease 0.8s forwards,
    floatUp 4s ease-in-out 1.4s infinite;
}
.hero-illustration svg { width: 100%; height: 100%; display: block; }
@keyframes floatUp {
  0%, 100% { transform: translateY(0px) rotate(-2deg); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}

.hero-greeting {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: 18px;
  color: var(--accent-clay);
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  font-weight: 400;
  opacity: 0;
  animation: heroFadeUp 0.6s ease 1.0s forwards;
}

.hero-title {
  margin: 0 0 24px;
  opacity: 0;
  animation: heroFadeUp 0.6s ease 1.2s forwards;
}
.hero-title-en {
  display: block;
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.2;
  color: var(--ink-strong);
  letter-spacing: 0.01em;
  font-weight: 400;
}
.hero-title-en em {
  font-style: italic;
  font-family: var(--font-italic);
  color: var(--terracotta);
}
.hero-title-jp {
  display: block;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  margin-top: 8px;
  letter-spacing: 0.05em;
}

.hero-countdown {
  display: inline-block;
  padding: 16px 32px;
  background: linear-gradient(135deg, rgba(212,121,90,0.08) 0%, rgba(232,180,160,0.15) 100%);
  border: 1px solid rgba(212,121,90,0.2);
  border-radius: var(--radius-lg);
  opacity: 0;
  animation: heroFadeUp 0.6s ease 1.4s forwards;
}
.hero-countdown-label {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--ink-mute);
  text-transform: uppercase;
}
.hero-countdown-value {
  margin: 4px 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}
.hero-countdown-num {
  font-family: var(--font-display);
  font-size: 56px;
  color: var(--terracotta);
  line-height: 1;
  font-weight: 400;
}
.hero-countdown-unit {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: 18px;
  color: var(--accent-clay);
  font-weight: 400;
}
.hero-countdown-date {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: 0.1em;
  font-weight: 400;
}
@keyframes heroFadeUp {
  0%   { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ===== Today's highlight ===== */
.highlight {
  padding: 24px 24px 32px;
  background: var(--offwhite);
  opacity: 0;
  animation: heroFadeUp 0.6s ease 1.6s forwards;
}
.highlight-header {
  margin-bottom: 16px;
  text-align: center;
}
.highlight-eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--terracotta);
  font-weight: 700;
  margin-bottom: 4px;
}
.highlight-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink-strong);
  margin: 0;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.highlight-progress {
  background: var(--warm-greige-dim);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.highlight-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  font-weight: 500;
}
.highlight-progress-value {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--terracotta);
  letter-spacing: 0.04em;
}
.highlight-progress-bar {
  background: var(--warm-greige);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}
.highlight-progress-fill {
  background: linear-gradient(90deg, var(--terracotta) 0%, var(--dusty-pink) 100%);
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.highlight-urgent {
  margin-bottom: 16px;
}
.highlight-urgent-label {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #D85B5B;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.highlight-urgent-content { min-height: 32px; }
/* タスクタブと同じ cardHTML をそのまま使うため、追加のラッパーは不要。
   フェードトランジション用クラスだけ仕込む。 */
.highlight-urgent-content .card {
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.highlight-urgent-content .card.fade-out {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}
.highlight-urgent-content .card.fade-in {
  animation: highlightFadeInUp 0.4s ease;
}
@keyframes highlightFadeInUp {
  0%   { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.highlight-urgent-empty {
  font-size: 13px;
  color: var(--ink-mute);
  margin: 0;
  padding: 16px 0;
  text-align: center;
  font-style: italic;
}

.highlight-cta {
  display: block;
  width: 100%;
  background: var(--ink-strong);
  color: var(--offwhite);
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 14px 28px;
  border: none;
  border-radius: 100px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.highlight-cta:hover {
  background: var(--ink);
  box-shadow: 0 4px 20px rgba(212,121,90,0.2);
}
.highlight-cta:active {
  transform: scale(0.96);
  box-shadow: 0 0 20px rgba(212,121,90,0.3);
}

/* ===== Button micro-interactions ===== */
.check-btn {
  transition: transform 0.15s ease, border-color 150ms, background 150ms, color 150ms;
}
.check-btn:active:not(:disabled) {
  transform: scale(0.85);
}
.check-btn.is-checked {
  animation: checkPop 0.3s ease;
}
@keyframes checkPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ===== Mobile optimization ===== */
@media (max-width: 420px) {
  #tab-content { padding: 12px 12px 16px; }
  .card { padding: 12px; }
  .card-title { font-size: 15px; }
  .money-summary-total { font-size: 28px; }
  .tab { padding: 7px 12px; font-size: 12.5px; }
  .bnav-item { font-size: 10.5px; }
  .hero { padding: 28px 20px 36px; }
  .hero-illustration { width: 180px; height: 180px; }
  .hero-title-en { font-size: 32px; }
  .hero-countdown-num { font-size: 48px; }
  .highlight { padding: 20px 20px 28px; }
}
