/* ============================================================
   PayAI NEXT — 会話型・段階表示フォーム (conversational form)
   ひとつずつ。入力が終わると次が「スッ」と下から現れる。
   自動入力は「入力してください」ではなく「確認してください」。
   ============================================================ */
:root { --cf-ease-pop: cubic-bezier(.34, 1.56, .64, 1); }

.cf-wrap {
  min-height: 100vh;
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(20px, 6vh, 64px) 18px 80px;
  background:
    radial-gradient(1100px 520px at 50% -8%, var(--acc-soft), transparent 70%),
    var(--bg-0);
  font-family: var(--font-jp);
}

.cf-card {
  width: 100%; max-width: 540px;
  background: var(--bg-card);
  border: 1px solid var(--bd-2);
  border-radius: var(--radius-xl);
  box-shadow: 0 40px 90px -50px rgba(0,0,0,0.55), 0 2px 0 rgba(255,255,255,0.03) inset;
  padding: 26px 26px 20px;
  display: flex; flex-direction: column;
}

/* ---------- header ---------- */
.cf-head { display: flex; align-items: center; gap: 13px; }
.cf-head-logo {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 12px;
  background: var(--acc-soft); border: 1px solid var(--acc-line);
  color: var(--acc); display: grid; place-items: center; font-size: 22px;
}
.cf-head-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.cf-head-eyebrow { font-size: 11px; font-weight: 600; color: var(--text-2); letter-spacing: 0.02em; }
.cf-head-title { font-size: 16px; font-weight: 700; color: var(--text-0); }
.cf-head-amt {
  flex-shrink: 0; font-family: var(--font-sans); font-weight: 800;
  font-size: 20px; color: var(--text-0); letter-spacing: -0.01em;
  display: inline-flex; align-items: baseline; gap: 2px;
}
.cf-head-amt .freq { font-family: var(--font-jp); font-size: 10.5px; font-weight: 700; color: var(--acc); background: var(--acc-soft); border: 1px solid var(--acc-line); padding: 2px 7px; border-radius: 999px; margin-right: 5px; align-self: center; white-space: nowrap; }
.cf-head-amt .y { font-size: 14px; font-weight: 700; }

/* ---------- progress hairline ---------- */
.cf-progress {
  height: 3px; border-radius: 999px; background: var(--bd-1);
  margin: 18px 0 8px; overflow: hidden;
}
.cf-progress span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--acc), var(--acc-2));
  border-radius: 999px;
  transition: width 0.5s var(--ease-out);
}

/* ============================================================
   STACK + ROWS
   ============================================================ */
.cf-stack { display: flex; flex-direction: column; }

.cf-row { display: block; }
.cf-row.is-pending { display: none; }

/* reveal: 下から「スッ」と (transform-only → 常に見える) */
@media (prefers-reduced-motion: no-preference) {
  .cf-row.is-revealing { animation: cfReveal 0.34s var(--ease-out); }
}
@keyframes cfReveal {
  from { transform: translateY(14px); }
  to   { transform: none; }
}
@keyframes cfFadeRise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- DONE (collapsed, confirmed) ---------- */
.cf-done {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.16s var(--ease-out), border-color 0.16s var(--ease-out);
}
.cf-done:hover { background: var(--bg-card-2); border-color: var(--bd-2); }
.cf-done:active { transform: scale(0.99); }
.cf-done-check {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%;
  background: var(--acc); color: #fff;
  display: grid; place-items: center; font-size: 14px;
}
.cf-done-check.is-pop { animation: cfPop 0.32s var(--cf-ease-pop) both; }
@keyframes cfPop { 0%{transform:scale(0.3)} 60%{transform:scale(1.18)} 100%{transform:scale(1)} }
.cf-done-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cf-done-lab { font-size: 10.5px; font-weight: 600; color: var(--text-2); }
.cf-done-val {
  font-size: 15px; font-weight: 600; color: var(--text-0);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cf-done-edit {
  flex-shrink: 0; font-size: 11.5px; font-weight: 600; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 9px; border-radius: 999px;
}
.cf-done:hover .cf-done-edit { color: var(--acc); }
.cf-done-edit i { font-size: 14px; }

/* ---------- ACTIVE field ---------- */
.cf-field { padding: 14px 2px 16px; }
.cf-field-top {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 9px; min-height: 22px; flex-wrap: wrap;
}
.cf-field-lab { font-size: 15px; font-weight: 700; color: var(--text-0); }
.cf-field .req { font-size: 10px; font-weight: 700; color: var(--acc); background: var(--acc-soft); border: 1px solid var(--acc-line); padding: 1px 7px; border-radius: 999px; white-space: nowrap; }

/* the AI auto-fill badge — appears on derived fields */
.cf-auto-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; color: var(--acc);
  background: var(--acc-soft); border: 1px solid var(--acc-line);
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.cf-auto-tag i { font-size: 13px; }

/* confirm prompt — 「○○を確認してください」 */
.cf-prompt {
  font-size: 13px; color: var(--text-1); margin: 0 0 9px;
  display: flex; align-items: center; gap: 6px;
}
.cf-prompt b { color: var(--text-0); font-weight: 700; }
.cf-prompt i { color: var(--acc); font-size: 16px; }

/* input shell */
.cf-input {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-1);
  border: 1.5px solid var(--bd-2);
  border-radius: var(--radius);
  padding: 0 14px;
  transition: border-color 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out), background 0.16s var(--ease-out);
}
.cf-input > i.cf-input-ic { font-size: 19px; color: var(--text-2); flex-shrink: 0; transition: color 0.16s var(--ease-out); }
.cf-input input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font-family: var(--font-jp);
  font-size: 19px; font-weight: 500; color: var(--text-0);
  padding: 15px 0;
  letter-spacing: 0.01em;
}
.cf-input input::placeholder { color: var(--text-3); font-weight: 400; }
.cf-field.is-focus .cf-input { border-color: var(--acc); box-shadow: 0 0 0 4px var(--acc-soft); background: var(--bg-card); }
.cf-field.is-focus .cf-input-ic { color: var(--acc); }

