/* termspace workflow palette (docs/terminal.md §2.5) — overlay inside #terminalView, cmd/ctrl+k.
   Theme tokens come from :root in index.html; classes are prefixed tw-. */

.tw-overlay {
  position: absolute;
  inset: 0;
  z-index: 6; /* above .ts-search (3) and pane messages (2) */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px 16px;
  background: rgba(0, 0, 0, .55);
}
.tw-panel {
  width: min(680px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .6);
  color: var(--ink);
  font-size: 13px;
  overflow: hidden;
}

/* ---- head ---- */
.tw-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
}
.tw-title { color: var(--phosphor); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-hint { flex: 1; color: var(--ink-dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-back, .tw-close {
  border: none;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}
.tw-back:hover, .tw-close:hover { color: var(--phosphor); }

/* ---- body ---- */
.tw-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.tw-filter, .tw-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  font: inherit;
  padding: 6px 8px;
}
.tw-filter { flex: none; border-width: 0 0 1px; border-radius: 0; padding: 10px 12px; font-size: 14px; }
.tw-filter:focus, .tw-input:focus { outline: 1px solid var(--phosphor); outline-offset: -1px; }
.tw-textarea { min-height: 72px; resize: vertical; font-family: var(--mono); }

/* list */
.tw-list { list-style: none; margin: 0; padding: 4px 0; overflow: auto; flex: 1; min-height: 0; max-height: 60vh; }
.tw-item {
  position: relative;
  padding: 6px 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.tw-item.sel { background: var(--bg-panel); border-left-color: var(--phosphor); }
.tw-item.off { opacity: .55; }
.tw-item-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tw-item-name { color: var(--ink); font-weight: 600; }
.tw-item.sel .tw-item-name { color: var(--phosphor); }
.tw-tag { font-size: 11px; color: var(--amber); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; }
.tw-shells { font-size: 11px; color: var(--ink-dim); }
.tw-item-desc { color: var(--ink-dim); font-size: 12px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-item-cmd { color: var(--phosphor-dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-item-actions { position: absolute; right: 10px; top: 6px; display: none; gap: 4px; }
.tw-item.sel .tw-item-actions, .tw-item:hover .tw-item-actions { display: flex; }
.tw-item.tw-new .tw-item-name { color: var(--amber); }
.tw-empty { padding: 10px 12px; color: var(--ink-dim); font-size: 12px; }
.tw-note { padding: 6px 12px; color: var(--ink-dim); font-size: 11px; }
.tw-note:empty { display: none; }

/* forms (args / edit) */
.tw-form { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
.tw-desc { color: var(--ink-dim); font-size: 12px; }
.tw-field { display: flex; flex-direction: column; gap: 3px; }
.tw-label { color: var(--ink-dim); font-size: 12px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tw-label code { color: var(--amber); }
.tw-field-hint { color: var(--ink-faint); font-size: 11px; }
.tw-shells-pick { display: flex; gap: 12px; flex-wrap: wrap; }
.tw-check { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.tw-check input { accent-color: var(--phosphor); }
.tw-args-title { margin-top: 4px; }
.tw-argrows { display: flex; flex-direction: column; gap: 4px; }
.tw-argrow { display: grid; grid-template-columns: minmax(80px, 1fr) 2fr 1.5fr 2fr; gap: 4px; align-items: center; }
.tw-argname { color: var(--amber); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.tw-preview {
  margin: 0;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 3px;
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 160px;
  overflow: auto;
}
.tw-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* buttons */
.tw-btn {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 3px 10px;
}
.tw-btn:hover { color: var(--phosphor); border-color: var(--phosphor-dim); }
.tw-btn.primary { color: var(--bg); background: var(--phosphor); border-color: var(--phosphor); font-weight: 600; }
.tw-btn.primary:hover { background: var(--phosphor-dim); border-color: var(--phosphor-dim); }
.tw-btn.danger { color: var(--alert); }
.tw-btn.danger:hover { border-color: var(--alert); }
.tw-btn:disabled { opacity: .4; cursor: not-allowed; }
.tw-btn:focus-visible { outline: 1px solid var(--phosphor); outline-offset: 1px; }

/* status / confirm line */
.tw-msg { display: none; flex: none; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-dim); }
.tw-msg.show { display: flex; }
.tw-msg.ok { color: var(--phosphor); }
.tw-msg.warn { color: var(--amber); }
.tw-msg.error { color: var(--alert); }

/* ---- mobile (matches terminal.css / index.html @media (max-width: 768px)) ---- */
@media (max-width: 768px) {
  .tw-overlay { padding: 8px; align-items: stretch; }
  .tw-panel { width: 100%; }
  .tw-hint { display: none; }
  .tw-item-actions { display: flex; position: static; margin-top: 4px; }
  .tw-argrow { grid-template-columns: 1fr 1fr; }
  .tw-list { max-height: none; }
}
