/* Admin — Workflows. Sits inside the console shell (DM Sans, red accent) and
   borrows the storefront's display face for workflow names. */

.wfa {
  --wfa-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --wfa-surface: #0f0f10;
  --wfa-surface-2: #17171a;
  --wfa-surface-3: #212125;
  --wfa-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --wfa-radius: 12px;
  color: var(--text);
}
.wfa a { color: inherit; }
.wfa .muted a { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 3px; }

.wfa-ico { display: inline-flex; width: 16px; height: 16px; }
.wfa-ico svg, .wfa-icon-btn svg { width: 100%; height: 100%; }

/* head */
.wfa-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}
.wfa-title {
  margin: 0;
  font-family: var(--wfa-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 3.4vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.wfa-head .muted { margin: 0.5rem 0 0; }
.wfa-head-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.wfa-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  color: var(--muted) !important;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s ease, transform 0.25s var(--wfa-ease);
}
.wfa-back:hover { color: var(--text) !important; transform: translateX(-3px); }

/* list */
.wfa-list { display: grid; gap: 0.6rem; }
.wfa-row {
  display: grid;
  grid-template-columns: auto 54px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1.1rem;
  padding: 0.85rem 1rem 0.85rem 0.6rem;
  background: var(--wfa-surface);
  border-radius: var(--wfa-radius);
  transition: background-color 0.2s ease;
}
.wfa-row:hover { background: var(--wfa-surface-2); }
.wfa-order { display: grid; gap: 2px; }
.wfa-icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.wfa-icon-btn:hover:not(:disabled) { background: var(--wfa-surface-3); color: var(--text); }
.wfa-icon-btn:active:not(:disabled) { transform: scale(0.92); }
.wfa-icon-btn:disabled { opacity: 0.25; cursor: default; }
.wfa-icon-btn[aria-pressed="true"] { color: var(--accent); }

.wfa-thumb {
  display: block;
  width: 54px;
  aspect-ratio: 9 / 16;
  border-radius: 6px;
  overflow: hidden;
  background: var(--wfa-surface-3);
}
.wfa-thumb img, .wfa-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.wfa-row-name {
  font-family: var(--wfa-display);
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: -0.005em;
}
.wfa-row-name:hover { color: var(--accent); }
.wfa-row-tag {
  margin: 0.3rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wfa-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.wfa-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--wfa-surface-3);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.wfa-chip.is-live { color: var(--success); background: rgba(129, 199, 132, 0.1); }
.wfa-chip.is-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: wfa-pulse 2.4s ease-in-out infinite; }
.wfa-chip.is-hidden { color: var(--warn); background: rgba(255, 183, 77, 0.1); }
.wfa-chip.is-locked { color: var(--text); }
@keyframes wfa-pulse { 50% { opacity: 0.35; } }
.wfa-row-price {
  font-family: var(--wfa-display);
  font-weight: 700;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}
.wfa-row-actions { display: flex; gap: 0.35rem; }
.wfa-danger-text { color: var(--danger) !important; }
.wfa-danger-text:hover:not(:disabled) { background: rgba(239, 83, 80, 0.1) !important; }

.wfa-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--wfa-surface);
  border-radius: var(--wfa-radius);
}
.wfa-empty h3 { margin: 0 0 0.4rem; font-family: var(--wfa-display); font-size: 1.8rem; text-transform: uppercase; }
.wfa-empty .btn { margin-top: 1rem; }

/* editor layout */
.wfa-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  gap: 1.25rem;
  align-items: start;
}
.wfa-main, .wfa-side { display: grid; gap: 1.25rem; }
.wfa-side { position: sticky; top: calc(var(--topbar-h, 64px) + 1rem); }
.wfa-panel {
  background: var(--wfa-surface);
  border-radius: var(--wfa-radius);
  padding: 1.35rem 1.35rem 1.4rem;
}
.wfa-panel > h3 { margin: 0 0 1rem; font-size: 1.05rem; font-weight: 600; }
.wfa-panel > p.muted { margin: -0.6rem 0 1rem; font-size: 0.9rem; }
.wfa-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

