/* V0.14 layer (loaded after v131.css): 今日安排分區、目標追蹤、完成行程並記錄成果、個人成長首屏與足跡、⋯ 管理選單。
   Same palette as V0.11: deep blue, light blue, coral, warm white. Motion is short, functional and fully disabled by
   prefers-reduced-motion. States never rely on colour alone (text + symbol). */

/* ---------- 今日安排：行程與任務分區 ---------- */
.v14-sub { margin-top: 10px; }
.v14-sub + .v14-sub { border-top: 1px solid var(--line); padding-top: 10px; }
.v14-sub h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; font-size: .95rem; color: var(--ink-2); }
.v14-count { min-width: 24px; padding: 0 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: .8rem; line-height: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.v14-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.v14-item > .v13-row { flex: 1 1 auto; min-width: 0; }
.v14-item-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.v14-side { min-height: 36px; padding: 0 12px; white-space: nowrap; }
.v14-pill-ok { background: var(--ok-bg); color: var(--ok-ink); }
.v14-pill-plan { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line-strong); }
.v14-pill-ok::before { content: "✓ "; }
@media (max-width: 520px) {
  .v14-item { flex-wrap: wrap; }
  .v14-item-meta { flex-direction: row; width: 100%; justify-content: flex-end; padding-bottom: 6px; }
}

/* ---------- 首頁「目標追蹤」 ---------- */
.v14-goal-track { margin-top: var(--gap); }
.v14-goal { position: relative; padding: 10px 0; }
.v14-goal + .v14-goal { border-top: 1px solid var(--line); }
.v14-goal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; min-width: 0; }
.v14-goal-head strong { overflow-wrap: anywhere; }
.v14-goal-head b { font-variant-numeric: tabular-nums; color: var(--brand); white-space: nowrap; }
.v14-goal .progress { margin: 8px 0 4px; }
.v14-goal .progress > span { transition: width .55s var(--ease); background: var(--action); }
.v14-goal.is-achieved .progress > span { background: var(--brand); }
.v14-goal.is-achieved .v14-goal-head b::after { content: " ✓"; }
.v14-facts { margin-top: 6px; }
.v14-lead { color: var(--ink-2); line-height: 1.6; margin: 6px 0 10px; }

