/* THE deploy pop-up (js/deploy-flow.js; Alex 11/23/2026: one 3-step flow for every strategy, user + admin).
   Design rules v1: calm surfaces, one accent, red only for real money; 150-250 ms ease-out motion, none under
   prefers-reduced-motion; 40 px tap targets; dark is :root, light is :root[data-theme="light"] (css/tokens.css). */
.df-overlay {
  position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: var(--ds-overlay); animation: df-fade 180ms ease-out;
}
.df-modal {
  width: 100%; max-width: 680px; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--ds-surface); color: var(--ds-text); border: 1px solid var(--ds-border);
  border-radius: var(--ds-r-lg, 16px); box-shadow: var(--ds-shadow-lg); font-family: var(--ds-font-sans);
  animation: df-rise 220ms ease-out;
}
.df-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 0; }
.df-title { flex: 1; font-size: var(--ds-fs-16, 16px); font-weight: 600; }
.df-head-acct { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--ds-muted); }
.df-head-acct:empty { display: none; }
.df-head-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.df-x {
  width: 40px; height: 40px; border: 0; border-radius: var(--ds-r-md, 8px); background: transparent;
  color: var(--ds-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.df-x:hover { background: var(--ds-hover); color: var(--ds-text); }
.df-x:focus-visible, .df-btn:focus-visible, .df-acct:focus-visible, .df-input:focus-visible, .df-all > summary:focus-visible,
.df-check input:focus-visible { outline: 2px solid var(--ds-focus-ring, var(--ds-accent)); outline-offset: 2px; }

/* the 3 steps: Account > Review > Confirm; done steps carry a check, the bar fills to the current step */
.df-steps { display: flex; align-items: center; gap: 8px; padding: 14px 22px 16px; border-bottom: 1px solid var(--ds-border); }
.df-step { display: flex; align-items: center; gap: 8px; font-size: var(--ds-fs-13, 13px); color: var(--ds-muted); white-space: nowrap; }
.df-dot {
  width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--ds-border-strong); font-size: 12px; font-weight: 600; font-family: var(--ds-font-num, inherit);
  transition: background 200ms ease-out, border-color 200ms ease-out, color 200ms ease-out;
}
.df-step.cur { color: var(--ds-text); font-weight: 600; }
.df-step.cur .df-dot { border-color: var(--ds-accent); color: var(--ds-accent); box-shadow: 0 0 0 4px var(--ds-accent-soft); }
.df-step.done .df-dot { background: var(--ds-accent); border-color: var(--ds-accent); color: var(--ds-on-primary); }
.df-line { flex: 1; height: 2px; min-width: 12px; background: var(--ds-border); border-radius: 2px; overflow: hidden; }
.df-line > i { display: block; height: 100%; width: 0; background: var(--ds-accent); transition: width 250ms ease-out; }
.df-line.done > i { width: 100%; }

.df-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.df-body.df-in { animation: df-slide 200ms ease-out; }
.df-body.df-back { animation: df-slide-back 200ms ease-out; }
.df-h { margin: 0 0 14px; font-size: var(--ds-fs-20, 20px); font-weight: 600; }
.df-group { margin: 16px 0 8px; font-size: 12px; font-weight: 600; color: var(--ds-label, var(--ds-muted));
  text-transform: uppercase; letter-spacing: var(--ds-label-tracking, .5px); }
.df-group:first-of-type { margin-top: 0; }

/* account cards */
.df-acct {
  width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; text-align: left; margin-bottom: 8px;
  padding: 12px 16px; border: 1.5px solid var(--ds-border); border-radius: 10px; background: transparent;
  color: var(--ds-text); font: inherit; cursor: pointer;
  transition: border-color 150ms ease-out, background 150ms ease-out, transform 120ms ease-out;
}
.df-acct:hover:not(:disabled) { border-color: var(--ds-border-strong); }
.df-acct:active:not(:disabled) { transform: scale(.995); }
.df-acct.sel { border-color: var(--ds-accent); background: var(--ds-sel-bg, var(--ds-accent-soft)); color: var(--ds-text); }   /* a tint, never the solid fill: the name stays readable (11/23) */
.df-acct:disabled { opacity: .5; cursor: not-allowed; }
.df-acct-main { flex: 1; min-width: 0; }
.df-acct-name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.df-acct-detail { font-size: 12px; color: var(--ds-muted); margin-top: 2px; font-family: var(--ds-font-num, inherit); }
.df-radio { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--ds-border-strong); flex: none;
  display: inline-flex; align-items: center; justify-content: center; transition: border-color 150ms ease-out; }