.wfa-field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.wfa-field > span { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.wfa-field > span em { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 0.35rem; }
.wfa-field small { color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.wfa-field input,
.wfa-field textarea,
.wfa-url {
  width: 100%;
  background: #08080a;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 9px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  outline: none;
  caret-color: var(--accent);
  transition: border-color 0.15s ease, box-shadow 0.2s ease;
}
.wfa-field textarea { resize: vertical; min-height: 2.8rem; line-height: 1.5; }
.wfa-field input:focus,
.wfa-field textarea:focus,
.wfa-url:focus { border-color: rgba(230, 57, 70, 0.7); box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15); }
.wfa ::placeholder { color: #6a6a70; }

/* segmented control */
.wfa-seg { display: inline-flex; padding: 3px; background: #08080a; border-radius: 10px; margin-bottom: 1rem; }
.wfa-seg label { position: relative; cursor: pointer; }
.wfa-seg input { position: absolute; opacity: 0; }
.wfa-seg span { display: block; padding: 0.45rem 1.1rem; border-radius: 8px; font-size: 0.9rem; font-weight: 600; color: var(--muted); transition: background-color 0.2s var(--wfa-ease), color 0.2s ease; }
.wfa-seg input:checked + span { background: var(--wfa-surface-3); color: var(--text); }
.wfa-seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* media slots */
.wfa-media {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 1rem;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  background: #0a0a0c;
  border-radius: 10px;
  transition: opacity 0.2s ease;
}
.wfa-media.is-uploading { opacity: 0.6; }
.wfa-media.is-uploading .wfa-media-preview::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: var(--accent);
  animation: wfa-load 1s ease-in-out infinite;
}
@keyframes wfa-load { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.wfa-media-preview {
  position: relative;
  width: 84px;
  aspect-ratio: 9 / 16;
  border-radius: 6px;
  overflow: hidden;
  background: var(--wfa-surface-3);
  display: grid;
  place-items: center;
}
.wfa-media-preview img, .wfa-media-preview video { width: 100%; height: 100%; object-fit: cover; }
.wfa-media-preview.is-empty span { font-size: 0.7rem; color: var(--muted); text-align: center; padding: 0.4rem; }
.wfa-media-label { margin: 0; font-weight: 600; font-size: 0.92rem; }
.wfa-media-hint { margin: 0.15rem 0 0.6rem; font-size: 0.82rem; }
.wfa-media-actions { display: flex; gap: 0.4rem; margin-bottom: 0.55rem; }
.wfa-upload { cursor: pointer; }
.wfa-url { font-size: 0.85rem; padding: 0.5rem 0.7rem; }

/* switch */
.wfa-visibility { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.wfa-switch { display: flex; align-items: center; gap: 0.85rem; cursor: pointer; }
.wfa-switch input { position: absolute; opacity: 0; }
.wfa-switch-track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--wfa-surface-3); transition: background-color 0.25s var(--wfa-ease); flex: none; }
.wfa-switch-track span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #f5f5f5; transition: transform 0.3s var(--wfa-ease); }
.wfa-switch input:checked + .wfa-switch-track { background: var(--accent); }
.wfa-switch input:checked + .wfa-switch-track span { transform: translateX(18px); }
.wfa-switch input:focus-visible + .wfa-switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }
.wfa-switch strong { display: block; font-size: 0.95rem; }
.wfa-switch small { display: block; font-size: 0.82rem; }

/* preview */
.wfa-preview { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 1rem; }
.wfa-pv-frame { position: relative; aspect-ratio: 9 / 16; border-radius: 4px; overflow: hidden; background: #050505; display: grid; place-items: center; }
.wfa-pv-frame > img, .wfa-pv-frame > video { width: 100%; height: 100%; object-fit: cover; }
.wfa-pv-pair { display: grid; grid-template-rows: 1fr 1fr; gap: 3px; width: 100%; height: 100%; }
.wfa-pv-pair img, .wfa-pv-pair video { width: 100%; height: 100%; object-fit: cover; min-height: 0; }
.wfa-pv-empty { font-size: 0.72rem; color: var(--muted); text-align: center; padding: 0.5rem; }
.wfa-pv-cap { position: absolute; top: 6px; left: 6px; padding: 2px 5px; background: rgba(5, 5, 5, 0.8); font-size: 0.62rem; font-weight: 600; }
.wfa-pv-body { min-width: 0; font-family: "Schibsted Grotesk", var(--sans); }
.wfa-pv-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.wfa-pv-head strong, .wfa-pv-head span { font-family: var(--wfa-display); font-weight: 700; font-size: 1.35rem; line-height: 1; text-transform: uppercase; }
.wfa-pv-body p { margin: 0.45rem 0 0.5rem; font-size: 0.85rem; line-height: 1.4; }
.wfa-pv-body ul { margin: 0; padding: 0; list-style: none; font-size: 0.75rem; color: var(--muted); }
.wfa-pv-body li { position: relative; padding-left: 10px; }
.wfa-pv-body li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 4px; height: 4px; background: var(--accent); }
.wfa-pv-buy { display: inline-block; margin-top: 0.7rem; padding: 0.4rem 0.7rem; background: var(--accent); color: #fff; font-size: 0.78rem; font-weight: 700; border-radius: 2px; }

/* password */
.wfa-pass-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.1rem; }
.wfa-pass-head h3 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.wfa-pass-head p { margin: 0; font-size: 0.88rem; }
.wfa-lock { width: 46px; height: 46px; flex: none; color: var(--muted); }
.wfa-lock-body { fill: var(--wfa-surface-3); transition: fill 0.4s var(--wfa-ease); }
.wfa-shackle { transform-origin: 46px 26px; transform: translateY(-5px) rotate(28deg); transition: transform 0.55s var(--wfa-ease); }
.wfa-pass.is-locked .wfa-lock { color: var(--text); }
.wfa-pass.is-locked .wfa-shackle { transform: none; }
.wfa-pass.is-locked .wfa-lock-body { fill: var(--accent); }
.wfa-pass.just-locked .wfa-lock { animation: wfa-thunk 0.6s var(--wfa-ease); }
@keyframes wfa-thunk { 40% { transform: translateY(3px) scale(0.96); } }
.wfa-pass.is-disabled { opacity: 0.6; }
.wfa-pass.is-wrong .wfa-pass-row { animation: wfa-shake 0.42s var(--wfa-ease); }
@keyframes wfa-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.wfa-pass-row {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #08080a;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.2s ease;
}
.wfa-pass-row:focus-within { border-color: rgba(230, 57, 70, 0.7); box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15); }
.wfa-pass-row input { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; background: transparent !important; font-size: 1.05rem; letter-spacing: 0.03em; }
.wfa-pass-row .wfa-icon-btn { width: 40px; height: 40px; padding: 10px; }
.wfa-meter { height: 3px; border-radius: 3px; background: var(--wfa-surface-3); overflow: hidden; }
.wfa-meter span { display: block; height: 100%; transform-origin: left; transform: scaleX(0); background: var(--danger); transition: transform 0.35s var(--wfa-ease), background-color 0.3s ease; }
.wfa-meter span[data-level="mid"] { background: var(--warn); }
.wfa-meter span[data-level="high"] { background: var(--success); }
.wfa-pass-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.wfa-reveal { margin-top: 1rem; padding: 1rem; border-radius: 10px; background: var(--wfa-surface-2); animation: wfa-rise 0.5s var(--wfa-ease); }
.wfa-reveal p { margin: 0 0 0.65rem; font-size: 0.85rem; }
.wfa-reveal-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.wfa-reveal output { font-family: var(--wfa-display); font-weight: 700; font-size: 1.5rem; letter-spacing: 0.02em; word-break: break-all; }

