/* ==========================================================================
   ご縁ボード デザインシステム v2 — "未来の和モダン"
   ブランド: 深緑 #0e5c31 × 金 #c9a227 × LINEグリーン #06c755
   方針: ガラス質のレイヤー・金のヘアライン・ドットグリッドの奥行き。
         紫系ホログラム（AIクリシェ）は使わない。動きは軽く、触って楽しく。
   ========================================================================== */

:root {
  --green: #0e5c31;
  --green-2: #12924c;
  --green-3: #29b866;
  --green-soft: rgba(18, 146, 76, .10);
  --gold: #c9a227;
  --gold-2: #e6c65a;
  --gold-soft: rgba(201, 162, 39, .12);
  --line-green: #06c755;

  --bg: #eef2ec;
  --card: rgba(255, 255, 255, .92);
  --card-solid: #ffffff;
  --glass: rgba(255, 255, 255, .68);
  --text: #16211a;
  --text-2: #61705f;
  --text-3: #94a394;
  --border: rgba(20, 60, 35, .10);
  --hairline: linear-gradient(90deg, transparent, rgba(18,146,76,.4), rgba(201,162,39,.5), transparent);
  --overlay: rgba(12, 24, 16, .48);
  --dot: rgba(14, 92, 49, .07);

  --red: #c7452e;
  --blue: #1f6feb;

  --st-inbox: #8a94a6;
  --st-todo: #5b7c99;
  --st-doing: #c9a227;
  --st-done: #12924c;

  --shadow-1: 0 1px 2px rgba(16, 42, 25, .05), 0 3px 10px rgba(16, 42, 25, .06);
  --shadow-2: 0 4px 12px rgba(16, 42, 25, .10), 0 14px 40px rgba(16, 42, 25, .14);
  --glow-green: 0 0 18px rgba(18, 146, 76, .35);
  --glow-gold: 0 0 14px rgba(201, 162, 39, .45);

  --radius: 18px;
  --radius-s: 14px;
  --nav-h: 76px;   /* フローティングドック(60px)＋浮かせ分 */
  --appbar-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --spring: cubic-bezier(.32, 1.25, .38, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a100b;
    --card: rgba(24, 34, 27, .92);
    --card-solid: #18221b;
    --glass: rgba(20, 30, 23, .62);
    --text: #e9efe9;
    --text-2: #9fb1a1;
    --text-3: #66766a;
    --border: rgba(140, 200, 160, .12);
    --overlay: rgba(0, 0, 0, .62);
    --dot: rgba(110, 180, 140, .07);
    --green-soft: rgba(18, 146, 76, .18);
    --gold-soft: rgba(201, 162, 39, .16);
    --st-inbox: #7d8798;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35), 0 3px 12px rgba(0, 0, 0, .3);
    --shadow-2: 0 6px 16px rgba(0, 0, 0, .45), 0 18px 48px rgba(0, 0, 0, .5);
  }
}

/* ---------- リセット・ベース ---------- */

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

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  overscroll-behavior-y: none;
  position: relative;
}

/* 奥行きレイヤー: グラデーションメッシュ＋ドットグリッド */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(58% 42% at 12% -6%, rgba(18, 146, 76, .13), transparent 62%),
    radial-gradient(46% 36% at 108% 10%, rgba(201, 162, 39, .14), transparent 60%),
    radial-gradient(70% 50% at 50% 115%, rgba(14, 92, 49, .09), transparent 55%),
    radial-gradient(circle, var(--dot) 1px, transparent 1.3px);
  background-size: auto, auto, auto, 23px 23px;
}
@media (prefers-color-scheme: dark) {
  body::before {
    background:
      radial-gradient(60% 44% at 10% -8%, rgba(18, 146, 76, .28), transparent 62%),
      radial-gradient(48% 38% at 110% 8%, rgba(201, 162, 39, .16), transparent 60%),
      radial-gradient(70% 50% at 50% 118%, rgba(18, 146, 76, .12), transparent 55%),
      radial-gradient(circle, var(--dot) 1px, transparent 1.3px);
    background-size: auto, auto, auto, 23px 23px;
  }
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
a { color: var(--green-2); text-decoration: none; }
img { max-width: 100%; }

/* グラデーション文字（大きな数字・見出しの強調） */
.grad-num {
  background: linear-gradient(118deg, var(--green-3), var(--green-2) 40%, var(--gold));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- アプリバー ---------- */

.appbar {
  position: sticky; top: 0; z-index: 40;
  height: calc(var(--appbar-h) + var(--safe-t));
  padding-top: var(--safe-t);
  display: flex; align-items: center; gap: 8px;
  padding-left: 16px; padding-right: 8px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}
.appbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--hairline); opacity: .5;
}
.appbar__title {
  font-size: 19px; font-weight: 800; letter-spacing: .02em;
  display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0;
}
.appbar__title .accent {
  width: 4px; height: 19px; border-radius: 2px; flex: none;
  background: linear-gradient(180deg, var(--gold-2), var(--gold), var(--green-2));
  background-size: 100% 220%;
  animation: accentFlow 5s ease-in-out infinite alternate;
  box-shadow: var(--glow-gold);
}
@keyframes accentFlow { from { background-position: 0 0; } to { background-position: 0 100%; } }
.appbar__btn {
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center; color: var(--text-2); flex: none;
  transition: transform .12s;
}
.appbar__btn:active { transform: scale(.9); background: var(--green-soft); }
.appbar__btn svg { width: 23px; height: 23px; }