.df-acct.sel .df-radio { border-color: var(--ds-accent); }
.df-acct.sel .df-radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ds-accent); }

/* Paper / Live badges: Live is the only red */
.df-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--ds-r-pill, 999px);
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; flex: none; }
.df-badge.paper { background: var(--ds-accent-soft); color: var(--ds-accent); }
.df-badge.live { background: var(--ds-danger-soft); color: var(--ds-danger); }
.df-badge.muted { background: var(--ds-hover); color: var(--ds-muted); }

/* fields */
.df-label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--ds-label, var(--ds-muted));
  text-transform: uppercase; letter-spacing: var(--ds-label-tracking, .5px); }
.df-input {
  width: 100%; box-sizing: border-box; min-height: 44px; padding: 10px 14px; border-radius: 8px; font: inherit; font-size: 15px;
  color: var(--ds-text); background: var(--ds-bg); border: 1px solid var(--ds-field-edge, var(--ds-border-strong));
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}
.df-input.bad { border-color: var(--ds-danger); box-shadow: 0 0 0 3px var(--ds-danger-soft); }
.df-input.ok { border-color: var(--ds-accent); }
.df-field { margin-bottom: 14px; }
.df-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.df-msg { min-height: 18px; margin-top: 6px; font-size: 13px; color: var(--ds-danger); }
.df-msg:empty { min-height: 0; margin: 0; }

/* the summary tiles (the SPX Weekly deploy look Alex kept): label left, value right, two columns */
.df-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.df-tile { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 9px 12px;
  border-radius: 6px; background: var(--ds-bg); font-size: 13px; animation: df-tile 220ms ease-out both; }
.df-tile > span:first-child { color: var(--ds-muted); }
.df-tile > span:last-child { color: var(--ds-text); font-weight: 500; text-align: right; font-family: var(--ds-font-num, inherit); }
.df-sub { margin: 14px 0 0; font-size: 13px; font-weight: 600; }
.df-size { margin: 2px 0 8px; }

/* Show All Settings: the grouped list (js/settings-list.js) */
.df-all { margin-top: 16px; border: 1px solid var(--ds-border); border-radius: 10px; }
.df-all > summary { list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; font-size: 13px; font-weight: 600; border-radius: 10px; }
.df-all > summary::-webkit-details-marker { display: none; }
.df-all > summary svg { transition: transform 200ms ease-out; }
.df-all[open] > summary svg { transform: rotate(90deg); }
.df-all > summary:hover { background: var(--ds-hover); }
.df-all-body { padding: 4px 14px 12px; animation: df-fade 200ms ease-out; }
.df-sec { margin: 12px 0 4px; font-size: 12px; font-weight: 600; color: var(--ds-label, var(--ds-muted)); text-transform: uppercase;
  letter-spacing: var(--ds-label-tracking, .5px); }
.df-kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; margin: 0; font-size: 13px; }
.df-kv dt { color: var(--ds-muted); }
.df-kv dd { margin: 0; text-align: right; font-family: var(--ds-font-num, inherit); }

/* Confirm */
.df-live { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 14px; border-radius: 10px;
  background: var(--ds-danger-soft); color: var(--ds-danger); border: 1px solid var(--ds-danger); font-size: 14px; }
.df-live b { font-weight: 700; }
.df-rows { border: 1px solid var(--ds-border); border-radius: 10px; padding: 4px 14px; margin-bottom: 16px; }
.df-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px;
  border-bottom: 1px solid var(--ds-border); font-size: 14px; }
