#btn-operator { position: relative; }
#btn-operator[hidden] { display: none !important; }
#btn-operator.on { border-color: rgba(101, 220, 180, .45); color: #fff; }
#btn-operator.running::after,
#btn-operator.asking::after {
    content: ''; position: absolute; top: 3px; right: 3px;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--ui-live);
    animation: opPulse 1.4s ease-in-out infinite;
    pointer-events: none;
}
#btn-operator.asking::after { background: var(--g-warn); }
@keyframes opSpin { to { transform: rotate(360deg); } }
@keyframes opPulse { 50% { opacity: .35; } }

#op-scrim {
    position: fixed; inset: 53px 0 0 0; z-index: 4999;
    background: rgba(10, 10, 10, .5);
    animation: opFade .15s ease;
}
@keyframes opFade { from { opacity: 0; } to { opacity: 1; } }

.pb-modal.op-win {
    position: fixed; top: 54px; right: 16px; z-index: 5000;
    width: min(380px, calc(100vw - 32px)); height: auto; max-height: calc(100vh - 76px);
}
.pb-modal.ds-glass.op-win { background: var(--g-tint), var(--g-bg-strong) !important; }
.pb-modal.op-win.wide { width: min(540px, calc(100vw - 32px)); }
.pb-modal.op-win.op-center { top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%); }
.pb-modal.op-win.op-launch {
    width: min(620px, calc(100vw - 32px)); overflow: visible;
    padding: 10px 10px 10px 14px; box-sizing: border-box;
}
.op-row1 { display: flex; align-items: center; gap: 10px; }
.op-logo { flex: none; display: inline-grid; color: var(--g-text); }
.op-field {
    flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px;
    padding: 0 4px 0 12px; min-height: 38px; box-sizing: border-box;
    background: rgba(0, 0, 0, .28); border: 1px solid var(--g-line); border-radius: var(--g-r-sm);
}
.op-field:focus-within { border-color: var(--ui-border-focus); }
.op-win textarea.op-req {
    flex: 1 1 auto; box-sizing: border-box; width: 100%; height: 22px; max-height: 160px; resize: none; overflow-y: auto;
    padding: 8px 0; margin: 0; min-height: 0;
    font: 14px/22px var(--ui-font); color: var(--g-text);
    background: transparent !important; border: none !important; box-shadow: none !important; outline: none;
}
.op-win textarea.op-req::placeholder { color: var(--g-text-3); }
.op-attach {
    flex: none; align-self: center; width: 30px; height: 30px; display: inline-grid; place-items: center;
    border-radius: var(--g-r-sm); border: 1px solid transparent; background: transparent;
    color: var(--g-text-3); cursor: pointer;
}
.op-attach:hover { background: var(--g-row-hover); color: var(--g-text); }
.op-win input.op-limit {
    flex: none; width: 44px; height: 30px; box-sizing: border-box; padding: 0 2px;
    font: 13px var(--ui-font); color: var(--g-text-3); text-align: center;
    background: transparent !important; border: 1px solid transparent !important; border-radius: var(--g-r-sm); box-shadow: none !important;
    -moz-appearance: textfield; appearance: textfield; cursor: text;
}
.op-win input.op-limit::-webkit-outer-spin-button, .op-win input.op-limit::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.op-win input.op-limit:hover { border-color: var(--g-line) !important; color: var(--g-text-2); }
.op-win input.op-limit:focus { outline: none; border-color: var(--ui-border-focus) !important; color: var(--g-text); }
.op-row1 .ds-genbtn { flex: none; min-height: 38px; padding: 0 16px; }
.op-files { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; padding-left: 32px; }
.op-file {
    display: inline-flex; align-items: center; gap: 4px; max-width: 260px;
    padding: 3px 4px 3px 8px; border-radius: var(--g-r-xs);
    background: var(--g-row); border: 1px solid var(--g-line-soft);
    color: var(--g-text); font-size: 11.5px;
}
.op-file-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-file-x { border: none; background: none; color: var(--g-text-3); cursor: pointer; padding: 0 2px; display: inline-grid; place-items: center; }
.op-file-x:hover { color: var(--g-text); }
.op-last { position: absolute; top: calc(100% + 10px); left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 11.5px; color: var(--g-text-2); }
.op-link { border: none; background: none; padding: 0; font: inherit; color: var(--ui-danger-text); cursor: pointer; }
.op-link:hover { text-decoration: underline; }