/* updates */
.wfa-up-form { padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.wfa-updates { display: grid; gap: 0.6rem; max-height: 440px; overflow-y: auto; padding-right: 2px; }
.wfa-update { position: relative; padding: 0.9rem 1rem; border-radius: 10px; background: var(--wfa-surface-2); }
.wfa-update-meta { display: flex; gap: 0.5rem; font-size: 0.8rem; color: var(--muted); }
.wfa-update-meta b { color: var(--accent); }
.wfa-update h4 { margin: 0.25rem 5.5rem 0.25rem 0; font-size: 0.98rem; }
.wfa-update-body { margin: 0 0 0.35rem; font-size: 0.85rem; color: #c9c9cc; white-space: pre-wrap; overflow-wrap: anywhere; }
.wfa-update a { font-size: 0.85rem; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.wfa-update [data-del-update] { position: absolute; top: 0.6rem; right: 0.6rem; }
.wfa-up-empty { margin: 0; font-size: 0.9rem; }

/* files */
.wfa-drop {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  padding: 1.2rem 1rem;
  text-align: center;
  background: #08080a;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s var(--wfa-ease);
}
.wfa-drop:hover,
.wfa-drop.is-over { border-color: var(--accent); background: rgba(230, 57, 70, 0.06); }
.wfa-drop.is-over { transform: scale(1.01); }
.wfa-drop:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15); }
.wfa-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.wfa-drop-ico { width: 22px; height: 22px; color: var(--accent); }
.wfa-drop-ico svg { width: 100%; height: 100%; }
.wfa-drop span { font-size: 0.9rem; }
.wfa-drop small { color: var(--muted); font-size: 0.78rem; max-width: 36ch; }
.wfa-picked, .wfa-files { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 4px; }
.wfa-picked li, .wfa-files li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.4rem 0.35rem 0.7rem;
  background: #0a0a0c;
  border-radius: 8px;
  font-size: 0.85rem;
  animation: wfa-rise 0.35s var(--wfa-ease) both;
}
.wfa-files li { background: rgba(0, 0, 0, 0.35); }
.wfa-files .wfa-ico { color: var(--accent); transform: rotate(180deg); }
.wfa-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.wfa-file-size { color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.wfa-picked li .wfa-icon-btn, .wfa-files li .wfa-icon-btn { width: 28px; height: 28px; padding: 7px; }
.wfa-picked li[data-state="uploading"] { opacity: 0.6; }
.wfa-picked li[data-state="done"] .wfa-file-size { color: var(--success); }
.wfa-picked li[data-state="failed"] .wfa-file-size { color: var(--danger); }
.wfa-attach { margin: 0.6rem 0.4rem 0 0; cursor: pointer; }
.wfa-attach.is-busy { opacity: 0.6; pointer-events: none; }
.wfa-update .wfa-files + .wfa-attach { margin-top: 0.6rem; }

/* buttons in this section */
.wfa .btn-primary { background: var(--accent); }
.wfa .btn-primary:hover:not(:disabled) { background: var(--accent-dark); filter: none; }
.wfa .btn:active:not(:disabled) { transform: translateY(1px); }
.wfa .btn.is-busy { position: relative; overflow: hidden; }
.wfa .btn.is-busy::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 40%; background: #fff; animation: wfa-load 0.9s ease-in-out infinite; }
.wfa .btn.is-saved { background: #2e7d32; transition: background-color 0.3s ease; }

/* motion */
.wfa-in { animation: wfa-rise 0.55s var(--wfa-ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
.wfa-pop { animation: wfa-rise 0.5s var(--wfa-ease) both; }
.wfa-out { animation: wfa-out 0.26s ease forwards; }
@keyframes wfa-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes wfa-out { to { opacity: 0; transform: translateX(16px); } }

@media (max-width: 1100px) {
  .wfa-layout { grid-template-columns: 1fr; }
  .wfa-side { position: static; }
}
@media (max-width: 720px) {
  .wfa-row { grid-template-columns: auto 46px minmax(0, 1fr); }
  .wfa-row-price { grid-column: 3; }
  .wfa-row-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .wfa-grid-2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .wfa *, .wfa *::before, .wfa *::after { animation: none !important; transition-duration: 1ms !important; }
}
