body.modal-open { overflow: hidden; }
.is-busy { cursor: wait !important; opacity: .7; pointer-events: none; }

.active-job.job-live { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; }
.job-main { min-width: 0; display: flex; align-items: center; gap: 15px; }
.job-spinner { position: relative; width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 15px; background: rgba(162, 122, 255, .08); color: #c4a4ff; }
.job-spinner:before { content: ""; width: 19px; height: 19px; border: 2px solid rgba(196,164,255,.2); border-top-color: #c4a4ff; border-radius: 50%; animation: spin .9s linear infinite; }
.job-spinner.done:before { content: "✓"; width: auto; height: auto; border: 0; animation: none; color: var(--green); font-size: 18px; font-weight: 900; }
.job-spinner.stopped:before { content: "×"; width: auto; height: auto; border: 0; animation: none; color: var(--red); font-size: 20px; font-weight: 700; }
.job-spinner.attention:before { content: "!"; width: auto; height: auto; border: 0; animation: none; color: var(--red); font-size: 18px; font-weight: 900; }
@keyframes spin { to { transform: rotate(360deg); } }
.job-copy { min-width: 0; }
.job-copy-top { display: flex; align-items: center; gap: 8px; }
.job-copy h3 { overflow: hidden; margin-top: 8px; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.job-copy p { margin: 5px 0 0; color: var(--muted); font-size: 9px; }
.job-copy code { display: block; max-width: 520px; overflow: hidden; margin-top: 7px; color: #6f6878; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.job-actions { display: flex; align-items: center; gap: 9px; }
.job-actions .button { min-height: 38px; padding: 8px 12px; font-size: 9px; }
.job-note { grid-column: 1 / -1; display: flex; gap: 9px; margin: -4px 0 0 63px; color: #777080; font-size: 8px; }
.job-note strong { color: #aaa1b4; }

.history-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto 76px 32px; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(145deg, rgba(22,19,29,.84), rgba(14,12,20,.92)); }
.history-thumb { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(145deg, rgba(147, 93, 235, .17), rgba(255, 119, 174, .06)); color: #c2a5f4; font-size: 12px; font-weight: 850; }
.history-copy { min-width: 0; }
.history-copy strong, .history-copy span { display: block; }
.history-copy strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.history-copy span { margin-top: 4px; color: var(--muted); font-size: 8px; }
.history-cost { min-width: 70px; text-align: right; }
.history-cost strong, .history-cost small { display: block; }
.history-cost strong { color: #dbc9e9; font-size: 11px; }
.history-cost small { margin-top: 3px; color: var(--muted-2); font-size: 7px; }
.history-open { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); color: #bda4e6; cursor: pointer; }

.result-output { display: grid; gap: 14px; }
.video-frame { overflow: hidden; aspect-ratio: 9 / 16; border: 1px solid var(--line); border-radius: 17px; background: #050407; }
.video-frame.ratio-landscape { aspect-ratio: 16 / 9; }
.video-frame.ratio-square { aspect-ratio: 1 / 1; }
.video-frame video { width: 100%; height: 100%; display: block; object-fit: contain; background: #050407; }
.result-info h3 { margin-top: 10px; font-size: 13px; }
.result-info p { margin: 5px 0 0; color: var(--muted); font-size: 8px; }
.download-button { width: 100%; }
.expiry-warning { margin: -3px 0 0; color: #d3b885; font-size: 8px; line-height: 1.5; text-align: center; }

.modal-backdrop { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; overflow: auto; padding: 22px; background: rgba(5, 4, 9, .8); backdrop-filter: blur(14px); }
.modal-card { position: relative; width: min(440px, 100%); margin: auto; padding: 30px; border: 1px solid rgba(195, 160, 255, .27); border-radius: 24px; background: linear-gradient(145deg, #1b1624, #0e0c14 78%); box-shadow: 0 35px 100px rgba(0,0,0,.62); }
.modal-card h2 { font-size: 26px; }
.modal-close { position: absolute; top: 12px; right: 14px; width: 32px; height: 32px; border: 0; background: none; color: #bcb1c7; cursor: pointer; font-size: 24px; line-height: 1; }
.modal-logo { width: 43px; height: 43px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 14px; background: linear-gradient(145deg, var(--pink), var(--violet)); color: #fff; font-size: 16px; font-weight: 900; box-shadow: 0 12px 30px rgba(152, 85, 212, .3); }
.modal-lead { margin: 11px 0 0; color: var(--muted); font-size: 11px; }
.login-card form > label { display: block; margin: 21px 0 8px; color: #d7cfde; font-size: 10px; font-weight: 750; }
.password-field { position: relative; }
.password-field input { padding-right: 58px; }
.password-field button { position: absolute; top: 6px; right: 7px; height: 33px; border: 0; background: none; color: #b598e9; cursor: pointer; font-size: 9px; font-weight: 750; }
.modal-action { width: 100%; margin-top: 12px; }
.security-caption { margin: 16px 0 0; color: #746c7e; font-size: 8px; text-align: center; }
.approval-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 22px 0 0; }
.approval-summary div { padding: 10px 11px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.018); }
.approval-summary dt { color: var(--muted-2); font-size: 7px; font-weight: 750; text-transform: uppercase; letter-spacing: .7px; }
.approval-summary dd { margin: 3px 0 0; color: #dcd3e5; font-size: 10px; font-weight: 750; }
.approval-summary .approval-cost { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; border-color: rgba(255, 119, 174, .18); background: rgba(255, 119, 174, .04); }
.approval-summary .approval-cost dd { color: #ffc4dc; font-size: 19px; letter-spacing: -.5px; }
.paid-check { margin-top: 18px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.018); }
.modal-buttons { display: grid; grid-template-columns: 1fr 1.3fr; gap: 9px; margin-top: 18px; }

.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; width: min(365px, calc(100% - 36px)); display: grid; gap: 8px; pointer-events: none; }
.toast { display: grid; grid-template-columns: 26px 1fr auto; align-items: start; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(23, 19, 31, .96); box-shadow: 0 18px 50px rgba(0,0,0,.48); animation: toast-in .24s ease both; pointer-events: auto; }
.toast > span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; background: rgba(162, 122, 255, .1); color: #c5a8f8; font-size: 10px; }
.toast.error > span { background: rgba(255,120,149,.1); color: #ff9caf; }
.toast.success > span { background: rgba(99,231,166,.1); color: #8be5b2; }
.toast p { margin: 1px 0 0; color: #d1c9da; font-size: 9px; line-height: 1.45; }
.toast button { width: 22px; height: 22px; border: 0; background: none; color: #82798d; cursor: pointer; }
@keyframes toast-in { from { opacity: 0; transform: translateY(9px); } }

@media (max-width: 820px) {
  .toast-region { bottom: 82px; }
  .active-job.job-live { grid-template-columns: 1fr; }
  .job-actions { margin-left: 63px; }
  .job-note { margin-left: 63px; }
}

@media (max-width: 560px) {
  .modal-backdrop { align-items: end; padding: 10px 10px max(10px, env(safe-area-inset-bottom)); }
  .modal-card { padding: 25px 19px 20px; border-radius: 22px 22px 17px 17px; }
  .modal-card h2 { font-size: 23px; }
  .history-row { grid-template-columns: 39px minmax(0, 1fr) auto 32px; gap: 10px; padding: 11px; }
  .history-cost { display: none; }
  .active-job.job-live { padding: 16px; }
  .job-main { align-items: flex-start; }
  .job-copy-top { align-items: flex-start; flex-direction: column; }
  .job-actions { margin-left: 0; }
  .job-actions .button { flex: 1; }
  .job-note { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *:before, *:after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