.op-win .op-head { cursor: grab; user-select: none; }
.op-win.op-center .op-head { cursor: default; }
.op-win.dragging .op-head { cursor: grabbing; }
.op-win .ds-dlg-ic.acc .op-spark { fill: var(--ui-live); }
.op-win .ds-dlg-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-win .ds-dlg-sub.op-live { color: var(--g-text); display: flex; align-items: center; gap: 7px; }
.op-win .ds-dlg-sub.op-live > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-win .pb-modal-body.op-body { display: flex; flex-direction: column; gap: 10px; padding: 12px 20px 2px; overflow-y: auto; min-height: 0; }

.op-plan { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.op-plan li { display: flex; align-items: flex-start; gap: 9px; padding: 3px 0; font-size: 12.5px; line-height: 1.4; color: var(--g-text-2); opacity: .75; }
.op-plan li .op-dot { flex: none; width: 14px; height: 14px; margin-top: 1px; display: grid; place-items: center; }
.op-plan li .op-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.op-plan li.done { opacity: 1; }
.op-plan li.done .op-dot::before { display: none; }
.op-plan li.done .op-dot { color: var(--ui-live); }
.op-plan li.cur { color: var(--g-text); font-weight: 600; opacity: 1; }
.op-plan li.cur .op-dot::before { width: 8px; height: 8px; background: var(--ui-live); box-shadow: 0 0 0 3px rgba(101, 220, 180, .16); }
.op-spin { flex: none; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .14); border-top-color: var(--ui-live); animation: opSpin .9s linear infinite; }

.op-log { display: flex; flex-direction: column; gap: 3px; padding-top: 8px; border-top: 1px solid var(--g-line-soft); }
.op-line { display: flex; gap: 8px; font-size: 11.5px; line-height: 1.45; color: var(--g-text-3); }
.op-line .op-ln-ic { flex: none; width: 12px; display: grid; place-items: center; margin-top: 2px; }
.op-line.did { color: var(--g-text-2); }
.op-line.did .op-ln-ic { color: var(--ui-live); }
.op-line.warn { color: var(--g-warn); }
.op-line.agent { color: var(--g-text); font-style: italic; }

.op-ask { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--g-r-sm); background: var(--g-row); border: 1px solid var(--g-line-soft); }
.op-ask.warn { border-color: rgba(229, 168, 115, .28); }
.op-ask.plain { padding: 0; background: none; border: none; }
.op-ask-t { font-size: 13px; font-weight: 600; color: var(--g-text); }
.op-ask-s { font-size: 12px; color: var(--g-text-2); line-height: 1.45; }
.op-ask .rvw-card { margin: 0; }
.op-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.op-opts.end { justify-content: flex-end; }
.op-opts.col { flex-direction: column; flex-wrap: nowrap; }
.op-opts .tbtn { height: 32px; padding: 0 12px; font-size: 12.5px; font-weight: 600; }
.op-opts.col .tbtn.ds-wide { width: 100%; height: 36px; }

.op-done { display: flex; flex-direction: column; gap: 8px; }
.op-sum { font-size: 13px; line-height: 1.55; color: var(--g-text); }
.op-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.op-stat { padding: 2px 8px; border-radius: var(--g-r-xs); background: var(--g-row); color: var(--g-text-2); font-size: 11.5px; }

.op-foot { gap: 10px; }
.op-spent { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--g-text-3); font-variant-numeric: tabular-nums; order: -1; }
.op-spent.near { color: var(--g-warn); }
.op-foot .ds-sp { order: 0; }
.op-foot button { order: 1; }
.op-foot button.ds-genbtn { min-width: 120px; }

.tl-block.op-working { outline: 2px solid var(--ui-live); outline-offset: 3px; animation: opNodePulse 1.4s ease-in-out infinite; }
@keyframes opNodePulse { 50% { outline-color: rgba(101, 220, 180, .2); } }
.op-work {
    position: absolute; z-index: 40; pointer-events: none; transform: translateY(-100%);
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; max-width: 260px;
    border-radius: var(--g-r-sm); background: rgba(16, 16, 16, .9); border: 1px solid var(--g-line);
    color: var(--g-text); font: 11px/16px var(--ui-font); white-space: nowrap;
}
.op-work-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ui-live); animation: opPulse 1.4s ease-in-out infinite; }
.op-work-t { overflow: hidden; text-overflow: ellipsis; }
.op-sel { font-size: 11.5px; color: var(--g-text-3); padding: 6px 2px 0 36px; }
.op-ask-cost { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--g-text); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .tl-block.op-working, .op-work-dot { animation: none; } }

.op-win.op-launch:not(.op-center) .op-logo { cursor: grab; }
.op-win.op-launch.dragging .op-logo { cursor: grabbing; }