/* ---------- 完成行程並記錄成果 ---------- */
.v14-report-head { padding: 10px 12px; margin-bottom: 12px; border-radius: var(--r-ctl); background: var(--brand-soft); }
.v14-report-head p { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.v14-report { display: grid; gap: 12px; }
.v14-report fieldset { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 10px 12px; margin: 0; min-width: 0; }
.v14-times { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.v14-times legend, .v14-done legend { font-weight: 650; color: var(--ink-2); padding: 0 4px; }
.v14-times input { width: 100%; min-width: 0; }
.v14-effective { grid-column: 1 / -1; margin: 0; font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
.v14-pick { display: flex; gap: 8px; align-items: flex-start; min-height: var(--tap); padding: 6px 0; }
.v14-pick small { color: var(--muted-2); }
.v14-sub-pick { padding-left: 26px; min-height: 36px; }
.v14-growth-toggle small { display: block; color: var(--muted-2); font-weight: 400; }
.v14-advanced { border-top: 1px dashed var(--line); padding-top: 8px; }
.v14-advanced summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; color: var(--muted); }
.v14-advanced label { display: block; margin-top: 8px; }
.v14-note { padding: 10px 12px; border-radius: var(--r-ctl); background: var(--warn-bg); color: var(--warn-ink); margin: 8px 0; }
.v14-note ul { margin: 6px 0; padding-left: 20px; }
.warning-text { color: var(--warn-ink); }
.v14-review { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.v14-review li { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); }
.v14-review small { color: var(--muted); }
.v14-impact { margin: 6px 0 10px; padding-left: 20px; }
.v14-pick-list { display: grid; gap: 6px; margin-top: 8px; }
button.danger, .v14-sheet-item.danger { color: var(--danger-ink); }
button.danger:not(.v14-sheet-item) { background: var(--danger-bg); border: 1px solid #F2C4B5; }

/* ---------- 個人成長 ---------- */
.v14-growth { display: grid; gap: var(--gap); }
.v14-growth[aria-busy="true"] { opacity: .7; }
.v14-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.v14-toolbar label { min-width: 0; display: grid; gap: 4px; }
.v14-toolbar input[type=date] { min-width: 150px; }
@media (max-width: 520px) { .v14-toolbar label { flex: 1 1 100%; } .v14-toolbar input[type=date] { width: 100%; } }
.v14-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.v14-seg button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); }
.v14-seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.v14-reminder { border-left: 4px solid var(--action); background: var(--action-soft); }
.v14-reminder p { margin: 0 0 6px; }
.v14-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.v14-stat { display: grid; gap: 4px; align-content: start; min-width: 0; position: relative; }
.v14-stat > small:first-child { color: var(--muted); font-weight: 600; }
.v14-stat strong { font-size: 1.9rem; line-height: 1.15; color: var(--brand); font-variant-numeric: tabular-nums; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.v14-stat strong .unit { font-size: .85rem; color: var(--muted); font-weight: 600; }
.v14-stat small { color: var(--muted-2); overflow-wrap: anywhere; }
.v14-pending { color: var(--action-ink) !important; font-weight: 600; }
.v14-step { margin: 0; padding: 12px 16px; border-radius: var(--r-card); background: var(--warm); border: 1px solid #F6E3D8; line-height: 1.6; }
.v14-step span { display: inline-block; margin-right: 8px; padding: 0 10px; border-radius: 999px; background: var(--action); color: #fff; font-size: .8rem; font-weight: 650; }
@media (max-width: 760px) { .v14-stats { grid-template-columns: 1fr; } .v14-stat strong { font-size: 1.6rem; } }

.v14-cells { display: grid; gap: 6px; margin: 6px 0; }
.v14-cells-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.v14-cells-30 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
@media (max-width: 520px) { .v14-cells-30 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.v14-cell { position: relative; min-height: var(--tap); min-width: 0; padding: 4px 2px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; gap: 0; font-variant-numeric: tabular-nums; transition: background-color .3s var(--ease), border-color .3s var(--ease), transform .2s var(--ease); }
.v14-cells-7 .v14-cell { min-height: 58px; }
.v14-cell-day { display: grid; place-items: center; line-height: 1.15; font-size: .78rem; }
.v14-cell-day b { font-size: 1rem; color: var(--ink); }
.v14-cell i { font-style: normal; font-size: .55rem; color: var(--action); line-height: 1; }
.v14-cell.is-lit { background: var(--action-soft); border-color: #F7C5B5; color: var(--action-ink); }
.v14-cell.is-today { border-width: 2px; border-color: var(--brand); }
.v14-cell.is-selected { box-shadow: 0 0 0 3px var(--sky-soft); }
.v14-cell:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.v14-facts-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.v14-facts-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.v14-facts-list li:last-child { border-bottom: 0; }
.v14-facts-list strong { display: block; overflow-wrap: anywhere; }
.v14-facts-list small { color: var(--muted); }
.v14-facts-list details summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.v14-done-mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: .85rem; }
.v14-goal-actions { margin-top: -4px; }
.v14-cta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.v14-cta-grid button { min-height: var(--tap); }
.v14-empty { text-align: left; }
.v14-analysis > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; min-height: var(--tap); }
.v14-analysis > summary::-webkit-details-marker { display: none; }
.v14-analysis > summary h2 { margin: 0; }
.v14-analysis > summary::after { content: "展開 ▾"; margin-left: auto; color: var(--muted); font-size: .85rem; }
.v14-analysis[open] > summary::after { content: "收合 ▴"; }
.v14-chart { min-width: 0; }
.v14-rules { margin: 0; }
.v14-relink-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.v14-relink-list { max-height: 45vh; overflow: auto; }

/* ---------- ⋯ 管理選單 ---------- */
.v14-head-actions { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.v14-more { min-width: var(--tap); min-height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 1.1rem; line-height: 1; letter-spacing: 1px; }
.v14-more:hover { background: var(--surface-2); }
.v14-sheet { width: min(420px, calc(100vw - 32px)); max-height: min(80vh, 640px); padding: 0; border: 0; border-radius: var(--r-card); box-shadow: var(--shadow-lift); }
.v14-sheet::backdrop { background: #1F3A5F55; }
.v14-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 6px; }
.v14-sheet-head h2 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.v14-sheet-close { min-width: var(--tap); min-height: var(--tap); border: 0; background: transparent; font-size: 1.4rem; color: var(--muted); }
.v14-sheet-list { display: grid; padding: 4px 8px 12px; }
.v14-sheet-item, .v14-sheet-item.danger { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 48px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; text-align: left; font-size: 1rem; color: var(--ink); box-shadow: none; }
.v14-sheet-item.danger { color: var(--danger-ink); }
.v14-sheet-item:hover, .v14-sheet-item:focus-visible { background: var(--brand-soft); }
@media (max-width: 900px) {
  /* Bottom sheet above the fixed bottom navigation and clear of the right-side quick index and back gesture. */
  .v14-sheet { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 20px 20px 0 0; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}

/* ---------- functional motion (one-off, after a confirmed result) ---------- */
.v14-bump { animation: v14-bump .5s var(--ease) 1; }
.v14-pop { animation: v14-pop .6s var(--ease) 1; }
.v14-fade { animation: v14-fade .25s var(--ease) 1; }
.v14-achieved-pop { animation: v14-bump .6s var(--ease) 1; }
@keyframes v14-bump { 0% { transform: scale(1); } 40% { transform: scale(1.03); } 100% { transform: scale(1); } }
@keyframes v14-pop { 0% { background: var(--surface); transform: scale(.92); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes v14-fade { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.v14-spark { position: absolute; left: 50%; top: 40%; width: 0; height: 0; pointer-events: none; z-index: 2; }
.v14-spark i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--action); opacity: 0; animation: v14-spark .65s var(--ease) 1 forwards; transform: rotate(var(--a)) translateX(0); }
.v14-spark i:nth-child(3n) { background: var(--sky); }
@keyframes v14-spark { 0% { opacity: 1; transform: rotate(var(--a)) translateX(0) scale(1); } 100% { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) scale(.4); } }
@media (prefers-reduced-motion: reduce) {
  .v14-bump, .v14-pop, .v14-fade, .v14-achieved-pop { animation: none !important; }
  .v14-spark { display: none !important; }
  .v14-goal .progress > span, .v14-cell { transition: none !important; }
}