/* ---------- 下部ナビ = フローティングドック ---------- */

.tabbar {
  position: fixed; left: 14px; right: 14px;
  bottom: calc(var(--safe-b) + 12px);
  z-index: 50;
  height: 62px;
  display: flex;
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-2);
  padding: 6px;
  gap: 4px;
}
.tabbar__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-3); font-size: 10px; font-weight: 700;
  border-radius: 17px;
  transition: color .18s, background .18s, transform .18s var(--spring);
  position: relative;
}
.tabbar__item svg { width: 23px; height: 23px; }
.tabbar__item:active { transform: scale(.92); }
.tabbar__item.is-active {
  color: var(--green-2);
  background: linear-gradient(160deg, var(--green-soft), var(--gold-soft));
}
.tabbar__item.is-active::after {
  content: ''; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%;
  background: var(--gold); box-shadow: var(--glow-gold);
}

/* ---------- ドロワー ---------- */

.drawer-overlay {
  position: fixed; inset: 0; z-index: 90; background: var(--overlay);
  opacity: 0; pointer-events: none; transition: opacity .22s;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; top: 10px; right: 10px; bottom: calc(var(--safe-b) + 10px); z-index: 91;
  width: min(78vw, 300px);
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 24px;
  transform: translateX(110%); transition: transform .3s var(--spring);
  display: flex; flex-direction: column;
  padding: calc(var(--safe-t) + 14px) 0 16px;
  box-shadow: var(--shadow-2);
}
.drawer.is-open { transform: translateX(0); }
.drawer-overlay.is-open { opacity: 1; pointer-events: auto; }
.drawer__brand { padding: 6px 22px 15px; margin-bottom: 8px; position: relative; }
.drawer__brand::after { content: ''; position: absolute; left: 18px; right: 18px; bottom: 0; height: 1px; background: var(--hairline); }
.drawer__brand b { font-size: 17px; }
.drawer__brand span { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.drawer__item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; font-size: 15px; font-weight: 600; color: var(--text);
  width: 100%; text-align: left; border-radius: 14px; margin: 0 6px; width: calc(100% - 12px);
  transition: background .15s;
}
.drawer__item:active { background: var(--green-soft); }
.drawer__item svg { width: 21px; height: 21px; color: var(--green-2); flex: none; }
.drawer__item .sub { font-size: 11px; color: var(--text-3); font-weight: 400; display: block; }
.drawer__foot { margin-top: auto; padding: 14px 22px 0; font-size: 11px; color: var(--text-3); }

/* ---------- カード・チップ ---------- */

.card {
  background: var(--card); border-radius: var(--radius-s);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1); padding: 12px 14px;
}

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; line-height: 1;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
  transition: transform .12s;
}
.chip:active { transform: scale(.94); }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
.pill svg { width: 13px; height: 13px; }
.pill.is-over { color: var(--red); font-weight: 700; }
.pill.is-today { color: var(--gold); font-weight: 700; }