/* derived field: the value is already there → tint it as "confirmed" */
.cf-field.is-derived .cf-input { border-color: var(--acc-line); background: var(--acc-soft); }
.cf-field.is-derived input { font-weight: 600; }

/* inline tick that lives in the input (valid) */
.cf-input-ok {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: var(--acc); color: #fff; display: grid; place-items: center;
  font-size: 13px; opacity: 0; transform: scale(0.4);
  transition: opacity 0.18s var(--ease-out), transform 0.22s var(--cf-ease-pop);
}
.cf-field.is-valid .cf-input-ok { opacity: 1; transform: scale(1); }

/* hint */
.cf-hint {
  font-size: 11.5px; color: var(--text-2); line-height: 1.6;
  margin: 8px 2px 0;
  display: flex; align-items: flex-start; gap: 6px;
  min-height: 16px;
}
.cf-hint i { font-size: 14px; flex-shrink: 0; margin-top: 1px; color: var(--text-3); }
.cf-hint.is-err { color: var(--danger); }
.cf-hint.is-err i { color: var(--danger); }
.cf-hint.is-auto { color: var(--acc); }
.cf-hint.is-auto i { color: var(--acc); }

/* quick chips */
.cf-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.cf-chip {
  font-family: var(--font-sans); font-size: 12.5px; font-weight: 600;
  color: var(--text-1); background: var(--bg-1);
  border: 1px solid var(--bd-2); border-radius: 999px;
  padding: 6px 13px; cursor: pointer;
  transition: all 0.14s var(--ease-out);
}
.cf-chip:hover { border-color: var(--acc-line); color: var(--acc); background: var(--acc-soft); }
.cf-chip:active { transform: scale(0.95); }

/* small "考え中" shimmer while deriving */
.cf-thinking {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--acc); font-weight: 600;
  padding: 13px 2px 4px;
}
.cf-thinking .dots { display: inline-flex; gap: 3px; }
.cf-thinking .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--acc); animation: cfBlink 1s var(--ease-out) infinite; }
.cf-thinking .dots i:nth-child(2){ animation-delay: 0.15s; }
.cf-thinking .dots i:nth-child(3){ animation-delay: 0.3s; }
@keyframes cfBlink { 0%,100%{opacity:0.25; transform:translateY(0)} 50%{opacity:1; transform:translateY(-2px)} }

/* ---------- footer CTA ---------- */
.cf-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--bd-1); }
.cf-cta {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-jp); font-size: 16px; font-weight: 700;
  color: #fff; background: var(--acc);
  border: 0; border-radius: 999px;
  padding: 15px 22px; cursor: pointer;
  box-shadow: 0 14px 30px -14px var(--acc-mid);
  transition: transform 0.12s var(--ease-out), box-shadow 0.18s var(--ease-out), background 0.18s var(--ease-out), opacity 0.18s var(--ease-out);
}
.cf-cta .cf-cta-arr { font-size: 18px; transition: transform 0.18s var(--ease-out); }
.cf-cta:hover:not(:disabled) { box-shadow: 0 18px 36px -14px var(--acc-mid); }
.cf-cta:hover:not(:disabled) .cf-cta-arr { transform: translateX(4px); }
.cf-cta:active:not(:disabled) { transform: scale(0.97); }
.cf-cta:disabled { background: var(--bd-3); color: var(--text-3); box-shadow: none; cursor: not-allowed; }
.cf-cta.is-confirm { background: var(--acc); }

.cf-foot-note {
  margin: 11px 0 0; text-align: center;
  font-size: 11px; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.cf-foot-note i { font-size: 14px; color: var(--text-3); }

/* ---------- done / complete screen ---------- */
.cf-complete { text-align: center; padding: 18px 6px 8px; }
.cf-complete-mark {
  width: 72px; height: 72px; margin: 0 auto 18px;
  border-radius: 50%; background: var(--acc); color: #fff;
  display: grid; place-items: center; font-size: 38px;
  box-shadow: 0 18px 40px -16px var(--acc-mid);
}
@media (prefers-reduced-motion: no-preference) {
  .cf-complete-mark { animation: cfMarkPop 0.46s var(--cf-ease-pop); }
  .cf-complete h2 { animation: cfReveal 0.4s var(--ease-out) 0.08s; }
  .cf-complete p { animation: cfReveal 0.4s var(--ease-out) 0.16s; }
}
@keyframes cfMarkPop { 0%{transform:scale(0.2)} 55%{transform:scale(1.12)} 100%{transform:scale(1)} }
.cf-complete h2 { font-size: 22px; font-weight: 700; color: var(--text-0); margin: 0 0 10px; }
.cf-complete p { font-size: 13.5px; color: var(--text-1); line-height: 1.8; margin: 0; }
.cf-complete p b { color: var(--text-0); font-weight: 700; }

@media (max-width: 480px) {
  .cf-card { padding: 20px 16px 16px; border-radius: var(--radius-lg); }
  .cf-head-amt { font-size: 17px; }
  .cf-input input { font-size: 17px; }
}