.df-row:last-child { border-bottom: 0; }
.df-row > span:first-child { color: var(--ds-muted); }
.df-row > span:last-child { font-weight: 500; text-align: right; overflow-wrap: anywhere; display: inline-flex; align-items: center; gap: 8px; }
.df-acks { display: flex; flex-direction: column; gap: 8px; }
.df-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; cursor: pointer; padding: 4px 0; }
.df-check input { width: 18px; height: 18px; margin-top: 1px; flex: none; accent-color: var(--ds-accent); cursor: pointer; }
.df-hint { font-size: 12px; color: var(--ds-muted); }
.df-notice { font-size: 13px; padding: 10px 12px; border-radius: 8px; background: var(--ds-warn-soft); color: var(--ds-text); }

/* footer + buttons: a short press and a shine on primary (Design rules 8) */
.df-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--ds-border); }
.df-foot .df-spacer { flex: 1; }
.df-btn {
  position: relative; overflow: hidden; min-height: 44px; padding: 10px 22px; border-radius: 8px; border: 0; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px;
  transition: transform 120ms ease-out, opacity 150ms ease-out, box-shadow 150ms ease-out;
}
.df-btn:active:not(:disabled) { transform: scale(.97); }
.df-btn:disabled { opacity: .4; cursor: not-allowed; }
.df-btn.primary { background: var(--ds-text); color: var(--ds-on-primary); }
.df-btn.primary:hover:not(:disabled) { box-shadow: var(--ds-shadow-md); }
.df-btn.primary::after { content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .25), transparent); pointer-events: none; }
.df-btn.primary:hover:not(:disabled)::after { animation: df-shine 600ms ease-out; }
.df-btn.danger { background: var(--ds-danger); color: var(--ds-bg); }   /* dark: dark text on the light red; light: light text on the dark red (AA both) */
.df-btn.ghost { background: transparent; color: var(--ds-text); border: 1px solid var(--ds-border-strong); }
.df-btn.link { background: transparent; color: var(--ds-accent); padding: 0 4px; min-height: 40px; }
.df-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: df-spin 700ms linear infinite; }

/* success */
.df-done { text-align: center; padding: 8px 0 4px; }
.df-done-ico { width: 64px; height: 64px; margin: 0 auto 12px; color: var(--ds-accent); }
.df-done-ico circle, .df-done-ico path { stroke-dasharray: 80; stroke-dashoffset: 80; animation: df-draw 500ms ease-out forwards; }
.df-done-ico path { animation-delay: 220ms; }
.df-done .df-rows { text-align: left; margin-top: 16px; }

@keyframes df-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes df-rise { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes df-slide { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes df-slide-back { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes df-tile { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes df-shine { to { left: 130%; } }
@keyframes df-spin { to { transform: rotate(360deg); } }
@keyframes df-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .df-overlay, .df-modal, .df-body.df-in, .df-body.df-back, .df-tile, .df-all-body, .df-btn.primary::after { animation: none !important; }
  .df-done-ico circle, .df-done-ico path { animation: none; stroke-dashoffset: 0; }
  .df-line > i, .df-dot, .df-acct, .df-btn, .df-input { transition: none; }
}
@media (max-width: 560px) {
  .df-overlay { padding: 0; align-items: stretch; }
  .df-modal { max-height: none; height: 100%; border-radius: 0; }
  .df-grid, .df-fields { grid-template-columns: minmax(0, 1fr); }
  .df-head { flex-wrap: wrap; }
  .df-head-acct { order: 3; width: 100%; }
  .df-steps .df-step > span:last-child { display: none; }
  .df-step.cur > span:last-child { display: inline; }
  .df-head, .df-steps, .df-body, .df-foot { padding-left: 16px; padding-right: 16px; }
}
/* Step 1 Paper | Live switch (Alex 11/25/2026): the existing .sm-seg segment, spaced from the account cards */
.df-side { margin: 2px 0 12px; }