.pri { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pri--高 { background: var(--red); box-shadow: 0 0 6px rgba(199, 69, 46, .5); }
.pri--中 { background: var(--gold); }
.pri--低 { background: var(--text-3); }

/* ---------- ボタン ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 20px; border-radius: 14px;
  font-size: 15px; font-weight: 700;
  transition: transform .14s var(--spring), box-shadow .2s, opacity .15s;
}
.btn:active { transform: scale(.96); }
.btn--primary {
  background: linear-gradient(135deg, var(--green-3), var(--green-2) 45%, var(--green));
  color: #fff;
  box-shadow: 0 6px 16px rgba(14, 92, 49, .3), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn--line { background: var(--line-green); color: #fff; box-shadow: 0 6px 16px rgba(6, 199, 85, .3); }
.btn--ghost { background: var(--green-soft); color: var(--green-2); border: 1px solid rgba(18, 146, 76, .18); }
.btn--danger { background: transparent; color: var(--red); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.fab {
  position: fixed; right: 18px;
  bottom: calc(var(--nav-h) + var(--safe-b) + 14px);
  z-index: 45;
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green-3), var(--green-2) 45%, var(--green));
  color: #fff;
  box-shadow: 0 0 0 2px rgba(201, 162, 39, .5), 0 10px 26px rgba(14, 92, 49, .4), inset 0 1px 0 rgba(255, 255, 255, .25);
  display: grid; place-items: center;
  transition: transform .18s var(--spring), box-shadow .2s;
}
.fab:active { transform: scale(.88) rotate(90deg); box-shadow: 0 0 0 5px rgba(201, 162, 39, .35), var(--glow-green); }
.fab svg { width: 26px; height: 26px; transition: transform .18s; }

/* ---------- フォーム ---------- */

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; letter-spacing: .02em; }
.input, .textarea, .select {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-s);
  background: var(--card-solid); font-size: 16px; /* 16px以上でiOSズーム防止 */
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--green-2);
  box-shadow: 0 0 0 3px rgba(18, 146, 76, .14);
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }

.seg { display: flex; background: rgba(20, 60, 35, .06); border-radius: var(--radius-s); padding: 3px; gap: 3px; }
@media (prefers-color-scheme: dark) { .seg { background: rgba(0, 0, 0, .3); } }
.seg__btn {
  flex: 1; min-height: 40px; border-radius: 11px;
  font-size: 13px; font-weight: 700; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: all .18s var(--spring);
}
.seg__btn.is-on { background: var(--card-solid); color: var(--text); box-shadow: var(--shadow-1); transform: scale(1.02); }
.seg__dot { width: 8px; height: 8px; border-radius: 50%; }

.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.chiprow .chip { min-height: 34px; padding: 0 13px; font-size: 12.5px; border: 1.5px solid transparent; }
.chiprow .chip:not(.is-on) { background: rgba(20, 60, 35, .06) !important; color: var(--text-2) !important; }
@media (prefers-color-scheme: dark) { .chiprow .chip:not(.is-on) { background: rgba(255, 255, 255, .07) !important; } }
.chiprow .chip.is-on { box-shadow: 0 0 0 1.5px currentColor inset; }
.chiprow .chip--new { border: 1.5px dashed var(--border) !important; background: transparent !important; color: var(--text-3) !important; }

/* 新規追加のインライン入力行（タグ・案件 共通） */
.tagnew { display: flex; gap: 8px; margin-top: 8px; }
.tagnew .input { min-height: 42px; flex: 1; }
.tagnew .btn { min-height: 42px; padding: 0 16px; flex: none; }

/* ---------- ボトムシート ---------- */

.sheet-overlay {
  position: fixed; inset: 0; z-index: 80; background: var(--overlay);
  opacity: 0; pointer-events: none; transition: opacity .2s;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.sheet-overlay.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81;
  background: var(--card-solid);
  border-radius: 26px 26px 0 0;
  border-top: 1px solid var(--border);
  transform: translateY(105%); transition: transform .34s var(--spring);
  max-height: 88vh; display: flex; flex-direction: column;
  padding-bottom: calc(var(--safe-b) + 12px);
  box-shadow: var(--shadow-2);
}
.sheet::before {
  content: ''; position: absolute; top: 0; left: 24px; right: 24px; height: 1px;
  background: var(--hairline); opacity: .6;
}
.sheet.is-open { transform: translateY(0); }
.sheet__grip { width: 42px; height: 4px; border-radius: 2px; background: var(--border); margin: 10px auto 4px; flex: none; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 6px 20px 10px; flex: none; }
.sheet__title { font-size: 17px; font-weight: 800; }
.sheet__body { overflow-y: auto; padding: 4px 20px 16px; -webkit-overflow-scrolling: touch; }
.sheet__foot { flex: none; padding: 12px 20px 0; display: flex; gap: 10px; border-top: 1px solid var(--border); }

/* ---------- トースト ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 18px); z-index: 99;
  transform: translate(-50%, 20px) scale(.95); opacity: 0;
  background: linear-gradient(135deg, #133d24, #0e2b1a);
  color: #ecf3ec;
  border: 1px solid rgba(201, 162, 39, .4);
  font-size: 13.5px; font-weight: 600;
  padding: 12px 20px; border-radius: 999px;
  box-shadow: var(--shadow-2), var(--glow-green);
  transition: transform .28s var(--spring), opacity .2s;
  max-width: 86vw; text-align: center;
  pointer-events: none;
}
.toast.is-show { transform: translate(-50%, 0) scale(1); opacity: 1; }

/* ---------- スケルトン・空状態 ---------- */

