/* Animated result views for /status and /refill (visual layer only) */
.fx-wrap, .fx-card { --tone: #647b83; --tone-rgb: 123, 119, 138; --ez: cubic-bezier(.22, 1, .36, 1); }
.fx-wait { --tone: #4c95a5; --tone-rgb: 91, 141, 239; }
.fx-run  { --tone: #147e89; --tone-rgb: 154, 124, 240; }
.fx-ok   { --tone: #19a888; --tone-rgb: 25, 168, 136; }
.fx-warn { --tone: #e0900c; --tone-rgb: 224, 144, 12; }
.fx-bad  { --tone: #e5384d; --tone-rgb: 229, 56, 77; }

/* ---------- STATUS ---------- */
.fx-wrap { display: flex; flex-direction: column; gap: 18px; }
.fx-hero {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: clamp(16px, 4vw, 26px);
  padding: clamp(18px, 4vw, 26px); border-radius: 24px;
  background: linear-gradient(135deg, rgba(var(--tone-rgb), .10), rgba(var(--tone-rgb), .03) 60%, #fff);
  box-shadow: inset 0 0 0 1px rgba(var(--tone-rgb), .22), 0 18px 40px -22px rgba(var(--tone-rgb), .55);
  opacity: 0; transform: translateY(14px) scale(.98); animation: fx-in .7s var(--ez) both paused;
}
.fx-run .fx-hero::after, .fx-wait .fx-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .65) 50%, transparent 65%);
  transform: translateX(-100%); animation: fx-sweep 2.8s ease-in-out 1s infinite;
}
.fx-go .fx-hero { animation-play-state: running; }
@keyframes fx-in { to { opacity: 1; transform: none; } }
@keyframes fx-sweep { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }

.fx-ring { position: relative; flex: none; width: clamp(96px, 26vw, 118px); aspect-ratio: 1; }
.fx-ring::before {
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--tone-rgb), .18), transparent);
  animation: fx-breathe 2.6s ease-in-out infinite;
}
.fx-svg { position: relative; width: 100%; height: 100%; overflow: visible; }
.fx-track { fill: none; stroke: rgba(var(--tone-rgb), .14); stroke-width: 9; }
.fx-arc {
  fill: none; stroke: var(--tone); stroke-width: 9; stroke-linecap: round;
  stroke-dasharray: 289.03; stroke-dashoffset: 289.03;
  filter: drop-shadow(0 0 6px rgba(var(--tone-rgb), .55));
  animation: fx-arc 1.3s var(--ez) .2s both paused;
}
.fx-go .fx-arc { animation-play-state: running; }
@keyframes fx-arc { from { stroke-dashoffset: 289.03; } to { stroke-dashoffset: var(--off); } }
.fx-ring.indet .fx-svg { animation: fx-rotate 1.2s linear infinite; }
.fx-ring.indet .fx-arc { stroke-dasharray: 72 217; stroke-dashoffset: 0; animation: none; }
@keyframes fx-rotate { to { transform: rotate(360deg); } }
@keyframes fx-breathe { 0%, 100% { transform: scale(.94); opacity: .7; } 50% { transform: scale(1.05); opacity: 1; } }
.fx-pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(22px, 6vw, 28px); font-weight: 800; letter-spacing: -.04em; color: var(--text, #182a31); font-variant-numeric: tabular-nums; }
.fx-glyph { font-size: 30px; color: var(--tone); animation: fx-bob 1.6s ease-in-out infinite; }
@keyframes fx-bob { 50% { transform: translateY(-4px) scale(1.08); } }

.fx-hero-txt { min-width: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; position: relative; z-index: 1; }
.fx-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; color: var(--tone); background: #fff; box-shadow: inset 0 0 0 1px rgba(var(--tone-rgb), .3);
}
.fx-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.fx-run .fx-dot::after, .fx-wait .fx-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--tone); animation: fx-ping 1.5s ease-out infinite; }
@keyframes fx-ping { from { transform: scale(1); opacity: .7; } to { transform: scale(3.2); opacity: 0; } }
.fx-svc { font-size: 15px; font-weight: 700; letter-spacing: -.015em; line-height: 1.35; color: var(--text, #182a31); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fx-sub { font-size: 13px; color: var(--mute, #647b83); }
.fx-sub b { color: var(--text, #182a31); font-variant-numeric: tabular-nums; }

/* step tracker */
.fx-steps { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px 0 2px; }
.fx-line { position: absolute; left: 16.66%; right: 16.66%; top: 19px; height: 4px; border-radius: 4px; background: rgba(25, 55, 64, .08); overflow: hidden; }
.fx-line i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #56b5ac, var(--tone)); }
.fx-go .fx-line i { animation: fx-fill 1.1s var(--ez) .5s both; }
@keyframes fx-fill { to { width: var(--fill); } }
.fx-step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.fx-node {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800;
  color: var(--faint, #95a9ad); background: #fff; box-shadow: inset 0 0 0 2px rgba(25, 55, 64, .12);
  transform: scale(.6); opacity: 0;
}
.fx-go .fx-node { animation: fx-pop .5s var(--ez) calc(.3s + var(--n) * .22s) both; }
@keyframes fx-pop { 60% { transform: scale(1.12); } to { transform: scale(1); opacity: 1; } }
.fx-step.done .fx-node { color: #fff; background: var(--tone); box-shadow: 0 6px 14px -4px rgba(var(--tone-rgb), .6); }
.fx-step.warn .fx-node, .fx-step.fail .fx-node { color: #fff; background: var(--tone); box-shadow: 0 6px 14px -4px rgba(var(--tone-rgb), .6); }
.fx-step.active .fx-node { color: var(--tone); box-shadow: inset 0 0 0 2px var(--tone), 0 0 0 0 rgba(var(--tone-rgb), .4); }
.fx-go .fx-step.active .fx-node { animation: fx-pop .5s var(--ez) calc(.3s + var(--n) * .22s) both, fx-halo 1.8s ease-out 1s infinite; }
@keyframes fx-halo { to { box-shadow: inset 0 0 0 2px var(--tone), 0 0 0 12px rgba(var(--tone-rgb), 0); } }
.fx-lbl { font-size: 12px; font-weight: 600; color: var(--mute, #647b83); }
.fx-step.done .fx-lbl, .fx-step.active .fx-lbl, .fx-step.warn .fx-lbl, .fx-step.fail .fx-lbl { color: var(--text, #182a31); }

/* detail cards */
.fx-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.fx-row {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 13px 15px; border-radius: 18px;
  background: #fff; box-shadow: inset 0 0 0 1px var(--edge, rgba(25, 55, 64, .08)), 0 6px 18px -12px rgba(25, 55, 64, .25);
  opacity: 0; transform: translateY(16px);
  transition: transform .25s var(--ez), box-shadow .25s var(--ez);
}
.fx-go .fx-row { animation: fx-rise .6s var(--ez) calc(.5s + var(--i) * .08s) both; }
@keyframes fx-rise { to { opacity: 1; transform: none; } }
.fx-row:hover { box-shadow: inset 0 0 0 1px rgba(var(--tone-rgb), .4), 0 12px 24px -14px rgba(var(--tone-rgb), .5); }
.fx-row.wide { grid-column: 1 / -1; }
.fx-ico { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 15px; font-weight: 800; color: var(--tone); background: rgba(var(--tone-rgb), .12); }
.fx-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.fx-k { font-size: 11.5px; font-weight: 600; color: var(--mute, #647b83); text-transform: uppercase; letter-spacing: .04em; }
.fx-v { font-size: 15px; font-weight: 700; color: var(--text, #182a31); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.fx-v.trunc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 14px; }
.fx-acts { display: flex; gap: 6px; flex: none; }
.fx-btn {
  position: relative; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 10px; cursor: pointer;
  font-size: 14px; color: var(--text-2, #41565e); background: rgba(25, 55, 64, .06); text-decoration: none; transition: background .2s, transform .2s var(--ez), color .2s;
}
.fx-btn:hover { background: rgba(var(--tone-rgb), .16); color: var(--tone); transform: translateY(-2px); }
.fx-btn em { position: absolute; bottom: calc(100% + 6px); right: 0; padding: 3px 8px; border-radius: 8px; font: 600 11px/1.4 inherit; font-style: normal; color: #fff; background: #182a31; opacity: 0; transform: translateY(4px); pointer-events: none; transition: .2s; white-space: nowrap; }
.fx-btn.done em { opacity: 1; transform: none; }
.fx-btn.done { color: #fff; background: var(--tone); }

/* ---------- REFILL ---------- */
.fx-card { text-align: center; }
.fx-hero-ico { position: relative; width: 84px; height: 84px; margin: 6px auto 14px; }
.fx-mark { position: relative; z-index: 1; width: 100%; height: 100%; animation: fx-mark-pop .7s var(--ez) both; }
@keyframes fx-mark-pop { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); } }
.fx-mark svg { width: 100%; height: 100%; overflow: visible; }
.fx-mark .fx-c { fill: rgba(var(--tone-rgb), .12); stroke: var(--tone); stroke-width: 2.5; stroke-dasharray: 151; stroke-dashoffset: 151; animation: fx-draw .8s var(--ez) .1s forwards; }
.fx-mark .fx-p { fill: none; stroke: var(--tone); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: fx-draw .55s var(--ez) .7s forwards; }
@keyframes fx-draw { to { stroke-dashoffset: 0; } }
.fx-hero-ico.fx-bad .fx-mark { animation: fx-mark-pop .7s var(--ez) both, fx-shake .5s ease .75s; }
@keyframes fx-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.fx-hero-ico::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; background: radial-gradient(closest-side, rgba(var(--tone-rgb), .28), transparent); animation: fx-breathe 2.4s ease-in-out infinite; }
.fx-burst { position: absolute; inset: 0; z-index: 0; }
.fx-burst i { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%; background: var(--tone); opacity: 0; animation: fx-spark .9s var(--ez) calc(.7s + var(--d) * .06s) both; }
.fx-burst i:nth-child(3n) { background: #56b5ac; width: 5px; height: 5px; }
.fx-burst i:nth-child(3n+1) { background: #147e89; }
@keyframes fx-spark { 0% { opacity: 1; transform: rotate(var(--a)) translateY(-30px) scale(1); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-70px) scale(.2); } }

.fx-card .alert.fx-alert { background: transparent; border: 0; padding: 0; text-align: center; font-size: 17px; animation: fx-up .6s var(--ez) .5s both; }
.fx-card .alert.fx-alert strong { color: var(--tone); }
@keyframes fx-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.fx-card > .muted { animation: fx-up .6s var(--ez) .5s both; }

/* refill detail list: one tidy row per label/value */
.fx-card .kvs { display: flex !important; flex-direction: column; align-items: stretch !important; grid-template-columns: none !important; gap: 9px !important; margin-top: 22px !important; text-align: left; }
.fx-krow {
  width: 100%; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-radius: 16px;
  background: #fff; box-shadow: inset 0 0 0 1px var(--edge, rgba(25, 55, 64, .08)), 0 6px 16px -12px rgba(25, 55, 64, .25);
  opacity: 0; transform: translateY(14px); transition: transform .25s var(--ez), box-shadow .25s var(--ez);
}
.fx-krow:hover { box-shadow: inset 0 0 0 1px rgba(var(--tone-rgb), .4), 0 12px 22px -14px rgba(var(--tone-rgb), .5); }
.fx-krow > div:first-child { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--mute, #647b83); }
.fx-krow > div:last-child { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text, #182a31); text-align: right; font-variant-numeric: tabular-nums; }
.fx-krow .btn.ghost { margin: 0 !important; min-height: 0; padding: 4px 12px !important; border-radius: 10px; font-size: 12px !important; }
.fx-go .fx-krow { animation: fx-rise .55s var(--ez) calc(.8s + var(--i) * .08s) both; }
.fx-rid {
  display: inline-block; padding: 4px 14px; border-radius: 12px; font-size: 18px !important; letter-spacing: .04em;
  color: var(--tone); background: linear-gradient(110deg, rgba(var(--tone-rgb), .1) 30%, rgba(255, 255, 255, .9) 50%, rgba(var(--tone-rgb), .1) 70%) 0 0 / 220% 100%;
  box-shadow: inset 0 0 0 1px rgba(var(--tone-rgb), .3); animation: fx-shimmer 2.6s linear infinite;
}
@keyframes fx-shimmer { to { background-position: -220% 0; } }
.fx-card .badge.run { color: #167b85; background: rgba(20, 126, 138, .12); }

/* ---------- shared: loading button + error shake ---------- */
.btn[disabled] { cursor: progress; background-size: 220% 100% !important; animation: fx-sheen 1.3s linear infinite; }
@keyframes fx-sheen { from { background-position: 0 0; } to { background-position: -220% 0; } }
#err { animation: pop-in .35s var(--ez) both, fx-shake .45s ease .1s; }

@media (max-width: 520px) {
  .fx-hero { flex-direction: column; text-align: center; }
  .fx-hero-txt { align-items: center; }
  .fx-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .fx-wrap *, .fx-card *, .fx-wrap, .fx-card, #err, .btn[disabled] { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; }
  .fx-hero, .fx-row, .fx-node, .fx-krow { opacity: 1; transform: none; }
}