.skel { border-radius: var(--radius-s); background: linear-gradient(100deg, var(--border) 40%, color-mix(in srgb, var(--border) 40%, var(--card-solid)) 50%, var(--border) 60%); background-size: 200% 100%; animation: skel 1.3s infinite linear; }
@keyframes skel { from { background-position: 120% 0; } to { background-position: -80% 0; } }

.empty { text-align: center; padding: 44px 24px; color: var(--text-3); }
.empty svg { width: 56px; height: 56px; margin-bottom: 10px; color: var(--border); }
.empty b { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 3px; }
.empty span { font-size: 12.5px; }

/* ---------- 起動画面 ---------- */

.boot {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 32px; text-align: center;
}
.boot__logo {
  width: 80px; height: 80px; border-radius: 24px;
  background: linear-gradient(135deg, var(--green-3), var(--green-2) 45%, var(--green));
  display: grid; place-items: center; color: #fff;
  font-size: 36px; font-weight: 800;
  box-shadow: 0 0 0 2px rgba(201, 162, 39, .5), var(--shadow-2), var(--glow-green);
  position: relative;
  animation: bootFloat 3s ease-in-out infinite alternate;
}
@keyframes bootFloat { from { transform: translateY(-3px); } to { transform: translateY(3px); } }
.boot__name { font-size: 21px; font-weight: 800; letter-spacing: .06em; }
.boot__sub { font-size: 13px; color: var(--text-2); margin-top: -10px; }
.boot .spinner { width: 26px; height: 26px; border: 3px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s infinite linear; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- タスクカード ---------- */

.task {
  background: var(--card); border-radius: var(--radius-s);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  padding: 11px 13px 10px;
  display: flex; gap: 11px; align-items: flex-start;
  position: relative;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  transition: transform .15s var(--spring), box-shadow .15s, opacity .2s;
  animation: cardIn .32s var(--spring) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.tasklist .task:nth-child(2), .col__list .task:nth-child(2) { animation-delay: .04s; }
.tasklist .task:nth-child(3), .col__list .task:nth-child(3) { animation-delay: .08s; }
.tasklist .task:nth-child(4), .col__list .task:nth-child(4) { animation-delay: .12s; }
.tasklist .task:nth-child(5), .col__list .task:nth-child(5) { animation-delay: .16s; }
.tasklist .task:nth-child(n+6), .col__list .task:nth-child(n+6) { animation-delay: .2s; }

.task__check {
  width: 27px; height: 27px; border-radius: 50%; flex: none; margin-top: 1px;
  border: 2px solid var(--border);
  display: grid; place-items: center; color: transparent;
  transition: all .2s var(--spring);
  background: var(--card-solid);
}
.task__check svg { width: 15px; height: 15px; }
.task__check:active { transform: scale(.85); border-color: var(--green-2); }
.task__check.is-done {
  background: linear-gradient(135deg, var(--green-3), var(--st-done));
  border-color: var(--st-done); color: #fff;
  box-shadow: var(--glow-green);
}
.task__main { flex: 1; min-width: 0; }
.task__title { font-size: 14.5px; font-weight: 600; line-height: 1.4; word-break: break-word; }
.task.is-done-style .task__title { color: var(--text-3); text-decoration: line-through; }
.task__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
.task.is-dragging { opacity: .3; }

.ghost {
  position: fixed; z-index: 95; pointer-events: none;
  transform: rotate(2.5deg) scale(1.05);
  box-shadow: var(--shadow-2), var(--glow-green);
  opacity: .96;
  animation: none;
}

@keyframes donePop {
  0% { transform: scale(1); }
  45% { transform: scale(1.25) rotate(8deg); }
  100% { transform: scale(1); }
}
.task__check.anim { animation: donePop .4s var(--spring); }
@keyframes taskOut {
  to { opacity: 0; transform: translateX(30px) scale(.96); height: 0; margin: 0; padding-top: 0; padding-bottom: 0; }
}
.task.anim-out { animation: taskOut .4s ease .3s forwards; overflow: hidden; }

/* 完了パーティクル */
.spark {
  position: fixed; z-index: 130; pointer-events: none;
  width: 7px; height: 7px; border-radius: 2px;
}

/* ---------- ユーティリティ ---------- */

.container { padding: 4px 16px 16px; max-width: 640px; margin: 0 auto; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.muted { color: var(--text-2); font-size: 12.5px; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 800; color: var(--text-2);
  margin: 22px 0 10px; letter-spacing: .03em;
}
.section-title .count {
  background: linear-gradient(135deg, var(--green-soft), var(--gold-soft));
  color: var(--green-2);
  border-radius: 999px; font-size: 11px; padding: 1px 9px;
  border: 1px solid rgba(18, 146, 76, .15);
}
.hidden { display: none !important; }
